simply wait loop logic

This commit is contained in:
ju6ge 2025-02-27 21:58:30 +01:00
parent b1074db71c
commit 4e642a4421
Signed by: judge
GPG Key ID: 6512C30DD8E017B5

View File

@ -932,11 +932,10 @@ fn wait_infinity(wait_type: WaitType, reboot_now: Arc<AtomicBool>) -> ! {
let mut led_count = 8;
loop {
// TODO implement actually different blink patterns instead of modulating blink duration
if wait_type == WaitType::MissingConfig {
led_count %= 8;
led_count += 1;
if led_count > 8 {
led_count = 1;
}
};
unsafe {
//do not trigger watchdog
@ -946,17 +945,14 @@ fn wait_infinity(wait_type: WaitType, reboot_now: Arc<AtomicBool>) -> ! {
BOARD_ACCESS.lock().unwrap().general_fault(true);
vTaskDelay(delay);
BOARD_ACCESS.lock().unwrap().general_fault(false);
//TODO move locking outside of loop and drop afterwards
for i in 0..8 {
BOARD_ACCESS.lock().unwrap().fault(i, false);
}
vTaskDelay(delay);
match wait_type {
WaitType::MissingConfig => {}
WaitType::ConfigButton => {}
WaitType::MqttConfig => {
if !STAY_ALIVE.load(std::sync::atomic::Ordering::Relaxed) {
reboot_now.store(true, std::sync::atomic::Ordering::Relaxed);
}
if wait_type == WaitType::MqttConfig {
if !STAY_ALIVE.load(std::sync::atomic::Ordering::Relaxed) {
reboot_now.store(true, std::sync::atomic::Ordering::Relaxed);
}
}
if reboot_now.load(std::sync::atomic::Ordering::Relaxed) {