voxl2: add system reboot support

This commit is contained in:
Eric Katzfey
2026-02-22 11:37:31 -07:00
committed by Eric Katzfey
parent 30cbf84fd8
commit 845a7efd58
12 changed files with 169 additions and 7 deletions
@@ -130,6 +130,12 @@ void uORB::AppsProtobufChannel::SubscribeCallback(const char *topic)
// This will happen when a newer PX4 version is talking to a
// SLPI image that doesn't support the CPULOAD request. If the
// SLPI image does support it then we wouldn't get this.
} else if (strcmp(topic, "RESET") == 0) {
PX4_ERR("Got RESET subscription, Rebooting...");
fc_sensor_kill_slpi();
sleep(2);
exit(-1);
} else if (_RxHandler) {
pthread_mutex_lock(&_rx_mutex);
_SlpiSubscriberCache[topic]++;
@@ -628,6 +628,15 @@ int px4muorb_send_topic_data(const char *topic_name, const uint8_t *data,
}
void px4muorb_request_reset(void)
{
uORB::ProtobufChannel *channel = uORB::ProtobufChannel::GetInstance();
if (channel) {
(void) channel->add_subscription("RESET", 0);
}
}
float px4muorb_get_cpu_load(void)
{
@@ -243,6 +243,8 @@ extern "C" {
int px4muorb_send_topic_data(const char *name, const uint8_t *data, int data_len_in_bytes) __EXPORT;
float px4muorb_get_cpu_load(void) __EXPORT;
void px4muorb_request_reset(void) __EXPORT;
}
#endif // _uORBProtobufChannel_hpp_