From 81607487335c8e90197f64af119d6d4ed50af6b6 Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Wed, 20 Apr 2022 12:21:35 +0300 Subject: [PATCH] Force full screen refresh with a rounder function When the screen switches, the full screen needs to be refreshed for the hardware scrolling to work. This was enforced with backgroundLabels, but is simpler to do with a rounder function. --- src/displayapp/LittleVgl.cpp | 16 +++++++++++++--- src/displayapp/LittleVgl.h | 11 +++++++++-- src/displayapp/screens/BatteryInfo.cpp | 6 ------ src/displayapp/screens/FirmwareUpdate.cpp | 6 ------ src/displayapp/screens/List.cpp | 6 ------ src/displayapp/screens/Notifications.cpp | 6 ------ src/displayapp/screens/PassKey.cpp | 7 ------- src/displayapp/screens/PassKey.h | 1 - src/displayapp/screens/Steps.cpp | 6 ------ src/displayapp/screens/Tile.cpp | 6 ------ src/displayapp/screens/Timer.cpp | 6 ------ src/displayapp/screens/Timer.h | 1 - src/displayapp/screens/Twos.cpp | 6 ------ src/displayapp/screens/WatchFaceDigital.cpp | 7 ------- src/displayapp/screens/WatchFaceDigital.h | 1 - .../screens/WatchFacePineTimeStyle.cpp | 7 ------- src/displayapp/screens/WatchFacePineTimeStyle.h | 1 - src/displayapp/screens/WatchFaceTerminal.cpp | 7 ------- src/displayapp/screens/WatchFaceTerminal.h | 1 - .../screens/settings/QuickSettings.cpp | 6 ------ 20 files changed, 22 insertions(+), 92 deletions(-) diff --git a/src/displayapp/LittleVgl.cpp b/src/displayapp/LittleVgl.cpp index e7b58c16..25f35917 100644 --- a/src/displayapp/LittleVgl.cpp +++ b/src/displayapp/LittleVgl.cpp @@ -16,14 +16,22 @@ static void disp_flush(lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_ lvgl->FlushDisplay(area, color_p); } +static void rounder(lv_disp_drv_t* disp_drv, lv_area_t* area) { + auto* lvgl = static_cast(disp_drv->user_data); + if (lvgl->GetFullRefresh()) { + area->x1 = 0; + area->x2 = LV_HOR_RES - 1; + area->y1 = 0; + area->y2 = LV_VER_RES - 1; + } +} + bool touchpad_read(lv_indev_drv_t* indev_drv, lv_indev_data_t* data) { auto* lvgl = static_cast(indev_drv->user_data); return lvgl->GetTouchPadInfo(data); } -LittleVgl::LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel) - : lcd {lcd}, touchPanel {touchPanel}, previousClick {0, 0} { - +LittleVgl::LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel) : lcd {lcd}, touchPanel {touchPanel} { } void LittleVgl::Init() { @@ -48,6 +56,7 @@ void LittleVgl::InitDisplay() { /*Set a display buffer*/ disp_drv.buffer = &disp_buf_2; disp_drv.user_data = this; + disp_drv.rounder_cb = rounder; /*Finally register the driver*/ lv_disp_drv_register(&disp_drv); @@ -78,6 +87,7 @@ void LittleVgl::SetFullRefresh(FullRefreshDirections direction) { lv_disp_set_direction(lv_disp_get_default(), 4); } } + fullRefresh = true; } void LittleVgl::FlushDisplay(const lv_area_t* area, lv_color_t* color_p) { diff --git a/src/displayapp/LittleVgl.h b/src/displayapp/LittleVgl.h index 1f8a3d79..45826165 100644 --- a/src/displayapp/LittleVgl.h +++ b/src/displayapp/LittleVgl.h @@ -26,6 +26,14 @@ namespace Pinetime { void SetFullRefresh(FullRefreshDirections direction); void SetNewTouchPoint(uint16_t x, uint16_t y, bool contact); + bool GetFullRefresh() { + bool returnValue = fullRefresh; + if (fullRefresh) { + fullRefresh = false; + } + return returnValue; + } + private: void InitDisplay(); void InitTouchpad(); @@ -39,9 +47,8 @@ namespace Pinetime { lv_color_t buf2_2[LV_HOR_RES_MAX * 4]; lv_disp_drv_t disp_drv; - lv_point_t previousClick; - bool firstTouch = true; + bool fullRefresh = false; static constexpr uint8_t nbWriteLines = 4; static constexpr uint16_t totalNbLines = 320; static constexpr uint16_t visibleNbLines = 240; diff --git a/src/displayapp/screens/BatteryInfo.cpp b/src/displayapp/screens/BatteryInfo.cpp index 2d9154fc..d9d479f8 100644 --- a/src/displayapp/screens/BatteryInfo.cpp +++ b/src/displayapp/screens/BatteryInfo.cpp @@ -38,12 +38,6 @@ BatteryInfo::BatteryInfo(Pinetime::Applications::DisplayApp* app, Pinetime::Cont lv_label_set_align(voltage, LV_LABEL_ALIGN_CENTER); lv_obj_align(voltage, nullptr, LV_ALIGN_CENTER, 0, 95); - lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); - lv_obj_set_size(backgroundLabel, 240, 240); - lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text_static(backgroundLabel, ""); - taskRefresh = lv_task_create(RefreshTaskCallback, 5000, LV_TASK_PRIO_MID, this); Refresh(); } diff --git a/src/displayapp/screens/FirmwareUpdate.cpp b/src/displayapp/screens/FirmwareUpdate.cpp index 0e043097..01530e1c 100644 --- a/src/displayapp/screens/FirmwareUpdate.cpp +++ b/src/displayapp/screens/FirmwareUpdate.cpp @@ -8,12 +8,6 @@ using namespace Pinetime::Applications::Screens; FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Ble& bleController) : Screen(app), bleController {bleController} { - lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); - lv_obj_set_size(backgroundLabel, 240, 240); - lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text_static(backgroundLabel, ""); - titleLabel = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text_static(titleLabel, "Firmware update"); lv_obj_align(titleLabel, nullptr, LV_ALIGN_IN_TOP_MID, 0, 50); diff --git a/src/displayapp/screens/List.cpp b/src/displayapp/screens/List.cpp index 9e21a8b9..0bc7da80 100644 --- a/src/displayapp/screens/List.cpp +++ b/src/displayapp/screens/List.cpp @@ -85,12 +85,6 @@ List::List(uint8_t screenID, lv_label_set_text_fmt(labelBt, " %s", applications[i].name); } } - - lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); - lv_obj_set_size(backgroundLabel, LV_HOR_RES, LV_VER_RES); - lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text_static(backgroundLabel, ""); } List::~List() { diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 21843083..8bba8ce6 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -265,12 +265,6 @@ Notifications::NotificationItem::NotificationItem(const char* title, lv_obj_set_style_local_bg_color(bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0)); } break; } - - lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); - lv_obj_set_size(backgroundLabel, 240, 240); - lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text_static(backgroundLabel, ""); } void Notifications::NotificationItem::OnCallButtonEvent(lv_obj_t* obj, lv_event_t event) { diff --git a/src/displayapp/screens/PassKey.cpp b/src/displayapp/screens/PassKey.cpp index e9715cd6..13cdcc25 100644 --- a/src/displayapp/screens/PassKey.cpp +++ b/src/displayapp/screens/PassKey.cpp @@ -9,13 +9,6 @@ PassKey::PassKey(Pinetime::Applications::DisplayApp* app, uint32_t key) : Screen lv_obj_set_style_local_text_font(passkeyLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); lv_label_set_text_fmt(passkeyLabel, "%06u", key); lv_obj_align(passkeyLabel, nullptr, LV_ALIGN_CENTER, 0, -20); - - backgroundLabel = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_click(backgroundLabel, true); - lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); - lv_obj_set_size(backgroundLabel, 240, 240); - lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text_static(backgroundLabel, ""); } PassKey::~PassKey() { diff --git a/src/displayapp/screens/PassKey.h b/src/displayapp/screens/PassKey.h index 16e72a3c..82735b56 100644 --- a/src/displayapp/screens/PassKey.h +++ b/src/displayapp/screens/PassKey.h @@ -14,7 +14,6 @@ namespace Pinetime { private: lv_obj_t* passkeyLabel; - lv_obj_t* backgroundLabel; }; } } diff --git a/src/displayapp/screens/Steps.cpp b/src/displayapp/screens/Steps.cpp index 8b5d3e48..0dcdcf59 100644 --- a/src/displayapp/screens/Steps.cpp +++ b/src/displayapp/screens/Steps.cpp @@ -48,12 +48,6 @@ Steps::Steps(Pinetime::Applications::DisplayApp* app, lv_label_set_align(lstepsGoal, LV_LABEL_ALIGN_CENTER); lv_obj_align(lstepsGoal, lSteps, LV_ALIGN_OUT_BOTTOM_MID, 0, 40); - lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); - lv_obj_set_size(backgroundLabel, 240, 240); - lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text_static(backgroundLabel, ""); - resetBtn = lv_btn_create(lv_scr_act(), nullptr); resetBtn->user_data = this; lv_obj_set_event_cb(resetBtn, lap_event_handler); diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp index 2d61b1dc..e90c7535 100644 --- a/src/displayapp/screens/Tile.cpp +++ b/src/displayapp/screens/Tile.cpp @@ -104,12 +104,6 @@ Tile::Tile(uint8_t screenID, btnm1->user_data = this; lv_obj_set_event_cb(btnm1, event_handler); - lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); - lv_obj_set_size(backgroundLabel, 240, 240); - lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text_static(backgroundLabel, ""); - taskUpdate = lv_task_create(lv_update_task, 5000, LV_TASK_PRIO_MID, this); UpdateScreen(); diff --git a/src/displayapp/screens/Timer.cpp b/src/displayapp/screens/Timer.cpp index bf630b67..285502c6 100644 --- a/src/displayapp/screens/Timer.cpp +++ b/src/displayapp/screens/Timer.cpp @@ -46,12 +46,6 @@ void Timer::CreateButtons() { Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController) : Screen(app), running {true}, timerController {timerController} { - backgroundLabel = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_click(backgroundLabel, true); - lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); - lv_obj_set_size(backgroundLabel, 240, 240); - lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text_static(backgroundLabel, ""); time = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76); diff --git a/src/displayapp/screens/Timer.h b/src/displayapp/screens/Timer.h index 93e84c82..c1f7f9e2 100644 --- a/src/displayapp/screens/Timer.h +++ b/src/displayapp/screens/Timer.h @@ -24,7 +24,6 @@ namespace Pinetime::Applications::Screens { uint8_t secondsToSet = 0; uint8_t minutesToSet = 0; Controllers::TimerController& timerController; - lv_obj_t* backgroundLabel; lv_obj_t* time; lv_obj_t* msecTime; lv_obj_t* btnPlayPause; diff --git a/src/displayapp/screens/Twos.cpp b/src/displayapp/screens/Twos.cpp index ca9295d5..7e465fcd 100644 --- a/src/displayapp/screens/Twos.cpp +++ b/src/displayapp/screens/Twos.cpp @@ -85,12 +85,6 @@ Twos::Twos(Pinetime::Applications::DisplayApp* app) : Screen(app) { lv_obj_align(scoreText, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 10); lv_label_set_recolor(scoreText, true); lv_label_set_text_fmt(scoreText, "Score #FFFF00 %i#", score); - - lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); - lv_obj_set_size(backgroundLabel, 240, 240); - lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text_static(backgroundLabel, ""); } Twos::~Twos() { diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 8a620bd0..1df38255 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -64,13 +64,6 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app, lv_label_set_text_static(label_time_ampm, ""); lv_obj_align(label_time_ampm, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -30, -55); - backgroundLabel = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_click(backgroundLabel, true); - lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); - lv_obj_set_size(backgroundLabel, 240, 240); - lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text_static(backgroundLabel, ""); - heartbeatIcon = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text_static(heartbeatIcon, Symbols::heartBeat); lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B)); diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h index cd83689a..bd27806f 100644 --- a/src/displayapp/screens/WatchFaceDigital.h +++ b/src/displayapp/screens/WatchFaceDigital.h @@ -59,7 +59,6 @@ namespace Pinetime { lv_obj_t* label_time; lv_obj_t* label_time_ampm; lv_obj_t* label_date; - lv_obj_t* backgroundLabel; lv_obj_t* bleIcon; lv_obj_t* batteryPlug; lv_obj_t* heartbeatIcon; diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index ae9f5815..a7772417 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -198,13 +198,6 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(DisplayApp* app, lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 3); lv_obj_set_style_local_pad_inner(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 4); - backgroundLabel = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_click(backgroundLabel, true); - lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); - lv_obj_set_size(backgroundLabel, 240, 240); - lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text_static(backgroundLabel, ""); - btnNextTime = lv_btn_create(lv_scr_act(), nullptr); btnNextTime->user_data = this; lv_obj_set_size(btnNextTime, 60, 60); diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.h b/src/displayapp/screens/WatchFacePineTimeStyle.h index e703d89c..cfabc2c7 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.h +++ b/src/displayapp/screens/WatchFacePineTimeStyle.h @@ -79,7 +79,6 @@ namespace Pinetime { lv_obj_t* dateDayOfWeek; lv_obj_t* dateDay; lv_obj_t* dateMonth; - lv_obj_t* backgroundLabel; lv_obj_t* plugIcon; lv_obj_t* bleIcon; lv_obj_t* calendarOuter; diff --git a/src/displayapp/screens/WatchFaceTerminal.cpp b/src/displayapp/screens/WatchFaceTerminal.cpp index 3a47fc53..80d736cf 100644 --- a/src/displayapp/screens/WatchFaceTerminal.cpp +++ b/src/displayapp/screens/WatchFaceTerminal.cpp @@ -59,13 +59,6 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app, lv_label_set_recolor(label_time, true); lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -60); - backgroundLabel = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_click(backgroundLabel, true); - lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); - lv_obj_set_size(backgroundLabel, 240, 240); - lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text_static(backgroundLabel, ""); - heartbeatValue = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(heartbeatValue, true); lv_obj_align(heartbeatValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 20); diff --git a/src/displayapp/screens/WatchFaceTerminal.h b/src/displayapp/screens/WatchFaceTerminal.h index d236da34..828dbdb1 100644 --- a/src/displayapp/screens/WatchFaceTerminal.h +++ b/src/displayapp/screens/WatchFaceTerminal.h @@ -59,7 +59,6 @@ namespace Pinetime { lv_obj_t* label_date; lv_obj_t* label_prompt_1; lv_obj_t* label_prompt_2; - lv_obj_t* backgroundLabel; lv_obj_t* batteryValue; lv_obj_t* heartbeatValue; lv_obj_t* stepValue; diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp index 1ae6aa98..fe8f3cb4 100644 --- a/src/displayapp/screens/settings/QuickSettings.cpp +++ b/src/displayapp/screens/settings/QuickSettings.cpp @@ -104,12 +104,6 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app, lv_obj_set_style_local_text_font(lbl_btn, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); lv_label_set_text_static(lbl_btn, Symbols::settings); - lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); - lv_obj_set_size(backgroundLabel, 240, 240); - lv_obj_set_pos(backgroundLabel, 0, 0); - lv_label_set_text_static(backgroundLabel, ""); - taskUpdate = lv_task_create(lv_update_task, 5000, LV_TASK_PRIO_MID, this); UpdateScreen();