From 97395b4a9681ec97e705f9088f085c65b7277b42 Mon Sep 17 00:00:00 2001 From: shogun160 <63370033+shogun160@users.noreply.github.com> Date: Thu, 19 Mar 2026 12:39:31 +0100 Subject: [PATCH] Add null checks for interrupt and XShut pins Add checks for optional interrupt and XShut pins before logging. --- components/vl53l1x/vl53l1x.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/vl53l1x/vl53l1x.cpp b/components/vl53l1x/vl53l1x.cpp index e53c280d..1659b5d3 100644 --- a/components/vl53l1x/vl53l1x.cpp +++ b/components/vl53l1x/vl53l1x.cpp @@ -15,8 +15,12 @@ void VL53L1X::dump_config() { if (xtalk.has_value()) { ESP_LOGCONFIG(TAG, " XTalk: %dcps", this->xtalk.value()); } - LOG_PIN(" Interrupt Pin: ", this->interrupt_pin.value()); - LOG_PIN(" XShut Pin: ", this->xshut_pin.value()); + if (this->interrupt_pin.has_value()) { + LOG_PIN(" Interrupt Pin: ", this->interrupt_pin.value()); + } + if (this->xshut_pin.has_value()) { + LOG_PIN(" XShut Pin: ", this->xshut_pin.value()); + } } void VL53L1X::setup() {