make temperature request async
This commit is contained in:
parent
b11e3dc9b2
commit
fe93d9eff6
|
@ -113,9 +113,12 @@ void temperature_loop(unsigned long loopmillis) {
|
||||||
Serial.println("Warn: Request Temperatures Timeout!");
|
Serial.println("Warn: Request Temperatures Timeout!");
|
||||||
publishInfo("error/temperature","Warn: Request Temperatures Timeout!");
|
publishInfo("error/temperature","Warn: Request Temperatures Timeout!");
|
||||||
flag_requestTemperatures=false;
|
flag_requestTemperatures=false;
|
||||||
|
last_read_ds18b20=loopmillis;
|
||||||
}
|
}
|
||||||
if (!flag_requestTemperatures) {
|
if (!flag_requestTemperatures) {
|
||||||
sensors.requestTemperatures(); //this takes ~600ms
|
sensors.setWaitForConversion(false); //make async
|
||||||
|
sensors.requestTemperatures(); //this takes ~600ms in non async mode. about 2ms in async mode
|
||||||
|
sensors.setWaitForConversion(true);
|
||||||
flag_requestTemperatures=true;
|
flag_requestTemperatures=true;
|
||||||
}
|
}
|
||||||
if (sensors.isConversionComplete()) {
|
if (sensors.isConversionComplete()) {
|
||||||
|
|
Loading…
Reference in New Issue