Skip to content

Commit 2b7e1ed

Browse files
committed
Correct failure logic
1 parent 8ca4066 commit 2b7e1ed

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/components/i2c/drivers/WipperSnapper_I2C_Driver_VL53L4CX.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,14 @@ class WipperSnapper_I2C_Driver_VL53L4CX : public WipperSnapper_I2C_Driver {
142142
int no_of_object_found = pMultiRangingData->NumberOfObjectsFound;
143143
if (no_of_object_found - 1 < index) {
144144
WS_DEBUG_PRINT("Object not found at index #");
145-
WS_DEBUG_PRINTLN(index);
146-
return false;
145+
WS_DEBUG_PRINT(index);
146+
WS_DEBUG_PRINTLN(", returning NaN");
147+
proximityEvent->data[0] = NAN;
148+
return true;
147149
}
148150
bool retVal = updateDataPointIfValid(pMultiRangingData->RangeData[index],
149151
proximityEvent);
152+
return retVal;
150153
} else {
151154
WS_DEBUG_PRINT("VL53L4CX Error: ");
152155
WS_DEBUG_PRINTLN(status);

0 commit comments

Comments
 (0)