mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-08-20 14:39:01 +00:00
feat: add BAR unit support to TPMS RX app (#2988)
- Add bar() conversion method to Pressure class - Convert pressure units system from boolean to enum (kPa, PSI, BAR) - Add BAR option to pressure unit selector in UI - Update settings manager to persist pressure unit preference - Use ternary operators for compact pressure formatting
This commit is contained in:
+6
-3
@@ -47,7 +47,10 @@ std::string id(tpms::TransponderID id) {
|
||||
}
|
||||
|
||||
std::string pressure(Pressure pressure) {
|
||||
return to_string_dec_int(units_psi ? pressure.psi() : pressure.kilopascal(), 3);
|
||||
return to_string_dec_int(
|
||||
format::units_pressure == format::PressureUnit::PSI ? pressure.psi() : format::units_pressure == format::PressureUnit::BAR ? pressure.bar()
|
||||
: pressure.kilopascal(),
|
||||
3);
|
||||
}
|
||||
|
||||
std::string temperature(Temperature temperature) {
|
||||
@@ -122,10 +125,10 @@ TPMSAppView::TPMSAppView(NavigationView&) {
|
||||
options_band.set_by_value(receiver_model.target_frequency());
|
||||
|
||||
options_pressure.on_change = [this](size_t, int32_t i) {
|
||||
format::units_psi = (bool)i;
|
||||
format::units_pressure = static_cast<format::PressureUnit>(i);
|
||||
update_view();
|
||||
};
|
||||
options_pressure.set_selected_index(format::units_psi, true);
|
||||
options_pressure.set_selected_index(static_cast<int>(format::units_pressure), true);
|
||||
|
||||
options_temperature.on_change = [this](size_t, int32_t i) {
|
||||
format::units_fahr = (bool)i;
|
||||
|
||||
Reference in New Issue
Block a user