How to detect vehicle reboot?

Payload is configuring a few streams/parameters.
In case of a preflight reboot, HEARTBEAT.system_status is supposed to be able to indicate 0=unintialized, 1=booting, 2=calibrating …according to
https://mavlink.io/en/messages/common.html#MAV_STATE

SITL proves that this is not the case, except for a short jump to 4 - it is hard to determine that the system is rebooted.
Please help me find a way that payload computer can detect that the ArduPlane/Copter rebooted,

there is a hack I used once.
use an unused channel as a register and store a number. whenever this number is reset then the board has rebooted.

Thank you, it sounds like a nice workaround.
Did you use RC_CHANNELS_OVERRIDE message to set a channel ?

Several packets (RC_CHANNELS_SCALED, SYSTEM_TIME, LOCAL_POSITION_NED and a few others I think) have a time_boot_ms field - the number of milliseconds since boot.

If you see this number reset (or ever go down in value), then the vehicle has rebooted.

1 Like

If your autopilot supports Lua scripting, you could create a one line script like:

gcs:send_text(4, ‘Reboot Detected')

That would send a single MAVLink text message on the telemetry port(s) on any boot cycle and then exit.

Although I think Stephen’s time based solution above is probably a bit cleaner.

Thank you! - lots of good suggestions here, time_boot_ms is really simple in terms of code lines needed.

or MAV_CMD_DO_SET_SERVO
I liked other solutions especially the time_boot_ms which is straight forward.