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_OSD: add power and energy items #13804

Conversation

shellixyz
Copy link
Contributor

No description provided.

@shellixyz shellixyz force-pushed the features/add_power_and_energy_osd_items_master branch 3 times, most recently from 6e2352c to 8d71e53 Compare March 16, 2020 01:26
@khancyr khancyr added Library OSD On screen display labels Mar 16, 2020
@shellixyz shellixyz force-pushed the features/add_power_and_energy_osd_items_master branch from 8d71e53 to 3525e4a Compare March 18, 2020 19:21
@shellixyz shellixyz force-pushed the features/add_power_and_energy_osd_items_master branch 2 times, most recently from 76b5f6a to 643c25e Compare May 6, 2020 21:33
@shellixyz
Copy link
Contributor Author

Updated

@kiryam
Copy link

kiryam commented May 19, 2020

👍

libraries/AP_OSD/AP_OSD_Screen.cpp Outdated Show resolved Hide resolved
libraries/AP_OSD/AP_OSD_Screen.cpp Outdated Show resolved Hide resolved
@shellixyz
Copy link
Contributor Author

Changed param descriptions as suggested

@shellixyz shellixyz force-pushed the features/add_power_and_energy_osd_items_master branch from a60193d to 7ea449c Compare September 14, 2020 08:51
return total;
}

bool AP_BattMonitor::power_watts(float &power, uint8_t instance) const
Copy link
Contributor

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.

Copy link
Contributor Author

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, ...

libraries/AP_BattMonitor/AP_BattMonitor.cpp Outdated Show resolved Hide resolved
@shellixyz shellixyz force-pushed the features/add_power_and_energy_osd_items_master branch from 7ea449c to 7573e3a Compare September 14, 2020 12:10
@@ -144,6 +144,10 @@ class AP_BattMonitor
/// current_amps - returns the instantaneous current draw in amperes
bool current_amps(float &current, 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;
Copy link
Contributor

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.

@tridge
Copy link
Contributor

tridge commented Sep 15, 2020

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
Copy link
Contributor

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

@skorokithakis
Copy link
Contributor

I'd like to +1 this PR, measuring power/energy is much better than mAh and OSD items for them would be very useful.

@shellixyz shellixyz force-pushed the features/add_power_and_energy_osd_items_master branch from 7573e3a to 05d919e Compare March 6, 2021 18:23
@shellixyz shellixyz force-pushed the features/add_power_and_energy_osd_items_master branch from 05d919e to c647c3f Compare March 14, 2021 19:55
@shellixyz shellixyz closed this Jul 5, 2021
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Library OSD On screen display
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants