Skip to content

Commit

Permalink
feat(reboot_reason): new reason published on Jetson requested reboot (#…
Browse files Browse the repository at this point in the history
…141)

publish `ShutdownScheduled` message with `JETSON_REQUESTED_REBOOT` when Jetson request a microcontroller reboot
new reboot reason for Memfault reporting.

---------

Signed-off-by: Srikar Chintapalli <[email protected]>
  • Loading branch information
sri9311 authored Jan 16, 2025
1 parent 61b0003 commit 3927fa2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions main_board/config/memfault_reboot_reason_user_config.def
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Defines "unexpected" reboots
MEMFAULT_UNEXPECTED_REBOOT_REASON_DEFINE(BatteryRemoved)
MEMFAULT_UNEXPECTED_REBOOT_REASON_DEFINE(HeartbeatFromJetsonTimeout)
MEMFAULT_EXPECTED_REBOOT_REASON_DEFINE(JetsonRequestedReboot)
17 changes: 17 additions & 0 deletions main_board/src/runner/runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
#include <memfault/metrics/connectivity.h>
#endif

#if defined(CONFIG_MEMFAULT)
#include <memfault/core/reboot_tracking.h>
#endif

LOG_MODULE_REGISTER(runner, CONFIG_RUNNER_LOG_LEVEL);

K_THREAD_STACK_DEFINE(runner_process_stack, THREAD_STACK_SIZE_RUNNER);
Expand Down Expand Up @@ -315,6 +319,19 @@ handle_reboot_message(job_t *job)

if (ret == RET_SUCCESS) {
job_ack(orb_mcu_Ack_ErrorCode_SUCCESS, job);
// Send out shutdown scheduled CAN message
orb_mcu_main_ShutdownScheduled shutdown;
shutdown.shutdown_reason =
orb_mcu_main_ShutdownScheduled_ShutdownReason_JETSON_REQUESTED_REBOOT;
shutdown.has_ms_until_shutdown = true;
shutdown.ms_until_shutdown = delay * 1000;
publish_new(&shutdown, sizeof(shutdown),
orb_mcu_main_McuToJetson_shutdown_tag,
CONFIG_CAN_ADDRESS_DEFAULT_REMOTE);
#ifdef CONFIG_MEMFAULT
MEMFAULT_REBOOT_MARK_RESET_IMMINENT(
kMfltRebootReason_JetsonRequestedReboot);
#endif
} else {
job_ack(orb_mcu_Ack_ErrorCode_FAIL, job);
}
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ manifest:
remote: memfault
revision: 1.17.0
- name: orb-messages
revision: 44de6d08fb329da43db9276866d51effc6595fcf
revision: d303b8ae88c96559b08336fdbcdcc55e3ea27698
path: modules/orb-messages/public
- name: priv-orb-messages
revision: 24b1543547649818bc236ecb9a1ed5794b7f57d0
Expand Down

0 comments on commit 3927fa2

Please sign in to comment.