File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -164,12 +164,12 @@ uint16_t SFEVL53L1X::getTimingBudgetInMs()
164164
165165void SFEVL53L1X::setDistanceModeLong ()
166166{
167- _device->VL53L1X_SetDistanceMode (2 );
167+ _device->VL53L1X_SetDistanceMode (DISTANCE_LONG );
168168}
169169
170170void SFEVL53L1X::setDistanceModeShort ()
171171{
172- _device->VL53L1X_SetDistanceMode (1 );
172+ _device->VL53L1X_SetDistanceMode (DISTANCE_SHORT );
173173}
174174
175175uint8_t SFEVL53L1X::getDistanceMode ()
@@ -368,9 +368,9 @@ void SFEVL53L1X::calibrateXTalk(uint16_t targetDistanceInMm)
368368
369369bool SFEVL53L1X::setThresholdConfig (DetectionConfig *config)
370370{
371- VL53L1X_ERROR error = _device->VL53L1X_SetDistanceThreshold (config->thresholdLow , config-> thresholdHigh ,
372- ( uint8_t ) config->windowMode , ( uint8_t ) config->IntOnNoTarget );
373- return (error == VL53L1_ERROR_NONE) ;
371+ return _device->VL53L1X_SetDistanceMode (config->distanceMode ) == VL53L1_ERROR_NONE &&
372+ _device-> VL53L1X_SetDistanceThreshold ( config->thresholdLow , config->thresholdHigh ,
373+ ( uint8_t )config-> windowMode , ( uint8_t )config-> IntOnNoTarget ) == VL53L1_ERROR_NONE;
374374}
375375
376376bool SFEVL53L1X::getThresholdConfig (DetectionConfig *config)
Original file line number Diff line number Diff line change 3030#include " vl53l1_error_codes.h"
3131#include " vl53l1x_class.h"
3232
33- #define DISTANCE_SHORT 0
34- #define DISTANCE_LONG 1
33+ #define DISTANCE_SHORT 1
34+ #define DISTANCE_LONG 2
3535#define WINDOW_BELOW 0
3636#define WINDOW_ABOVE 1
3737#define WINDOW_OUT 2
You can’t perform that action at this time.
0 commit comments