Skip to content

Commit

Permalink
AP_DroneCAN: ESCStatus read error_count
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlong13 committed Oct 21, 2024
1 parent db27670 commit 834541b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libraries/AP_DroneCAN/AP_DroneCAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1428,16 +1428,18 @@ void AP_DroneCAN::handle_ESC_status(const CanardRxTransfer& transfer, const uavc
.temperature_cdeg = int16_t((KELVIN_TO_C(msg.temperature)) * 100),
.voltage = msg.voltage,
.current = msg.current,
.error_count = msg.error_count,
#if AP_EXTENDED_ESC_TELEM_ENABLED
.power_percentage = msg.power_rating_pct,
#endif
};

update_rpm(esc_index, msg.rpm, msg.error_count);
update_rpm(esc_index, msg.rpm, 0);
update_telem_data(esc_index, t,
(isnan(msg.current) ? 0 : AP_ESC_Telem_Backend::TelemetryType::CURRENT)
| (isnan(msg.voltage) ? 0 : AP_ESC_Telem_Backend::TelemetryType::VOLTAGE)
| (isnan(msg.temperature) ? 0 : AP_ESC_Telem_Backend::TelemetryType::TEMPERATURE)
| AP_ESC_Telem_Backend::TelemetryType::ERROR_COUNT
#if AP_EXTENDED_ESC_TELEM_ENABLED
| AP_ESC_Telem_Backend::TelemetryType::POWER_PERCENTAGE
#endif
Expand Down

0 comments on commit 834541b

Please sign in to comment.