From c6424f1623a6c8c456101750597e6180b95e9877 Mon Sep 17 00:00:00 2001 From: Mark Thompson <129641948+NotherNgineer@users.noreply.github.com> Date: Sun, 20 Aug 2023 04:14:22 -0500 Subject: [PATCH] Display degree symbol in TPMS, Sonde, and Temperature apps; disabled Font Viewer (#1388) * Display degrees symbol; disable Font Viewer app to save ROM space --- firmware/application/apps/tpms_app.hpp | 6 +++--- firmware/application/apps/ui_debug.cpp | 4 ++-- firmware/application/apps/ui_debug.hpp | 2 +- firmware/application/apps/ui_sonde.cpp | 2 +- firmware/common/units.hpp | 3 +++ 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/firmware/application/apps/tpms_app.hpp b/firmware/application/apps/tpms_app.hpp index f2e72aa26..788a4add3 100644 --- a/firmware/application/apps/tpms_app.hpp +++ b/firmware/application/apps/tpms_app.hpp @@ -146,9 +146,9 @@ class TPMSAppView : public View { OptionsField options_temperature{ {9 * 8, 0 * 16}, - 1, - {{"C", 0}, - {"F", 1}}}; + 2, + {{STR_DEGREES_C, 0}, + {STR_DEGREES_F, 1}}}; RFAmpField field_rf_amp{ {13 * 8, 0 * 16}}; diff --git a/firmware/application/apps/ui_debug.cpp b/firmware/application/apps/ui_debug.cpp index 835356547..8be144025 100644 --- a/firmware/application/apps/ui_debug.cpp +++ b/firmware/application/apps/ui_debug.cpp @@ -127,7 +127,7 @@ TemperatureWidget::temperature_t TemperatureWidget::temperature(const sample_t s } std::string TemperatureWidget::temperature_str(const temperature_t temperature) const { - return to_string_dec_int(temperature, temp_len - 1) + "C"; + return to_string_dec_int(temperature, temp_len - 2) + STR_DEGREES_C; } Coord TemperatureWidget::screen_y( @@ -406,7 +406,7 @@ DebugMenuView::DebugMenuView(NavigationView& nav) { {"Touch Test", ui::Color::dark_cyan(), &bitmap_icon_notepad, [&nav]() { nav.push(); }}, {"P.Memory", ui::Color::dark_cyan(), &bitmap_icon_memory, [&nav]() { nav.push(); }}, {"Debug Dump", ui::Color::dark_cyan(), &bitmap_icon_memory, [&nav]() { portapack::persistent_memory::debug_dump(); }}, - {"Fonts Viewer", ui::Color::dark_cyan(), &bitmap_icon_notepad, [&nav]() { nav.push(); }}, + //{"Fonts Viewer", ui::Color::dark_cyan(), &bitmap_icon_notepad, [&nav]() { nav.push(); }}, // temporarily disabled to conserve ROM space }); set_max_rows(2); // allow wider buttons } diff --git a/firmware/application/apps/ui_debug.hpp b/firmware/application/apps/ui_debug.hpp index 00efe62a4..ed2b909a3 100644 --- a/firmware/application/apps/ui_debug.hpp +++ b/firmware/application/apps/ui_debug.hpp @@ -105,7 +105,7 @@ class TemperatureWidget : public Widget { static constexpr temperature_t display_temp_min = -10; // Accomodate negative values, present in cold startup cases static constexpr temperature_t display_temp_scale = 3; static constexpr int bar_width = 1; - static constexpr int temp_len = 4; // Now scale shows up to 4 chars ("-10C") + static constexpr int temp_len = 5; // Now scale shows up to 5 chars ("-10ºC") }; class TemperatureView : public View { diff --git a/firmware/application/apps/ui_sonde.cpp b/firmware/application/apps/ui_sonde.cpp index 66be44a7e..3ce5fffa1 100644 --- a/firmware/application/apps/ui_sonde.cpp +++ b/firmware/application/apps/ui_sonde.cpp @@ -194,7 +194,7 @@ void SondeView::on_packet(const sonde::Packet& packet) { if (temp_humid_info.temp != 0) { double decimals = abs(get_decimals(temp_humid_info.temp, 10, true)); - text_temp.set(to_string_dec_int((int)temp_humid_info.temp) + "." + to_string_dec_uint(decimals, 1) + "C"); + text_temp.set(to_string_dec_int((int)temp_humid_info.temp) + "." + to_string_dec_uint(decimals, 1) + STR_DEGREES_C); } gps_info = packet.get_GPS_data(); diff --git a/firmware/common/units.hpp b/firmware/common/units.hpp index c819b7d8b..f15e985fd 100644 --- a/firmware/common/units.hpp +++ b/firmware/common/units.hpp @@ -24,6 +24,9 @@ #include +#define STR_DEGREES_C "\xB0\x43" // ºC - 0xB0 is degree ° symbol in our 8x16 font, 0x43 is "C" +#define STR_DEGREES_F "\xB0\x46" // ºF - 0xB0 is degree ° symbol in our 8x16 font, 0x46 is "F" + namespace units { class Pressure {