Fixed reboot watchdog fail safe.

This commit is contained in:
Willem Cazander 2024-06-28 18:17:54 +02:00
parent 40fe6ae015
commit 5051de99fe

View file

@ -61,10 +61,19 @@ proc fail_after { timeout {time_unit "time"} {fail_id "fail_after"} {fail_code 2
return $msg
}
proc fail_after_reboot_watchdog {} {
global fail_after_boot_timeout
if {$fail_after_boot_timeout != 0} {
fail_after $fail_after_boot_timeout realtime failed_boot 124
after boot "fail_after_reboot_watchdog"
}
}
# Globals
set fail_after_prev_timer 0
set fail_after_prev_id 0
set fail_after_path 0
set fail_after_boot_timeout 0
# Parse screenshot path env setting
if {[info exists ::env(FAIL_AFTER_PATH)] && ([string trim $::env(FAIL_AFTER_PATH)] != "")} {
@ -73,5 +82,6 @@ if {[info exists ::env(FAIL_AFTER_PATH)] && ([string trim $::env(FAIL_AFTER_PATH
# Enables boot watch dog timer when FAIL_AFTER_BOOT env has a value. (124 see `man timeout`)
if {[info exists ::env(FAIL_AFTER_BOOT)] && ([string trim $::env(FAIL_AFTER_BOOT)] != "")} {
fail_after [string trim $::env(FAIL_AFTER_BOOT)] realtime failed_boot 124
set fail_after_boot_timeout [string trim $::env(FAIL_AFTER_BOOT)]
fail_after_reboot_watchdog
}