mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 10:23:34 +08:00
px4iofirmware: make forceupdate more reliable
this schedules a reboot rather than rebooting immediately, which means the FMU gets an ACK for its reboot operation, preventing it from timing out waiting for the ACK. That makes the timing of the reboot more consistent, which makes it more reliable for forceupdate
This commit is contained in:
committed by
Lorenz Meier
parent
76477b2057
commit
1a13e66aab
@@ -125,6 +125,25 @@ heartbeat_blink(void)
|
||||
LED_BLUE(heartbeat = !heartbeat);
|
||||
}
|
||||
|
||||
static uint64_t reboot_time;
|
||||
|
||||
/**
|
||||
schedule a reboot in time_delta_usec microseconds
|
||||
*/
|
||||
void schedule_reboot(uint32_t time_delta_usec)
|
||||
{
|
||||
reboot_time = hrt_absolute_time() + time_delta_usec;
|
||||
}
|
||||
|
||||
/**
|
||||
check for a scheduled reboot
|
||||
*/
|
||||
static void check_reboot(void)
|
||||
{
|
||||
if (reboot_time != 0 && hrt_absolute_time() > reboot_time) {
|
||||
up_systemreset();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
calculate_fw_crc(void)
|
||||
@@ -249,6 +268,8 @@ user_start(int argc, char *argv[])
|
||||
heartbeat_blink();
|
||||
}
|
||||
|
||||
check_reboot();
|
||||
|
||||
#if 0
|
||||
/* check for debug activity */
|
||||
show_debug_messages();
|
||||
|
||||
Reference in New Issue
Block a user