Fix VL53L1x domoticz distance

Fix VL53L1x domoticz distance (#9210)
This commit is contained in:
Theo Arends 2020-09-30 11:07:13 +02:00
parent 6684a6e515
commit c5e95b95d4

View File

@ -71,7 +71,7 @@ void Vl53l1Every_250MSecond(void) {
#ifdef USE_DOMOTICZ #ifdef USE_DOMOTICZ
void Vl53l1Every_Second(void) { void Vl53l1Every_Second(void) {
char distance[FLOATSZ]; char distance[FLOATSZ];
dtostrfd((float)vl53l1x_sensors.distance / 1000, 3, distance); dtostrfd((float)vl53l1x_sensors.distance / 10, 1, distance);
DomoticzSensor(DZ_ILLUMINANCE, distance); DomoticzSensor(DZ_ILLUMINANCE, distance);
} }
#endif // USE_DOMOTICZ #endif // USE_DOMOTICZ
@ -80,9 +80,7 @@ void Vl53l1Show(bool json) {
if (json) { if (json) {
#ifdef USE_DOMOTICZ #ifdef USE_DOMOTICZ
if (0 == tele_period) { if (0 == tele_period) {
char distance[FLOATSZ]; Vl53l1Every_Second();
dtostrfd((float)vl53l1x_sensors.distance / 1000, 3, distance);
DomoticzSensor(DZ_ILLUMINANCE, distance);
} }
#endif // USE_DOMOTICZ #endif // USE_DOMOTICZ
ResponseAppend_P(PSTR(",\"VL53L1X\":{\"" D_JSON_DISTANCE "\":%d}"), vl53l1x_sensors.distance); ResponseAppend_P(PSTR(",\"VL53L1X\":{\"" D_JSON_DISTANCE "\":%d}"), vl53l1x_sensors.distance);