support for battery if any + TPMS app to ext (#2129)

* batt initial
* batt widgets
* settings modify
* batt info screen
* ability to hide icon
* battView
* redo tmps
* hide curr + charge if no data
* fix flashing
This commit is contained in:
Totoo 2024-04-29 17:38:27 +02:00 committed by GitHub
parent f572b00391
commit f6a2d21624
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 767 additions and 44 deletions

View file

@ -42,7 +42,7 @@ DfuMenu::DfuMenu(NavigationView& nav)
&text_info_line_9,
&text_info_line_10});
if (portapack::battery_ads1110.isDetected()) {
if (battery::BatteryManagement::isDetected()) {
add_child(&voltage_label);
add_child(&text_info_line_11);
}
@ -53,7 +53,7 @@ void DfuMenu::paint(Painter& painter) {
size_t m0_fragmented_free_space = 0;
const auto m0_fragments = chHeapStatus(NULL, &m0_fragmented_free_space);
auto lines = (portapack::battery_ads1110.isDetected() ? 11 : 10) + 2;
auto lines = (battery::BatteryManagement::isDetected() ? 11 : 10) + 2;
text_info_line_1.set(to_string_dec_uint(chCoreStatus(), 6));
text_info_line_2.set(to_string_dec_uint(m0_fragmented_free_space, 6));
@ -65,8 +65,8 @@ void DfuMenu::paint(Painter& painter) {
text_info_line_8.set(to_string_dec_uint(shared_memory.m4_performance_counter, 6));
text_info_line_9.set(to_string_dec_uint(shared_memory.m4_buffer_missed, 6));
text_info_line_10.set(to_string_dec_uint(chTimeNow() / 1000, 6));
if (portapack::battery_ads1110.isDetected()) {
text_info_line_11.set(to_string_decimal_padding(portapack::battery_ads1110.readVoltage(), 3, 6));
if (battery::BatteryManagement::isDetected()) {
text_info_line_11.set(to_string_decimal_padding((float)battery::BatteryManagement::getVoltage() / 1000.0, 3, 6));
}
constexpr auto margin = 5;