diff --git a/examples/ESCNode/esc_node.c b/examples/ESCNode/esc_node.c index 7f9e386..60b9f75 100644 --- a/examples/ESCNode/esc_node.c +++ b/examples/ESCNode/esc_node.c @@ -290,6 +290,16 @@ static void handle_param_ExecuteOpcode(CanardInstance* ins, CanardRxTransfer* tr total_size); } +/* + handle RestartNode request + */ +static void handle_RestartNode(CanardInstance* ins, CanardRxTransfer* transfer) +{ + // the ESC should reboot now! + printf("Rebooting!!!\n"); + exit(0); +} + /* handle a GetNodeInfo request */ @@ -482,6 +492,10 @@ static void onTransferReceived(CanardInstance *ins, CanardRxTransfer *transfer) handle_param_ExecuteOpcode(ins, transfer); break; } + case UAVCAN_PROTOCOL_RESTARTNODE_ID: { + handle_RestartNode(ins, transfer); + break; + } } } if (transfer->transfer_type == CanardTransferTypeBroadcast) { @@ -530,6 +544,10 @@ static bool shouldAcceptTransfer(const CanardInstance *ins, *out_data_type_signature = UAVCAN_PROTOCOL_PARAM_EXECUTEOPCODE_SIGNATURE; return true; } + case UAVCAN_PROTOCOL_RESTARTNODE_ID: { + *out_data_type_signature = UAVCAN_PROTOCOL_RESTARTNODE_SIGNATURE; + return true; + } } } if (transfer_type == CanardTransferTypeBroadcast) {