fix: restart esp when wifi connection fails

This commit is contained in:
s3lph 2024-11-23 00:46:21 +01:00
parent 9d90adcd31
commit 62b834f33e
Signed by: s3lph
GPG key ID: 0AA29A52FB33CFB5

View file

@ -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