Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_BattMonitor: extend AP_BATT_MONITOR_MAX_INSTANCES to 16 #24660

Merged
merged 2 commits into from Aug 29, 2023

Conversation

magicrub
Copy link
Contributor

@magicrub magicrub commented Aug 16, 2023

AP_BattMonitor: extend AP_BATT_MONITOR_MAX_INSTANCES limit to 16 (default is still 9)

Doesn't hurt to bump the max up to 16, especially for vehicles with lots of power monitoring and AP_Periphs with sensors galore!

Note: if we ever consider pushing above 16 The limitation is param1 being treated as uint16 in handle_command_battery_reset()

MAV_RESULT GCS_MAVLINK::handle_command_battery_reset(const mavlink_command_long_t &packet) {
    const uint16_t battery_mask = packet.param1;
    const float percentage = packet.param2;
    if (AP::battery().reset_remaining_mask(battery_mask, percentage)) {

Since it's a command_long, the float could give us 24 bitmask bits as-is. The MAVLink docs don't mention any limit but since packet.param1 is a float we could change it to 32bit and do:

const uint32_t battery_mask = is_equal(packet.param1, -1.0) ? 0xFFFFFFFF : packet.param1;

which would allow a GCS to clear them all (including SITL autotest) without having to know how many there are and thus support up to 32 gracefully-ish.

In fact, I've also made PR #24661 on top of this branch that I made for the LOLs.

@magicrub
Copy link
Contributor Author

Regarding PR #24645 where I bumped up RPM's instance count from 2 to 9, it was argued that it shouldn't be that high "because no one is asking for it" and that was a fair argument because I was only in need of 4 (at least for now). For this battery PR, I'm asking for 16 because I have a need for 12 right now and will likely need 13-14 pretty soon and I anticipate 16 eventually.

@tridge tridge merged commit 4d05eda into ArduPilot:master Aug 29, 2023
81 checks passed
@magicrub magicrub deleted the pr/more_batteries branch August 29, 2023 01:43
@Hwurzburg Hwurzburg added the WikiNeeded needs wiki update label Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WikiNeeded needs wiki update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants