From 59fe2c9d4e5b579035be5666f303d7553e1e8961 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 15 Jan 2024 09:09:43 +1100 Subject: [PATCH] AP_Periph: added reboot for scripting --- Tools/AP_Periph/AP_Periph.cpp | 8 ++++++++ Tools/AP_Periph/AP_Periph.h | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Tools/AP_Periph/AP_Periph.cpp b/Tools/AP_Periph/AP_Periph.cpp index 41bf37b92c..8a08df7aed 100644 --- a/Tools/AP_Periph/AP_Periph.cpp +++ b/Tools/AP_Periph/AP_Periph.cpp @@ -594,6 +594,14 @@ void AP_Periph_FW::prepare_reboot() hal.scheduler->delay(40); } +/* + reboot, optionally holding in bootloader. For scripting + */ +void AP_Periph_FW::reboot(bool hold_in_bootloader) +{ + hal.scheduler->reboot(hold_in_bootloader); +} + AP_Periph_FW *AP_Periph_FW::_singleton; AP_Periph_FW& AP::periph() diff --git a/Tools/AP_Periph/AP_Periph.h b/Tools/AP_Periph/AP_Periph.h index d0e0c279be..991ddf2b23 100644 --- a/Tools/AP_Periph/AP_Periph.h +++ b/Tools/AP_Periph/AP_Periph.h @@ -468,7 +468,10 @@ public: uint16_t data_type_id, CanardTransferType transfer_type, uint8_t source_node_id); - + + // reboot the peripheral, optionally holding in bootloader + void reboot(bool hold_in_bootloader); + #if AP_UART_MONITOR_ENABLED void handle_tunnel_Targetted(CanardInstance* canard_instance, CanardRxTransfer* transfer); void send_serial_monitor_data();