Status LED for flashing
This commit is contained in:
parent
9b27df7172
commit
04cb8bbaf0
@ -147,10 +147,11 @@ void mode2MQTT(){
|
|||||||
float temp[2] = { TEMP_INIT_VALUE, TEMP_INIT_VALUE };
|
float temp[2] = { TEMP_INIT_VALUE, TEMP_INIT_VALUE };
|
||||||
float* pFloat = temp;
|
float* pFloat = temp;
|
||||||
int devices = dallas.readAllTemperatures(pFloat, 2);
|
int devices = dallas.readAllTemperatures(pFloat, 2);
|
||||||
|
|
||||||
if (devices < 2) {
|
if (devices < 2) {
|
||||||
if ((pFloat[0] > TEMP_INIT_VALUE) && (pFloat[0] < TEMP_MAX_VALUE) ) {
|
if ((pFloat[0] > TEMP_INIT_VALUE) && (pFloat[0] < TEMP_MAX_VALUE) ) {
|
||||||
sensorTemp.setProperty("control").send( String(pFloat[0]));
|
sensorTemp.setProperty("control").send( String(pFloat[0]));
|
||||||
}
|
}
|
||||||
} else if (devices >= 2) {
|
} else if (devices >= 2) {
|
||||||
if ((pFloat[0] > TEMP_INIT_VALUE) && (pFloat[0] < TEMP_MAX_VALUE) ) {
|
if ((pFloat[0] > TEMP_INIT_VALUE) && (pFloat[0] < TEMP_MAX_VALUE) ) {
|
||||||
sensorTemp.setProperty("temp").send( String(pFloat[0]));
|
sensorTemp.setProperty("temp").send( String(pFloat[0]));
|
||||||
@ -270,7 +271,6 @@ void readSensors() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Serial << "DS18B20" << endl;
|
|
||||||
/* Read the temperature sensors once, as first time 85 degree is returned */
|
/* Read the temperature sensors once, as first time 85 degree is returned */
|
||||||
Serial << "DS18B20" << String(dallas.readDevices()) << endl;
|
Serial << "DS18B20" << String(dallas.readDevices()) << endl;
|
||||||
delay(200);
|
delay(200);
|
||||||
@ -322,9 +322,7 @@ void onHomieEvent(const HomieEvent& event) {
|
|||||||
|
|
||||||
//wait for rtc sync?
|
//wait for rtc sync?
|
||||||
rtcDeepSleepTime = deepSleepTime.get();
|
rtcDeepSleepTime = deepSleepTime.get();
|
||||||
if(!mode3Active){
|
mode2MQTT();
|
||||||
mode2MQTT();
|
|
||||||
}
|
|
||||||
Homie.getLogger() << "MQTT 1" << endl;
|
Homie.getLogger() << "MQTT 1" << endl;
|
||||||
break;
|
break;
|
||||||
case HomieEventType::READY_TO_SLEEP:
|
case HomieEventType::READY_TO_SLEEP:
|
||||||
@ -332,11 +330,11 @@ void onHomieEvent(const HomieEvent& event) {
|
|||||||
esp_deep_sleep_start();
|
esp_deep_sleep_start();
|
||||||
break;
|
break;
|
||||||
case HomieEventType::OTA_STARTED:
|
case HomieEventType::OTA_STARTED:
|
||||||
Serial.println("OTA DS Disabled");
|
digitalWrite(OUTPUT_SENSOR, HIGH);
|
||||||
mode3Active=true;
|
mode3Active=true;
|
||||||
break;
|
break;
|
||||||
case HomieEventType::OTA_SUCCESSFUL:
|
case HomieEventType::OTA_SUCCESSFUL:
|
||||||
Serial.println("OTA DS reenabled");
|
digitalWrite(OUTPUT_SENSOR, LOW);
|
||||||
mode3Active=false;
|
mode3Active=false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -699,9 +697,6 @@ void setup() {
|
|||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
Homie.loop();
|
Homie.loop();
|
||||||
if(mode3Active){
|
|
||||||
digitalWrite(OUTPUT_SENSOR, HIGH);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(millis() > 30000 && !mode3Active){
|
if(millis() > 30000 && !mode3Active){
|
||||||
Serial << (millis()/ 1000) << "s gone" << endl;
|
Serial << (millis()/ 1000) << "s gone" << endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user