From 2030118d9fb18cccaa967a029713e6a98de62aad Mon Sep 17 00:00:00 2001 From: jLynx Date: Thu, 24 Mar 2022 17:05:38 +1300 Subject: [PATCH] WIP can now switch between kPa and PSI --- firmware/application/apps/tpms_app.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/firmware/application/apps/tpms_app.cpp b/firmware/application/apps/tpms_app.cpp index 62c04c8f3..4d55bec01 100644 --- a/firmware/application/apps/tpms_app.cpp +++ b/firmware/application/apps/tpms_app.cpp @@ -34,6 +34,8 @@ namespace tpms { namespace format { +static bool use_kpa = true; + std::string type(Reading::Type type) { return to_string_dec_uint(toUType(type), 2); } @@ -43,7 +45,11 @@ std::string id(TransponderID id) { } std::string pressure(Pressure pressure) { - return to_string_dec_int(pressure.kilopascal(), 3); + if(use_kpa){ + return to_string_dec_int(pressure.kilopascal(), 3); + } + return to_string_dec_int(pressure.psi(), 3); + } std::string temperature(Temperature temperature) { @@ -163,10 +169,10 @@ TPMSAppView::TPMSAppView(NavigationView&) { options_type.on_change = [this](size_t, int32_t i) { if (i == 0){ - // field_frequency.set_value(144390000); + tpms::format::use_kpa = true; } if(i == 1){ - // field_frequency.set_value(144800000); + tpms::format::use_kpa = false; } };