From 1ade8450078bd70a254d4d74e47213ff8a6c849c Mon Sep 17 00:00:00 2001 From: David Hebbeker Date: Sun, 11 Apr 2021 13:20:35 +0200 Subject: [PATCH] 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. --- src/vl53l1_class.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vl53l1_class.h b/src/vl53l1_class.h index 2992cea..fb2a87a 100644 --- a/src/vl53l1_class.h +++ b/src/vl53l1_class.h @@ -341,12 +341,12 @@ class VL53L1 : public RangeSensor { #ifdef DEBUG_MODE uint8_t byteData; uint16_t wordData; - status = VL53L1_RdByte(Dev, 0x010F, &byteData); + status = VL53L1_RdByte(Dev, VL53L1_IDENTIFICATION__MODEL_ID, &byteData); Serial.println("VL53L1 Model_ID: " + String(byteData)); - status = VL53L1_RdByte(Dev, 0x0110, &byteData); + status = VL53L1_RdByte(Dev, VL53L1_IDENTIFICATION__MODULE_TYPE, &byteData); Serial.println("VL53L1 Module_Type: " + String(byteData)); - status = VL53L1_RdWord(Dev, 0x010F, &wordData); - Serial.println("VL53L1: " + String(wordData)); + status = VL53L1_RdWord(Dev, VL53L1_IDENTIFICATION__MODULE_ID, &wordData); + Serial.println("VL53L1 Module_ID: " + String(wordData)); #endif if (status == VL53L1_ERROR_NONE) {