Skip to content

AP_Periph: Use battery SOC only when available#32105

Open
lgarciaos wants to merge 2 commits into
ArduPilot:masterfrom
lgarciaos:apperiph-soc-flag
Open

AP_Periph: Use battery SOC only when available#32105
lgarciaos wants to merge 2 commits into
ArduPilot:masterfrom
lgarciaos:apperiph-soc-flag

Conversation

@lgarciaos
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lgarciaos
Copy link
Copy Markdown
Contributor Author

Fixed typo

Comment thread libraries/AP_BattMonitor/AP_BattMonitor_DroneCAN.cpp
Comment on lines +129 to +130
_interim_state.state_of_charge_pct = msg.state_of_charge_pct;
_interim_state.has_state_of_charge_pct = true;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These don't seem to exist?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @IamPete1, I removed those lines and now I think it makes sense to me. SoC is already handled as it should.

Comment thread Tools/AP_Periph/battery.cpp Outdated
@peterbarker
Copy link
Copy Markdown
Contributor

@lgarciaos you have review comments to look at here.

Co-authored-by: Tom Pittenger <magicrub@users.noreply.github.com>
Comment on lines +65 to 66
pkt.state_of_charge_pct = battery_lib.capacity_remaining_pct(percentage, i) ? percentage : UAVCAN_EQUIPMENT_POWER_BATTERYINFO_STATE_OF_CHARGE_UNKNOWN;
uint8_t percentage = 0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pkt.state_of_charge_pct = battery_lib.capacity_remaining_pct(percentage, i) ? percentage : UAVCAN_EQUIPMENT_POWER_BATTERYINFO_STATE_OF_CHARGE_UNKNOWN;
uint8_t percentage = 0;
uint8_t percentage = UAVCAN_EQUIPMENT_POWER_BATTERYINFO_STATE_OF_CHARGE_UNKNOWN;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants