Skip to content

Commit

Permalink
AP_BattMonitor_logging: update to use capacity_remaining_pct() as a bool
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani committed Sep 2, 2021
1 parent 449dfca commit d7d0592
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libraries/AP_BattMonitor/AP_BattMonitor_Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ extern const AP_HAL::HAL& hal;
void AP_BattMonitor_Backend::Log_Write_BAT(const uint8_t instance, const uint64_t time_us) const
{
bool has_curr = has_current();
uint8_t percent = -1;
IGNORE_RETURN(capacity_remaining_pct(percent));

const struct log_BAT pkt{
LOG_PACKET_HEADER_INIT(LOG_BAT_MSG),
Expand All @@ -19,7 +21,7 @@ void AP_BattMonitor_Backend::Log_Write_BAT(const uint8_t instance, const uint64_
consumed_wh : has_curr ? _state.consumed_wh : AP::logger().quiet_nanf(),
temperature : (int16_t) ( has_temperature() ? _state.temperature * 100 : 0),
resistance : _state.resistance,
rem_percent : capacity_remaining_pct(),
rem_percent : percent,
};
AP::logger().WriteBlock(&pkt, sizeof(pkt));
}
Expand Down

0 comments on commit d7d0592

Please sign in to comment.