Skip to content

Commit 4dabe3a

Browse files
committed
Fix: Check VL53L1X proximity == -1
1 parent deefb9b commit 4dabe3a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/i2c/drivers/WipperSnapper_I2C_Driver_VL53L1X.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,16 @@ class WipperSnapper_I2C_Driver_VL53L1X : public WipperSnapper_I2C_Driver {
8181
return false;
8282
}
8383
int16_t proximityMM = _VL53L1X->distance();
84-
if (proximityMM <= 0 || proximityMM > 4000) {
84+
if (proximityMM == -1) {
8585
WS_DEBUG_PRINT("VL53L1X: Invalid proximity value:");
8686
WS_DEBUG_PRINTLN(proximityMM);
8787
WS_DEBUG_PRINT("VL53L1X status: ");
8888
WS_DEBUG_PRINTLN(_VL53L1X->vl_status);
8989
proximityEvent->data[0] = NAN;
9090
} else {
9191
proximityEvent->data[0] = proximityMM;
92+
_VL53L1X->clearInterrupt();
9293
}
93-
_VL53L1X->clearInterrupt();
9494
return true;
9595
}
9696

0 commit comments

Comments
 (0)