diff --git a/libraries/AP_BLHeli/AP_BLHeli.cpp b/libraries/AP_BLHeli/AP_BLHeli.cpp index 6d944f221bef8..0e7c792701e08 100644 --- a/libraries/AP_BLHeli/AP_BLHeli.cpp +++ b/libraries/AP_BLHeli/AP_BLHeli.cpp @@ -1472,10 +1472,12 @@ void AP_BLHeli::read_telemetry_packet(void) update_rpm(normalized_motor_idx, new_rpm); TelemetryData t { - .temperature_cdeg = int16_t(buf[0] * 100), .voltage = float(uint16_t((buf[1]<<8) | buf[2])) * 0.01, .current = float(uint16_t((buf[3]<<8) | buf[4])) * 0.01, .consumption_mah = float(uint16_t((buf[5]<<8) | buf[6])), + .usage_s = 0, + .last_update_ms = 0, + .temperature_cdeg = int16_t(buf[0] * 100), }; update_telem_data(normalized_motor_idx, t, diff --git a/libraries/AP_DroneCAN/AP_DroneCAN.cpp b/libraries/AP_DroneCAN/AP_DroneCAN.cpp index b72899bf72cae..61c9eea89a7cd 100644 --- a/libraries/AP_DroneCAN/AP_DroneCAN.cpp +++ b/libraries/AP_DroneCAN/AP_DroneCAN.cpp @@ -629,9 +629,12 @@ void AP_DroneCAN::handle_hobbywing_StatusMsg2(const CanardRxTransfer& transfer, uint8_t esc_index; if (hobbywing_find_esc_index(transfer.source_node_id, esc_index)) { TelemetryData t { - .temperature_cdeg = int16_t(msg.temperature*100), .voltage = msg.input_voltage*0.1f, .current = msg.current*0.1f, + .consumption_mah = 0.0f, + .usage_s = 0, + .last_update_ms = 0, + .temperature_cdeg = int16_t(msg.temperature*100), }; update_telem_data(esc_index, t, AP_ESC_Telem_Backend::TelemetryType::CURRENT| @@ -1430,9 +1433,12 @@ void AP_DroneCAN::handle_ESC_status(const CanardRxTransfer& transfer, const uavc } TelemetryData t { - .temperature_cdeg = int16_t((KELVIN_TO_C(msg.temperature)) * 100), .voltage = msg.voltage, .current = msg.current, + .consumption_mah = 0.0f, + .usage_s = 0, + .last_update_ms = 0, + .temperature_cdeg = int16_t((KELVIN_TO_C(msg.temperature)) * 100), }; update_rpm(esc_index, msg.rpm, msg.error_count); diff --git a/libraries/AP_ESC_Telem/AP_ESC_Telem_Backend.h b/libraries/AP_ESC_Telem/AP_ESC_Telem_Backend.h index b6d6725a55fa1..105e091c2e4a4 100644 --- a/libraries/AP_ESC_Telem/AP_ESC_Telem_Backend.h +++ b/libraries/AP_ESC_Telem/AP_ESC_Telem_Backend.h @@ -10,13 +10,13 @@ class AP_ESC_Telem_Backend { public: struct TelemetryData { - int16_t temperature_cdeg; // centi-degrees C, negative values allowed float voltage; // Volt float current; // Ampere float consumption_mah; // milli-Ampere.hours uint32_t usage_s; // usage seconds - int16_t motor_temp_cdeg; // centi-degrees C, negative values allowed uint32_t last_update_ms; // last update time in milliseconds, determines whether active + int16_t temperature_cdeg; // centi-degrees C, negative values allowed + int16_t motor_temp_cdeg; // centi-degrees C, negative values allowed uint16_t types; // telemetry types present uint16_t count; // number of times updated diff --git a/libraries/AP_ESC_Telem/AP_ESC_Telem_SITL.cpp b/libraries/AP_ESC_Telem/AP_ESC_Telem_SITL.cpp index 25f84fb285c69..506f75873fb2d 100644 --- a/libraries/AP_ESC_Telem/AP_ESC_Telem_SITL.cpp +++ b/libraries/AP_ESC_Telem/AP_ESC_Telem_SITL.cpp @@ -67,10 +67,12 @@ void AP_ESC_Telem_SITL::update() // some fake values so that is_telemetry_active() returns true TelemetryData t { - .temperature_cdeg = 3200, .voltage = 16.8f, .current = 0.8f, .consumption_mah = 1.0f, + .usage_s = 0, + .last_update_ms = 0, + .temperature_cdeg = 3200, }; update_telem_data(motor, t, diff --git a/libraries/AP_KDECAN/AP_KDECAN.cpp b/libraries/AP_KDECAN/AP_KDECAN.cpp index db0afdf4aba7e..1eafc0c103101 100644 --- a/libraries/AP_KDECAN/AP_KDECAN.cpp +++ b/libraries/AP_KDECAN/AP_KDECAN.cpp @@ -134,9 +134,12 @@ void AP_KDECAN_Driver::handle_frame(AP_HAL::CANFrame &frame) update_rpm(idx, uint16_t(uint16_t(frame.data[4] << 8 | frame.data[5]) * 60UL * 2 / num_poles)); const TelemetryData t { - .temperature_cdeg = int16_t(frame.data[6] * 100), .voltage = float(uint16_t(frame.data[0] << 8 | frame.data[1])) * 0.01f, .current = float(uint16_t(frame.data[2] << 8 | frame.data[3])) * 0.01f, + .consumption_mah = 0.0f, + .usage_s = 0, + .last_update_ms = 0, + .temperature_cdeg = int16_t(frame.data[6] * 100), }; update_telem_data(idx, t, AP_ESC_Telem_Backend::TelemetryType::CURRENT |