Skip to content

Commit 1ade845

Browse files
committed
Pretty up sensor identification output for debugging.
Use existing preprocessor macros instead of "magic numbers" as register index. Also the last read, seems to address a 2 byte (word) register. Thus probably the *module* ID was meat to be read, instead of the *model* ID, which is only 1 byte.
1 parent bdd6387 commit 1ade845

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/vl53l1_class.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,12 @@ class VL53L1 : public RangeSensor {
341341
#ifdef DEBUG_MODE
342342
uint8_t byteData;
343343
uint16_t wordData;
344-
status = VL53L1_RdByte(Dev, 0x010F, &byteData);
344+
status = VL53L1_RdByte(Dev, VL53L1_IDENTIFICATION__MODEL_ID, &byteData);
345345
Serial.println("VL53L1 Model_ID: " + String(byteData));
346-
status = VL53L1_RdByte(Dev, 0x0110, &byteData);
346+
status = VL53L1_RdByte(Dev, VL53L1_IDENTIFICATION__MODULE_TYPE, &byteData);
347347
Serial.println("VL53L1 Module_Type: " + String(byteData));
348-
status = VL53L1_RdWord(Dev, 0x010F, &wordData);
349-
Serial.println("VL53L1: " + String(wordData));
348+
status = VL53L1_RdWord(Dev, VL53L1_IDENTIFICATION__MODULE_ID, &wordData);
349+
Serial.println("VL53L1 Module_ID: " + String(wordData));
350350
#endif
351351

352352
if (status == VL53L1_ERROR_NONE) {

0 commit comments

Comments
 (0)