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!");
|
Serial.println("Reconnected!");
|
||||||
} else {
|
} else {
|
||||||
Serial.println("Reconnecting failed.");
|
Serial.println("Reconnecting failed.");
|
||||||
|
ESP.restart();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -302,8 +303,6 @@ uint16_t ambientBrightnessToPower() {
|
||||||
sum += rolling_average_brightness[i];
|
sum += rolling_average_brightness[i];
|
||||||
}
|
}
|
||||||
uint16_t brightness = sum / (sizeof(rolling_average_brightness)/sizeof(uint16_t));
|
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) {
|
if (brightness > spiffs_config.brightness_thresh_lower + 40 && leds_on_hysteresis) {
|
||||||
Serial.println("LED power off!");
|
Serial.println("LED power off!");
|
||||||
leds_on_hysteresis = false;
|
leds_on_hysteresis = false;
|
||||||
|
@ -346,7 +345,7 @@ void loop() {
|
||||||
pixels.setPixelColor(i, pixels.Color(power, 0, 0)); // closed -> red
|
pixels.setPixelColor(i, pixels.Color(power, 0, 0)); // closed -> red
|
||||||
break;
|
break;
|
||||||
case SpaceState::Open:
|
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;
|
break;
|
||||||
case SpaceState::Invalid:
|
case SpaceState::Invalid:
|
||||||
pixels.setPixelColor(i, pixels.Color(power, power/2, 0)); // invalid response -> orange
|
pixels.setPixelColor(i, pixels.Color(power, power/2, 0)); // invalid response -> orange
|
||||||
|
|
Loading…
Reference in a new issue