UavcanNode:Only write alt id not booted by PX4

This commit is contained in:
David Sidrane
2021-02-10 09:54:37 -08:00
committed by Daniel Agar
parent 71c4f5a05b
commit 05c0deae14
+10 -7
View File
@@ -251,13 +251,16 @@ void UavcanNode::cb_beginfirmware_update(const uavcan::ReceivedDataStructure<Uav
if (!inprogress) {
inprogress = true;
bootloader_alt_app_shared_t shared_alt{0};
shared_alt.fw_server_node_id = req.source_node_id;
shared_alt.node_id = _node.getNodeID().get();
shared_alt.path[0] = '\0';
strncat((char *)shared_alt.path, (const char *)req.image_file_remote_path.path.c_str(), sizeof(shared_alt.path) - 1);
bootloader_alt_app_shared_write(&shared_alt);
board_configure_reset(BOARD_RESET_MODE_CAN_BL, shared_alt.node_id);
if (!board_booted_by_px4()) {
bootloader_alt_app_shared_t shared_alt{0};
shared_alt.fw_server_node_id = req.source_node_id;
shared_alt.node_id = _node.getNodeID().get();
shared_alt.path[0] = '\0';
strncat((char *)shared_alt.path, (const char *)req.image_file_remote_path.path.c_str(), sizeof(shared_alt.path) - 1);
bootloader_alt_app_shared_write(&shared_alt);
board_configure_reset(BOARD_RESET_MODE_CAN_BL, shared_alt.node_id);
}
bootloader_app_shared_t shared;
shared.bus_speed = active_bitrate;