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.
This commit is contained in:
parent
6dac0a62f4
commit
8160748733
|
@ -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<LittleVgl*>(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<LittleVgl*>(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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -14,7 +14,6 @@ namespace Pinetime {
|
|||
|
||||
private:
|
||||
lv_obj_t* passkeyLabel;
|
||||
lv_obj_t* backgroundLabel;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user