fix(hwReboot): only wait for extra settle time if delay is greater than 1 second

This commit is contained in:
Siyuan 2025-11-18 14:48:39 +00:00
parent ad8acd0902
commit ae3b2b7628
1 changed files with 4 additions and 2 deletions

6
hw.go
View File

@ -40,13 +40,15 @@ func readOtpEntropy() ([]byte, error) { //nolint:unused
}
func hwReboot(force bool, postRebootAction *ota.PostRebootAction, delay time.Duration) error {
logger.Info().Msgf("Reboot requested, rebooting in %d seconds...", delay)
logger.Info().Dur("delay", delay).Msg("reboot requested")
writeJSONRPCEvent("willReboot", postRebootAction, currentSession)
time.Sleep(1 * time.Second) // Wait for the JSONRPCEvent to be sent
nativeInstance.SwitchToScreenIfDifferent("rebooting_screen")
time.Sleep(delay - (1 * time.Second)) // wait requested extra settle time
if delay > 1*time.Second {
time.Sleep(delay - 1*time.Second) // wait requested extra settle time
}
args := []string{}
if force {