diff options
| author | Michele Bini <michele.bini@gmail.com> | 2022-03-28 00:52:13 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2022-03-28 00:52:13 (GMT) |
| commit | b5517a61803bb3c328cf4fc87d834657be40ba07 (patch) | |
| tree | 5f134b5c97f3b4a1800f527fc60901947851f8be | |
| parent | e1fa843d772892b2c63bab902efb14a42ba37a2d (diff) | |
Improve temperature display
| -rw-r--r-- | src/displayapp/fonts/neofont.c | 14 | ||||
| -rw-r--r-- | src/displayapp/screens/WatchFaceDigital.cpp | 24 |
2 files changed, 28 insertions, 10 deletions
diff --git a/src/displayapp/fonts/neofont.c b/src/displayapp/fonts/neofont.c index 6c41b67..163e7e0 100644 --- a/src/displayapp/fonts/neofont.c +++ b/src/displayapp/fonts/neofont.c @@ -304,6 +304,12 @@ static uint8_t glyphs[][2] = { X, X, X, _, X, _ ), + G( _, X, _, + X, _, X, + _, X, _, + _, _, _, + _, _, _ ), + }; #undef X @@ -357,7 +363,13 @@ static const uint8_t * neofont0_glyph_bitmap_cb(const lv_font_t * font, uint32_t return glyphs[36+(x-symbols)]; } } - return glyphs[sizeof(glyphs)/sizeof(glyphs[0])-1]; + + switch (unicode_letter) { + case 0xB0: + return glyphs[sizeof(glyphs)/sizeof(glyphs[0])-1]; + } + + return glyphs[sizeof(glyphs)/sizeof(glyphs[0])-2]; } lv_font_t neofont0 = { diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 8178d22..8176c7b 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -59,10 +59,10 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app, lv_obj_set_style_local_text_font(label_date, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2); label_temp = lv_label_create(lv_scr_act(), nullptr); - lv_obj_align(label_temp, lv_scr_act(), LV_ALIGN_CENTER, 0, -60); - lv_obj_set_style_local_text_color( label_temp, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999)); + lv_obj_set_style_local_text_color( label_temp, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x222222)); lv_obj_set_style_local_text_font( label_temp, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont15); - lv_label_set_text_fmt(label_temp, "T? [?,?]"); + lv_label_set_text_fmt(label_temp, "??°C"); + lv_obj_align(label_temp, lv_scr_act(), LV_ALIGN_CENTER, 60, -60); label_time = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont3); @@ -120,12 +120,18 @@ void WatchFaceDigital::Refresh() { } #ifndef INFINISIM - systemTask.motionSensor.RefreshTemperature(); - lv_label_set_text_fmt(label_temp, "T%d [%d,%d]", - ((int)(systemTask.motionSensor.temperature_last_read_value+23)), - ((int)(systemTask.motionSensor.temperature_last_result)), - ((int)(systemTask.motionSensor.temperature_read_counter)) - ); + temperature = systemTask.motionSensor.getTemperature(); + if (temperature.IsUpdated()) { + lv_obj_set_style_local_text_color( label_temp, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999)); + lv_label_set_text_fmt(label_temp, "%d°C"); +#if 0 + lv_label_set_text_fmt(label_temp, "T%d [%d,%d]", + ((int)(systemTask.motionSensor.temperature_last_read_value+23)), + ((int)(systemTask.motionSensor.temperature_last_result)), + ((int)(systemTask.motionSensor.temperature_read_counter)) + ); +#endif + } #endif currentDateTime = dateTimeController.CurrentDateTime(); |
