fix: restart esp when wifi connection fails
This commit is contained in:
parent
9d90adcd31
commit
62b834f33e
1 changed files with 2 additions and 3 deletions
|
@ -220,6 +220,7 @@ bool updateMap() {
|
|||
Serial.println("Reconnected!");
|
||||
} else {
|
||||
Serial.println("Reconnecting failed.");
|
||||
ESP.restart();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -302,8 +303,6 @@ uint16_t ambientBrightnessToPower() {
|
|||
sum += rolling_average_brightness[i];
|
||||
}
|
||||
uint16_t brightness = sum / (sizeof(rolling_average_brightness)/sizeof(uint16_t));
|
||||
Serial.print("brightness: ");
|
||||
Serial.println(brightness);
|
||||
if (brightness > spiffs_config.brightness_thresh_lower + 40 && leds_on_hysteresis) {
|
||||
Serial.println("LED power off!");
|
||||
leds_on_hysteresis = false;
|
||||
|
@ -346,7 +345,7 @@ void loop() {
|
|||
pixels.setPixelColor(i, pixels.Color(power, 0, 0)); // closed -> red
|
||||
break;
|
||||
case SpaceState::Open:
|
||||
pixels.setPixelColor(i, pixels.Color(0, power, power/8)); // open -> green
|
||||
pixels.setPixelColor(i, pixels.Color(0, power, 0)); // open -> green
|
||||
break;
|
||||
case SpaceState::Invalid:
|
||||
pixels.setPixelColor(i, pixels.Color(power, power/2, 0)); // invalid response -> orange
|
||||
|
|
Loading…
Reference in a new issue