WIP can now switch between kPa and PSI

This commit is contained in:
jLynx 2022-03-24 17:05:38 +13:00
parent 0523aabe91
commit 2030118d9f

View File

@ -34,6 +34,8 @@ namespace tpms {
namespace format { namespace format {
static bool use_kpa = true;
std::string type(Reading::Type type) { std::string type(Reading::Type type) {
return to_string_dec_uint(toUType(type), 2); return to_string_dec_uint(toUType(type), 2);
} }
@ -43,7 +45,11 @@ std::string id(TransponderID id) {
} }
std::string pressure(Pressure pressure) { 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) { std::string temperature(Temperature temperature) {
@ -163,10 +169,10 @@ TPMSAppView::TPMSAppView(NavigationView&) {
options_type.on_change = [this](size_t, int32_t i) { options_type.on_change = [this](size_t, int32_t i) {
if (i == 0){ if (i == 0){
// field_frequency.set_value(144390000); tpms::format::use_kpa = true;
} }
if(i == 1){ if(i == 1){
// field_frequency.set_value(144800000); tpms::format::use_kpa = false;
} }
}; };