From 9ad604247daec2eed38f1547ab733dde77d53174 Mon Sep 17 00:00:00 2001 From: Benjamin Vedder Date: Fri, 26 Mar 2021 17:58:21 +0100 Subject: [PATCH] Updated changelog and minor fixes --- CHANGELOG | 1 + conf_general.h | 2 +- libcanard/canard_driver.c | 18 ++++++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2d5dd4c00..37604a121 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,7 @@ * Observer global convergence update. Helps tracking the motor through 0 speed. * Added HFI start sensor mode. * Added TEMP_SENSOR_KTY84_130. +* Major UAVCAN update. See: https://github.com/vedderb/bldc/pull/269 === FW 5.02 === * IMU calibration improvement. diff --git a/conf_general.h b/conf_general.h index b42cb7988..2220a23d0 100644 --- a/conf_general.h +++ b/conf_general.h @@ -24,7 +24,7 @@ #define FW_VERSION_MAJOR 5 #define FW_VERSION_MINOR 03 // Set to 0 for building a release and iterate during beta test builds -#define FW_TEST_VERSION_NUMBER 14 +#define FW_TEST_VERSION_NUMBER 15 #include "datatypes.h" diff --git a/libcanard/canard_driver.c b/libcanard/canard_driver.c index af9a47ea9..775edffe4 100755 --- a/libcanard/canard_driver.c +++ b/libcanard/canard_driver.c @@ -496,6 +496,8 @@ static void handle_get_node_info(CanardInstance* ins, CanardRxTransfer* transfer * Handle ESC Raw command */ static void handle_esc_raw_command(CanardInstance* ins, CanardRxTransfer* transfer) { + (void)ins; + uavcan_equipment_esc_RawCommand cmd; uint8_t buffer[UAVCAN_EQUIPMENT_ESC_RAWCOMMAND_MAX_SIZE]; memset(buffer, 0, sizeof(buffer)); @@ -534,6 +536,8 @@ static void handle_esc_raw_command(CanardInstance* ins, CanardRxTransfer* transf * Handle ESC RPM command */ static void handle_esc_rpm_command(CanardInstance* ins, CanardRxTransfer* transfer) { + (void)ins; + uavcan_equipment_esc_RPMCommand cmd; uint8_t buffer[UAVCAN_EQUIPMENT_ESC_RPMCOMMAND_MAX_SIZE]; memset(buffer, 0, sizeof(buffer)); @@ -553,6 +557,8 @@ static void handle_esc_rpm_command(CanardInstance* ins, CanardRxTransfer* transf * this data can be used to respond to total system current consumption. */ static void handle_esc_status(CanardInstance* ins, CanardRxTransfer* transfer) { + (void)ins; + uavcan_equipment_esc_Status msg; if (uavcan_equipment_esc_Status_decode_internal(transfer, transfer->payload_len, &msg, 0, 0) >= 0) { for (int i = 0;i < STATUS_MSGS_TO_STORE;i++) { @@ -788,8 +794,9 @@ static void send_fw_read(void) * send_fw_read() above. the packet contains a 16 bit value at the begining called * error that needs to be removed before reading the file chunk */ -static void handle_file_read_response(CanardInstance* ins, CanardRxTransfer* transfer) -{ +static void handle_file_read_response(CanardInstance* ins, CanardRxTransfer* transfer) { + (void)ins; + if ((transfer->transfer_id+1)%256 != fw_update.transfer_id || transfer->source_node_id != fw_update.node_id) { return; @@ -818,6 +825,9 @@ static void handle_file_read_response(CanardInstance* ins, CanardRxTransfer* tra uint16_t flash_res = flash_helper_write_new_app_data(fw_update.ofs+6, buf, len); fw_update.ofs += len; + // TODO: Check result and abort on failure. + (void)flash_res; + // If the packet is incomplete that means that was the last packet (might be an issue if the last packet is exactly full) // however Ardupilot seems to be handling this same way, and no issues have been reported so far. if (len < UAVCAN_PROTOCOL_FILE_READ_RESPONSE_DATA_MAX_LENGTH) { @@ -1018,8 +1028,8 @@ static bool shouldAcceptTransfer(const CanardInstance* ins, uint64_t* out_data_type_signature, uint16_t data_type_id, CanardTransferType transfer_type, - uint8_t source_node_id) -{ + uint8_t source_node_id) { + (void)ins; (void)source_node_id; if (debug_level == 4) {