send less data for range sensor
This commit is contained in:
parent
899f706845
commit
8d86953a7d
|
@ -32,10 +32,10 @@ public:
|
||||||
void setSettings_voc(float minchange, unsigned long senddelaymax, unsigned long readdelay);
|
void setSettings_voc(float minchange, unsigned long senddelaymax, unsigned long readdelay);
|
||||||
void setSettings_co(float minchange, unsigned long senddelaymax, unsigned long readdelay);
|
void setSettings_co(float minchange, unsigned long senddelaymax, unsigned long readdelay);
|
||||||
void advertise(HomieNode& p_sensorNode);
|
void advertise(HomieNode& p_sensorNode);
|
||||||
void sensorloop_no2();
|
void sensorloop_no2(); // GM-102B Nitrogen Dioxide
|
||||||
void sensorloop_c2h5oh();
|
void sensorloop_c2h5oh(); //GM-302B Ethyl Alcohol
|
||||||
void sensorloop_voc();
|
void sensorloop_voc(); // GM-502B Volatile Organic Compounds
|
||||||
void sensorloop_co();
|
void sensorloop_co(); // GM-702B Carbon Monoxide
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -67,13 +67,15 @@ void Sensor_VL53L1X::sensorloop()
|
||||||
Serial.print(vl53l1x.ranging_data.ambient_count_rate_MCPS);
|
Serial.print(vl53l1x.ranging_data.ambient_count_rate_MCPS);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
*/
|
*/
|
||||||
|
//&& VL53L1X::rangeStatusToString(vl53l1x->ranging_data.range_status)=="range valid"
|
||||||
if (abs((int)d.lastsentvalue-d.value)>=d.minchange ){ //int abs
|
if (abs((int)d.lastsentvalue-d.value)>=d.minchange ){ //int abs
|
||||||
|
if (vl53l1x->ranging_data.range_status==0) { // "0 is range valid"
|
||||||
_changed=true;
|
_changed=true;
|
||||||
}
|
}
|
||||||
if (lastsentvalue_vl53l1x_status!=vl53l1x->ranging_data.range_status) { //sensor status changed
|
|
||||||
_changed=true;
|
|
||||||
}
|
}
|
||||||
|
/*if (lastsentvalue_vl53l1x_status!=vl53l1x->ranging_data.range_status) { //sensor status changed
|
||||||
|
_changed=true;
|
||||||
|
}*/
|
||||||
d.lastreadtime=millis();
|
d.lastreadtime=millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue