simply wait loop logic
This commit is contained in:
		@@ -932,11 +932,10 @@ fn wait_infinity(wait_type: WaitType, reboot_now: Arc<AtomicBool>) -> ! {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    let mut led_count = 8;
 | 
					    let mut led_count = 8;
 | 
				
			||||||
    loop {
 | 
					    loop {
 | 
				
			||||||
 | 
					        // TODO implement actually different blink patterns instead of modulating blink duration
 | 
				
			||||||
        if wait_type == WaitType::MissingConfig {
 | 
					        if wait_type == WaitType::MissingConfig {
 | 
				
			||||||
 | 
					            led_count %= 8;
 | 
				
			||||||
            led_count += 1;
 | 
					            led_count += 1;
 | 
				
			||||||
            if led_count > 8 {
 | 
					 | 
				
			||||||
                led_count = 1;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        unsafe {
 | 
					        unsafe {
 | 
				
			||||||
            //do not trigger watchdog
 | 
					            //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);
 | 
					            BOARD_ACCESS.lock().unwrap().general_fault(true);
 | 
				
			||||||
            vTaskDelay(delay);
 | 
					            vTaskDelay(delay);
 | 
				
			||||||
            BOARD_ACCESS.lock().unwrap().general_fault(false);
 | 
					            BOARD_ACCESS.lock().unwrap().general_fault(false);
 | 
				
			||||||
 | 
					            //TODO move locking outside of loop and drop afterwards
 | 
				
			||||||
            for i in 0..8 {
 | 
					            for i in 0..8 {
 | 
				
			||||||
                BOARD_ACCESS.lock().unwrap().fault(i, false);
 | 
					                BOARD_ACCESS.lock().unwrap().fault(i, false);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            vTaskDelay(delay);
 | 
					            vTaskDelay(delay);
 | 
				
			||||||
            match wait_type {
 | 
					            if wait_type == WaitType::MqttConfig {
 | 
				
			||||||
                WaitType::MissingConfig => {}
 | 
					                if !STAY_ALIVE.load(std::sync::atomic::Ordering::Relaxed) {
 | 
				
			||||||
                WaitType::ConfigButton => {}
 | 
					                    reboot_now.store(true, std::sync::atomic::Ordering::Relaxed);
 | 
				
			||||||
                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) {
 | 
					            if reboot_now.load(std::sync::atomic::Ordering::Relaxed) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user