diff options
| author | Riku Isokoski <riksu9000@gmail.com> | 2022-04-26 10:09:30 (GMT) |
|---|---|---|
| committer | Riku Isokoski <riksu9000@gmail.com> | 2022-04-29 08:35:22 (GMT) |
| commit | 8061822f0cba9caa9d957b85a8284ab3120aaf3e (patch) | |
| tree | 670b66667cd117737a7f8708d8887b64bd5759eb /src/drivers | |
| parent | b31fbb4adb0f895ff32b93fff492070e44716d54 (diff) | |
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.
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/St7789.cpp | 10 | ||||
| -rw-r--r-- | src/drivers/St7789.h | 4 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/drivers/St7789.cpp b/src/drivers/St7789.cpp index d520199..3ed1beb 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<uint8_t>(Commands::WriteToRam)); } -void St7789::SetGamma() { - WriteCommand(static_cast<uint8_t>(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<uint8_t>(Commands::VdvSet)); + WriteData(0x10); } void St7789::DisplayOff() { diff --git a/src/drivers/St7789.h b/src/drivers/St7789.h index 1317abe..a2f1044 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(); |
