-
Notifications
You must be signed in to change notification settings - Fork 17.2k
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_OSD: add power and energy items #13804
AP_OSD: add power and energy items #13804
Conversation
6e2352c
to
8d71e53
Compare
8d71e53
to
3525e4a
Compare
76b5f6a
to
643c25e
Compare
Updated |
👍 |
Changed param descriptions as suggested |
a60193d
to
7ea449c
Compare
return total; | ||
} | ||
|
||
bool AP_BattMonitor::power_watts(float &power, uint8_t instance) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instance number first by convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By convention ? I just copied the signatures of AP_BattMonitor::consumed_mah
, AP_BattMonitor::current_amps
, ...
7ea449c
to
7573e3a
Compare
@@ -144,6 +144,10 @@ class AP_BattMonitor | |||
/// current_amps - returns the instantaneous current draw in amperes | |||
bool current_amps(float ¤t, const uint8_t instance = AP_BATT_PRIMARY_INSTANCE) const WARN_IF_UNUSED; | |||
|
|||
/// power watt | |||
float power_watts() const; | |||
bool power_watts(float &power, const uint8_t instance = AP_BATT_PRIMARY_INSTANCE) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No default to the primary instance, all the primary instance stuff in battery monitor is on the chopping block, so lets not extend it in the meantime.
I think it makes sense to have a OSD_BAT_IDX parameter for which battery index to use for all the battery based OSD elements |
@@ -428,6 +428,29 @@ void AP_BattMonitor::check_failsafes(void) | |||
} | |||
} | |||
|
|||
// returns the total power draw for all batteries | |||
float AP_BattMonitor::power_watts() const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
summing causes issues with some battery types (fuel systems, already summed batteries etc)
better to add a OSD_BAT_IDX param
I'd like to +1 this PR, measuring power/energy is much better than mAh and OSD items for them would be very useful. |
7573e3a
to
05d919e
Compare
05d919e
to
c647c3f
Compare
No description provided.