feat: add pump corrosion protection feature, extend error handling for pump operations, and enhance configuration options

This commit is contained in:
2026-04-16 21:56:46 +02:00
parent b740574c68
commit 0f6cb5243c
6 changed files with 95 additions and 18 deletions

View File

@@ -55,6 +55,8 @@ static mut CONSECUTIVE_WATERING_PLANT: [u32; PLANT_COUNT] = [0; PLANT_COUNT];
static mut LOW_VOLTAGE_DETECTED: i8 = 0;
#[esp_hal::ram(unstable(rtc_fast), unstable(persistent))]
static mut RESTART_TO_CONF: i8 = 0;
#[esp_hal::ram(unstable(rtc_fast), unstable(persistent))]
static mut LAST_CORROSION_PROTECTION_CHECK_DAY: i8 = -1;
const NTP_SERVER: &str = "pool.ntp.org";
@@ -341,6 +343,14 @@ impl Esp<'_> {
}
}
}
pub(crate) fn get_last_corrosion_protection_check_day(&self) -> i8 {
unsafe { LAST_CORROSION_PROTECTION_CHECK_DAY }
}
pub(crate) fn set_last_corrosion_protection_check_day(&mut self, day: i8) {
unsafe {
LAST_CORROSION_PROTECTION_CHECK_DAY = day;
}
}
pub(crate) async fn wifi_ap(&mut self, spawner: Spawner) -> FatResult<Stack<'static>> {
let ssid = match self.load_config().await {
@@ -595,6 +605,7 @@ impl Esp<'_> {
} else {
RESTART_TO_CONF = 0;
}
LAST_CORROSION_PROTECTION_CHECK_DAY = -1;
};
} else {
unsafe {