From 8061822f0cba9caa9d957b85a8284ab3120aaf3e Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Tue, 26 Apr 2022 13:09:30 +0300 Subject: [PATCH] Fix large blacklevel step. Lower 25% of shades are now accessible. There is a large step in brightness from level zero to level one. After experimenting with various ST7789 options, I found that decreasing VDV to 0x10 (-0.4V) fixes this issue. The gamma change reduced the average error in brightness, but with the underlying issue fixed, the gamma change has been reverted. --- src/displayapp/screens/HeartRate.cpp | 2 +- src/displayapp/screens/List.cpp | 2 +- src/displayapp/screens/Music.cpp | 2 +- src/displayapp/screens/Notifications.cpp | 2 +- src/displayapp/screens/StopWatch.cpp | 2 +- src/displayapp/screens/Tile.cpp | 4 ++-- src/displayapp/screens/settings/QuickSettings.cpp | 2 +- src/drivers/St7789.cpp | 10 ++++++---- src/drivers/St7789.h | 4 ++-- 9 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/displayapp/screens/HeartRate.cpp b/src/displayapp/screens/HeartRate.cpp index ac061b4e..35e06bbc 100644 --- a/src/displayapp/screens/HeartRate.cpp +++ b/src/displayapp/screens/HeartRate.cpp @@ -49,7 +49,7 @@ HeartRate::HeartRate(Pinetime::Applications::DisplayApp* app, lv_obj_align(label_bpm, label_hr, LV_ALIGN_OUT_TOP_MID, 0, -20); label_status = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(label_status, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x222222)); + lv_obj_set_style_local_text_color(label_status, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); lv_label_set_text_static(label_status, ToString(Pinetime::Controllers::HeartRateController::States::NotEnoughData)); lv_obj_align(label_status, label_hr, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); diff --git a/src/displayapp/screens/List.cpp b/src/displayapp/screens/List.cpp index ffc62150..9e21a8b9 100644 --- a/src/displayapp/screens/List.cpp +++ b/src/displayapp/screens/List.cpp @@ -67,7 +67,7 @@ List::List(uint8_t screenID, if (applications[i].application != Apps::None) { itemApps[i] = lv_btn_create(container1, nullptr); - lv_obj_set_style_local_bg_opa(itemApps[i], LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_40); + lv_obj_set_style_local_bg_opa(itemApps[i], LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); lv_obj_set_style_local_radius(itemApps[i], LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 57); lv_obj_set_style_local_bg_color(itemApps[i], LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); diff --git a/src/displayapp/screens/Music.cpp b/src/displayapp/screens/Music.cpp index 194aeed5..92112368 100644 --- a/src/displayapp/screens/Music.cpp +++ b/src/displayapp/screens/Music.cpp @@ -53,7 +53,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus lv_style_init(&btn_style); lv_style_set_radius(&btn_style, LV_STATE_DEFAULT, 20); lv_style_set_bg_color(&btn_style, LV_STATE_DEFAULT, LV_COLOR_AQUA); - lv_style_set_bg_opa(&btn_style, LV_STATE_DEFAULT, LV_OPA_40); + lv_style_set_bg_opa(&btn_style, LV_STATE_DEFAULT, LV_OPA_50); btnVolDown = lv_btn_create(lv_scr_act(), nullptr); btnVolDown->user_data = this; diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 9123921a..21843083 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -181,7 +181,7 @@ Notifications::NotificationItem::NotificationItem(const char* title, : mode {mode}, alertNotificationService {alertNotificationService}, motorController {motorController} { lv_obj_t* container1 = lv_cont_create(lv_scr_act(), NULL); - lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x30, 0x30, 0x30)); + lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x38, 0x38, 0x38)); lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10); lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5); lv_obj_set_style_local_border_width(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 0); diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp index 6de19864..6899567c 100644 --- a/src/displayapp/screens/StopWatch.cpp +++ b/src/displayapp/screens/StopWatch.cpp @@ -65,7 +65,7 @@ StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask) lv_obj_set_event_cb(btnStopLap, stop_lap_event_handler); lv_obj_set_size(btnStopLap, 115, 50); lv_obj_align(btnStopLap, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); - lv_obj_set_style_local_bg_color(btnStopLap, LV_BTN_PART_MAIN, LV_STATE_DISABLED, lv_color_hex(0x0b0b0b)); + lv_obj_set_style_local_bg_color(btnStopLap, LV_BTN_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_MAKE(0x18, 0x18, 0x18)); txtStopLap = lv_label_create(btnStopLap, nullptr); lv_obj_set_style_local_text_color(txtStopLap, LV_BTN_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0)); lv_label_set_text_static(txtStopLap, Symbols::stop); diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp index 0a113e3e..2d61b1dc 100644 --- a/src/displayapp/screens/Tile.cpp +++ b/src/displayapp/screens/Tile.cpp @@ -87,9 +87,9 @@ Tile::Tile(uint8_t screenID, lv_obj_align(btnm1, NULL, LV_ALIGN_CENTER, 0, 10); lv_obj_set_style_local_radius(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DEFAULT, 20); - lv_obj_set_style_local_bg_opa(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DEFAULT, LV_OPA_40); + lv_obj_set_style_local_bg_opa(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DEFAULT, LV_OPA_50); lv_obj_set_style_local_bg_color(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DEFAULT, LV_COLOR_AQUA); - lv_obj_set_style_local_bg_opa(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DISABLED, LV_OPA_40); + lv_obj_set_style_local_bg_opa(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DISABLED, LV_OPA_50); lv_obj_set_style_local_bg_color(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DISABLED, lv_color_hex(0x111111)); lv_obj_set_style_local_pad_all(btnm1, LV_BTNMATRIX_PART_BG, LV_STATE_DEFAULT, 0); lv_obj_set_style_local_pad_inner(btnm1, LV_BTNMATRIX_PART_BG, LV_STATE_DEFAULT, 10); diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp index 6268531a..1ae6aa98 100644 --- a/src/displayapp/screens/settings/QuickSettings.cpp +++ b/src/displayapp/screens/settings/QuickSettings.cpp @@ -49,7 +49,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app, lv_style_init(&btn_style); lv_style_set_radius(&btn_style, LV_STATE_DEFAULT, buttonHeight / 4); - lv_style_set_bg_color(&btn_style, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x1c, 0x1c, 0x1c)); + lv_style_set_bg_color(&btn_style, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x38, 0x38, 0x38)); btn1 = lv_btn_create(lv_scr_act(), nullptr); btn1->user_data = this; diff --git a/src/drivers/St7789.cpp b/src/drivers/St7789.cpp index d520199e..3ed1beb4 100644 --- a/src/drivers/St7789.cpp +++ b/src/drivers/St7789.cpp @@ -23,7 +23,7 @@ void St7789::Init() { RowAddressSet(); DisplayInversionOn(); NormalModeOn(); - SetGamma(); + SetVdv(); DisplayOn(); } @@ -115,9 +115,11 @@ void St7789::WriteToRam() { WriteCommand(static_cast(Commands::WriteToRam)); } -void St7789::SetGamma() { - WriteCommand(static_cast(Commands::GammaSet)); - WriteData(0x04); +void St7789::SetVdv() { + // By default there is a large step from pixel brightness zero to one. + // After experimenting with VCOMS, VRH and VDV, this was found to produce good results. + WriteCommand(static_cast(Commands::VdvSet)); + WriteData(0x10); } void St7789::DisplayOff() { diff --git a/src/drivers/St7789.h b/src/drivers/St7789.h index 1317abe2..a2f10447 100644 --- a/src/drivers/St7789.h +++ b/src/drivers/St7789.h @@ -43,7 +43,7 @@ namespace Pinetime { void NormalModeOn(); void WriteToRam(); void SetAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1); - void SetGamma(); + void SetVdv(); void WriteCommand(uint8_t cmd); void WriteSpi(const uint8_t* data, size_t size); @@ -53,7 +53,6 @@ namespace Pinetime { SleepOut = 0x11, NormalModeOn = 0x13, DisplayInversionOn = 0x21, - GammaSet = 0x26, DisplayOff = 0x28, DisplayOn = 0x29, ColumnAddressSet = 0x2a, @@ -63,6 +62,7 @@ namespace Pinetime { VerticalScrollDefinition = 0x33, VerticalScrollStartAddress = 0x37, ColMod = 0x3a, + VdvSet = 0xc4, }; void WriteData(uint8_t data); void ColumnAddressSet();