Issue #5: Implement startup screen in case apanic happened and prevent the PID controller from starting when a watchdog reset has occured
This commit is contained in:
		@@ -177,7 +177,7 @@ enum analog_value_monitor {
 | 
				
			|||||||
			ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_SYSTICK, SAFETY_FLAG_CONFIG_WEIGHT_PANIC), \
 | 
								ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_SYSTICK, SAFETY_FLAG_CONFIG_WEIGHT_PANIC), \
 | 
				
			||||||
			/* Watchdog timeout is not handled periodically, but only on startup.
 | 
								/* Watchdog timeout is not handled periodically, but only on startup.
 | 
				
			||||||
			 * Therefore, it is not listed here */\
 | 
								 * Therefore, it is not listed here */\
 | 
				
			||||||
			ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_WTCHDG_FIRED, SAFETY_FLAG_CONFIG_WEIGHT_NONE), \
 | 
								ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_WTCHDG_FIRED, SAFETY_FLAG_CONFIG_WEIGHT_PID), \
 | 
				
			||||||
			ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_UNCAL, SAFETY_FLAG_CONFIG_WEIGHT_NONE), \
 | 
								ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_UNCAL, SAFETY_FLAG_CONFIG_WEIGHT_NONE), \
 | 
				
			||||||
			ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_DEBUG, SAFETY_FLAG_CONFIG_WEIGHT_NONE), \
 | 
								ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_DEBUG, SAFETY_FLAG_CONFIG_WEIGHT_NONE), \
 | 
				
			||||||
			ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_TIMING_MAIN_LOOP, SAFETY_FLAG_CONFIG_WEIGHT_PANIC), \
 | 
								ERR_FLAG_WEIGHT_ENTRY(ERR_FLAG_TIMING_MAIN_LOOP, SAFETY_FLAG_CONFIG_WEIGHT_PANIC), \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -155,6 +155,12 @@ static inline void handle_boot_status(void)
 | 
				
			|||||||
	res = safety_memory_get_boot_status(&status);
 | 
						res = safety_memory_get_boot_status(&status);
 | 
				
			||||||
	if (res != 0)
 | 
						if (res != 0)
 | 
				
			||||||
		panic_mode();
 | 
							panic_mode();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (status.reset_from_panic) {
 | 
				
			||||||
 | 
							/* We've seen a panic */
 | 
				
			||||||
 | 
							gui_root_menu_message_set("!! PANIC !!", "Check error me- mory!");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (status.reboot_to_bootloader) {
 | 
						if (status.reboot_to_bootloader) {
 | 
				
			||||||
		status.reboot_to_bootloader = 0UL;
 | 
							status.reboot_to_bootloader = 0UL;
 | 
				
			||||||
		safety_memory_set_boot_status(&status);
 | 
							safety_memory_set_boot_status(&status);
 | 
				
			||||||
@@ -230,6 +236,7 @@ int main(void)
 | 
				
			|||||||
	uint64_t quarter_sec_timestamp = 0ULL;
 | 
						uint64_t quarter_sec_timestamp = 0ULL;
 | 
				
			||||||
	static uint64_t IN_SECTION(.ccm.bss) main_loop_iter_count;
 | 
						static uint64_t IN_SECTION(.ccm.bss) main_loop_iter_count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Setup all the peripherals and external componets like LCD, EEPROM etc. and the safety controller */
 | 
				
			||||||
	setup_system();
 | 
						setup_system();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Try load the calibration. This will only succeed if there's an EEPROM */
 | 
						/* Try load the calibration. This will only succeed if there's an EEPROM */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user