Enhance TPMS app to support Fahrenheit temperature

Modified TPMS app to allow switching between Celsius & Fahrenheit temperatures, which also simplified some of the code by sticking with a constant heading row
This commit is contained in:
Mark Thompson 2023-04-05 14:16:44 -05:00 committed by GitHub
parent 049a20b878
commit 40d64030c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -144,7 +144,7 @@ private:
}
};
OptionsField options_type {
OptionsField options_pressure {
{ 5 * 8, 0 * 16 },
3,
{
@ -153,6 +153,15 @@ private:
}
};
OptionsField options_temperature {
{ 9 * 8, 0 * 16 },
1,
{
{ "C", 0 },
{ "F", 1 }
}
};
RFAmpField field_rf_amp {
{ 13 * 8, 0 * 16 }
};
@ -168,31 +177,21 @@ private:
TPMSRecentEntries recent { };
std::unique_ptr<TPMSLogger> logger { };
const RecentEntriesColumns columns_kpa { {
const RecentEntriesColumns columns { {
{ "Tp", 2 },
{ "ID", 8 },
{ "kPa", 3 },
{ "C", 3 },
{ "Pres", 4 },
{ "Temp", 4 },
{ "Cnt", 3 },
{ "Fl", 2 },
} };
TPMSRecentEntriesView recent_entries_view_kpa { columns_kpa, recent };
const RecentEntriesColumns columns_psi { {
{ "Tp", 2 },
{ "ID", 8 },
{ "PSI", 3 },
{ "C", 3 },
{ "Cnt", 3 },
{ "Fl", 2 },
} };
TPMSRecentEntriesView recent_entries_view_psi { columns_psi, recent };
TPMSRecentEntriesView recent_entries_view { columns, recent };
uint32_t target_frequency_ = initial_target_frequency;
void on_packet(const tpms::Packet& packet);
void on_show_list();
void update_type();
void update_view();
void on_band_changed(const uint32_t new_band_frequency);