Display degree symbol in TPMS, Sonde, and Temperature apps; disabled Font Viewer (#1388)

* Display degrees symbol; disable Font Viewer app to save ROM space
This commit is contained in:
Mark Thompson 2023-08-20 04:14:22 -05:00 committed by GitHub
parent a4325ac20d
commit c6424f1623
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 7 deletions

View File

@ -146,9 +146,9 @@ class TPMSAppView : public View {
OptionsField options_temperature{ OptionsField options_temperature{
{9 * 8, 0 * 16}, {9 * 8, 0 * 16},
1, 2,
{{"C", 0}, {{STR_DEGREES_C, 0},
{"F", 1}}}; {STR_DEGREES_F, 1}}};
RFAmpField field_rf_amp{ RFAmpField field_rf_amp{
{13 * 8, 0 * 16}}; {13 * 8, 0 * 16}};

View File

@ -127,7 +127,7 @@ TemperatureWidget::temperature_t TemperatureWidget::temperature(const sample_t s
} }
std::string TemperatureWidget::temperature_str(const temperature_t temperature) const { 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( Coord TemperatureWidget::screen_y(
@ -406,7 +406,7 @@ DebugMenuView::DebugMenuView(NavigationView& nav) {
{"Touch Test", ui::Color::dark_cyan(), &bitmap_icon_notepad, [&nav]() { nav.push<DebugScreenTest>(); }}, {"Touch Test", ui::Color::dark_cyan(), &bitmap_icon_notepad, [&nav]() { nav.push<DebugScreenTest>(); }},
{"P.Memory", ui::Color::dark_cyan(), &bitmap_icon_memory, [&nav]() { nav.push<DebugPmemView>(); }}, {"P.Memory", ui::Color::dark_cyan(), &bitmap_icon_memory, [&nav]() { nav.push<DebugPmemView>(); }},
{"Debug Dump", ui::Color::dark_cyan(), &bitmap_icon_memory, [&nav]() { portapack::persistent_memory::debug_dump(); }}, {"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<DebugFontsView>(); }}, //{"Fonts Viewer", ui::Color::dark_cyan(), &bitmap_icon_notepad, [&nav]() { nav.push<DebugFontsView>(); }}, // temporarily disabled to conserve ROM space
}); });
set_max_rows(2); // allow wider buttons set_max_rows(2); // allow wider buttons
} }

View File

@ -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_min = -10; // Accomodate negative values, present in cold startup cases
static constexpr temperature_t display_temp_scale = 3; static constexpr temperature_t display_temp_scale = 3;
static constexpr int bar_width = 1; 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 { class TemperatureView : public View {

View File

@ -194,7 +194,7 @@ void SondeView::on_packet(const sonde::Packet& packet) {
if (temp_humid_info.temp != 0) { if (temp_humid_info.temp != 0) {
double decimals = abs(get_decimals(temp_humid_info.temp, 10, true)); 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(); gps_info = packet.get_GPS_data();

View File

@ -24,6 +24,9 @@
#include <cstdint> #include <cstdint>
#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 { namespace units {
class Pressure { class Pressure {