Skip to content

Commit

Permalink
Updated changelog and minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vedderb committed Mar 26, 2021
1 parent e39893c commit 9ad6042
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion conf_general.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
18 changes: 14 additions & 4 deletions libcanard/canard_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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));
Expand All @@ -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++) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 9ad6042

Please sign in to comment.