-
-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ST7701 / GC9503 ESP32-S3 wrong colors behaviour #542
Comments
After better evaluating the version for the arduino_GFX library that was sent by the manufacturer, there are changes in the instructions, in any version just change the following points that work, as follows: /* Changed by manufacturer */static const uint8_t st7701_type1_init_operations[] = {
BEGIN_WRITE,
WRITE_COMMAND_8, 0xFF,
WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x10,
WRITE_C8_D16, 0xC0, 0x3B, 0x00,
WRITE_C8_D16, 0xC1, 0x0D, 0x02,
WRITE_C8_D16, 0xC2, 0x31, 0x05,
WRITE_C8_D8, 0xCD, 0x00, //0x08 /* Changed by manufacturer */
WRITE_COMMAND_8, 0xB0, // Positive Voltage Gamma Control
WRITE_BYTES, 16,
0x00, 0x11, 0x18, 0x0E,
0x11, 0x06, 0x07, 0x08,
0x07, 0x22, 0x04, 0x12,
0x0F, 0xAA, 0x31, 0x18,
WRITE_COMMAND_8, 0xB1, // Negative Voltage Gamma Control
WRITE_BYTES, 16,
0x00, 0x11, 0x19, 0x0E,
0x12, 0x07, 0x08, 0x08,
0x08, 0x22, 0x04, 0x11,
0x11, 0xA9, 0x32, 0x18,
// PAGE1
WRITE_COMMAND_8, 0xFF,
WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x11,
WRITE_C8_D8, 0xB0, 0x60, // Vop=4.7375v
WRITE_C8_D8, 0xB1, 0x32, // VCOM=32
WRITE_C8_D8, 0xB2, 0x07, // VGH=15v
WRITE_C8_D8, 0xB3, 0x80,
WRITE_C8_D8, 0xB5, 0x49, // VGL=-10.17v
WRITE_C8_D8, 0xB7, 0x85,
WRITE_C8_D8, 0xB8, 0x21, // AVDD=6.6 & AVCL=-4.6
WRITE_C8_D8, 0xC1, 0x78,
WRITE_C8_D8, 0xC2, 0x78,
WRITE_COMMAND_8, 0xE0,
WRITE_BYTES, 3, 0x00, 0x1B, 0x02,
WRITE_COMMAND_8, 0xE1,
WRITE_BYTES, 11,
0x08, 0xA0, 0x00, 0x00,
0x07, 0xA0, 0x00, 0x00,
0x00, 0x44, 0x44,
WRITE_COMMAND_8, 0xE2,
WRITE_BYTES, 12,
0x11, 0x11, 0x44, 0x44,
0xED, 0xA0, 0x00, 0x00,
0xEC, 0xA0, 0x00, 0x00,
WRITE_COMMAND_8, 0xE3,
WRITE_BYTES, 4, 0x00, 0x00, 0x11, 0x11,
WRITE_C8_D16, 0xE4, 0x44, 0x44,
WRITE_COMMAND_8, 0xE5,
WRITE_BYTES, 16,
0x0A, 0xE9, 0xD8, 0xA0,
0x0C, 0xEB, 0xD8, 0xA0,
0x0E, 0xED, 0xD8, 0xA0,
0x10, 0xEF, 0xD8, 0xA0,
WRITE_COMMAND_8, 0xE6,
WRITE_BYTES, 4, 0x00, 0x00, 0x11, 0x11,
WRITE_C8_D16, 0xE7, 0x44, 0x44,
WRITE_COMMAND_8, 0xE8,
WRITE_BYTES, 16,
0x09, 0xE8, 0xD8, 0xA0,
0x0B, 0xEA, 0xD8, 0xA0,
0x0D, 0xEC, 0xD8, 0xA0,
0x0F, 0xEE, 0xD8, 0xA0,
WRITE_COMMAND_8, 0xEB,
WRITE_BYTES, 7,
0x02, 0x00, 0xE4, 0xE4,
0x88, 0x00, 0x40,
WRITE_C8_D16, 0xEC, 0x3C, 0x00,
WRITE_COMMAND_8, 0xED,
WRITE_BYTES, 16,
0xAB, 0x89, 0x76, 0x54,
0x02, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0x20,
0x45, 0x67, 0x98, 0xBA,
//-----------VAP & VAN---------------
WRITE_COMMAND_8, 0xFF,
WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x13,
WRITE_C8_D8, 0xE5, 0xE4,
WRITE_COMMAND_8, 0xFF,
WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x00,
//WRITE_COMMAND_8, 0x21, // 0x20 normal, 0x21 IPS /* Changed by manufacturer */
WRITE_C8_D8, 0x3A, 0x60, // 0x70 RGB888, 0x60 RGB666, 0x50 RGB565
WRITE_COMMAND_8, 0x11, // Sleep Out
END_WRITE,
DELAY, 120,
BEGIN_WRITE,
WRITE_COMMAND_8, 0x29, // Display On
END_WRITE}; Is possible to change in LovyanGFX too? *Manufacturer download links are no longer active. I will leave a link to the files sent by the manufacturer. [ESP32 4.0inch.zip] https://file.io/JPyNFOs0t4in |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has not had recent activity. Thank you for your contributions. |
Hy just to document, i solve this question change the instructions to RGP Panel like a manufacture did with Arduino_GFX, but on LovyanGFX, solution above: Add these lines to Panel_RGB.cpp//----------------------------------------------------------------------------
const uint8_t* Panel_ST7701_gution_esp32_4848S040::getInitCommands(uint8_t listno) const
{
static constexpr const uint8_t list0[] =
{
// Command2 BK0 SEL
0xFF, 5, 0x77, 0x01, 0x00, 0x00, 0x10,
0xC0, 2, 0x3B, 0x00, // added by manufacture
0xC1, 2, 0x0D, 0x02,
0xC2, 2, 0x31, 0x05,
0xCD, 1, 0x00, // changed by manufacture
// Positive Voltage Gamma Control
0xB0, 16, 0x00, 0x11, 0x18, 0x0E, 0x11, 0x06, 0x07, 0x08,
0x07, 0x22, 0x04, 0x12, 0x0F, 0xAA, 0x31, 0x18,
// Negative Voltage Gamma Control
0xB1, 16, 0x00, 0x11, 0x19, 0x0E, 0x12, 0x07, 0x08, 0x08,
0x08, 0x22, 0x04, 0x11, 0x11, 0xA9, 0x32, 0x18,
// Command2 BK1 SEL
0xFF, 5, 0x77, 0x01, 0x00, 0x00, 0x11,
0xB0, 1, 0x60, // Vop=4.7375v
0xB1, 1, 0x32, // VCOM=32
0xB2, 1, 0x07, // VGH=15v
0xB3, 1, 0x80,
0xB5, 1, 0x49, // VGL=-10.17v
0xB7, 1, 0x85,
0xB8, 1, 0x21, // AVDD=6.6 & AVCL=-4.6
0xC1, 1, 0x78,
0xC2, 1, 0x78,
0xE0, 3, 0x00, 0x1B, 0x02,
0xE1, 11, 0x08, 0xA0, 0x00, 0x00, 0x07, 0xA0, 0x00, 0x00, 0x00, 0x44, 0x44,
0xE2, 12, 0x11, 0x11, 0x44, 0x44, 0xED, 0xA0, 0x00, 0x00, 0xEC, 0xA0, 0x00, 0x00,
0xE3, 4, 0x00, 0x00, 0x11, 0x11,
0xE4, 2, 0x44, 0x44,
0xE5, 16, 0x0A, 0xE9, 0xD8, 0xA0, 0x0C, 0xEB, 0xD8, 0xA0,
0x0E, 0xED, 0xD8, 0xA0, 0x10, 0xEF, 0xD8, 0xA0,
0xE6, 4, 0x00, 0x00, 0x11, 0x11,
0xE7, 2, 0x44, 0x44,
0xE8, 16, 0x09, 0xE8, 0xD8, 0xA0, 0x0B, 0xEA, 0xD8, 0xA0,
0x0D, 0xEC, 0xD8, 0xA0, 0x0F, 0xEE, 0xD8, 0xA0,
0xEB, 7, 0x02, 0x00, 0xE4, 0xE4, 0x88, 0x00, 0x40,
0xEC, 2, 0x3C, 0x00,
0xED, 16, 0xAB, 0x89, 0x76, 0x54, 0x02, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0x20, 0x45, 0x67, 0x98, 0xBA,
//-----------VAP & VAN---------------
// Command2 BK3 SEL
0xFF, 5, 0x77, 0x01, 0x00, 0x00, 0x13,
0xE5, 1, 0xE4,
// Command2 BK0 SEL
0xFF, 5, 0x77, 0x01, 0x00, 0x00, 0x00,
//0x21, 0, // 0x20 normal, 0x21 IPS // commented by manufacture
0x3A, 1, 0x60, // 0x70 RGB888, 0x60 RGB666, 0x50 RGB565
0x11, CMD_INIT_DELAY, 120, // Sleep Out
0x29, 0, // Display On
0xFF, 0xFF,
};
switch (listno)
{
case 0: return list0;
default: return nullptr;
}
}
bool Panel_ST7701_gution_esp32_4848S040::init(bool use_reset)
{
if (!Panel_RGB::init(use_reset))
{
return false;
}
int32_t pin_mosi = _config_detail.pin_mosi;
int32_t pin_sclk = _config_detail.pin_sclk;
if (pin_mosi >= 0 && pin_sclk >= 0)
{
lgfx::gpio::pin_backup_t backup_pins[] = { (gpio_num_t)pin_mosi, (gpio_num_t)pin_sclk };
lgfx::gpio_lo(pin_mosi);
lgfx::pinMode(pin_mosi, pin_mode_t::output);
lgfx::gpio_lo(pin_sclk);
lgfx::pinMode(pin_sclk, pin_mode_t::output);
int32_t pin_cs = _config_detail.pin_cs;
lgfx::gpio_lo(pin_cs);
writeCommand(0xFF, 1);
writeData(0x77, 1);
writeData(0x01, 1);
writeData(0x00, 2);
writeData(0x10, 1);
// 0xC0 : LNSET : Display Line Setting
writeCommand(0xC0, 1);
uint32_t line1 = (_cfg.panel_height >> 3) + 1;
uint32_t line2 = (_cfg.panel_height >> 1) & 3;
writeData(line1 + (line2 ? 0x80 : 0x00), 1);
writeData(line2, 1);
// 0xC3 : RGBCTRL
auto cfg = ((Bus_RGB*)_bus)->config();
writeCommand(0xC3, 1);
uint32_t rgbctrl = 0;
if ( cfg.de_idle_high ) rgbctrl += 0x01;
if ( cfg.pclk_idle_high) rgbctrl += 0x02;
if (!cfg.hsync_polarity) rgbctrl += 0x04;
if (!cfg.vsync_polarity) rgbctrl += 0x08;
writeData(rgbctrl, 1);
writeData(0x10, 1);
writeData(0x08, 1);
for (uint8_t i = 0; auto cmds = getInitCommands(i); i++)
{
command_list(cmds);
}
lgfx::gpio_hi(pin_cs);
for (auto &bup : backup_pins) { bup.restore(); }
}
return true;
}
//---------------------------------------------------------------------------- Add the struct to header Panel_RGB.hppstruct Panel_ST7701_gution_esp32_4848S040: public Panel_RGB
{
bool init(bool) override;
protected:
const uint8_t* getInitCommands(uint8_t listno) const override;
}; Now just use this version for this specifc board. |
Hi @FigueiredoStable |
Hi @kchudoba it can be an LVGL config, try this example i have made for this specific device: |
Hi @FigueiredoStable |
Carefully written Issues are more likely to be given priority.
丁寧に記述された報告は優先して対応される可能性が高くなります。
Environment ( 実行環境 )
Problem Description ( 問題の内容 )
The screen appears to have inverted colors, as if it were a negative.
Expected Behavior ( 期待される動作 )
Correct colors.
Actual Behavior ( 実際の動作 )
All screens generated are wrong colors.
Steps to reproduce ( 再現のための前提条件 )
// If possible, attach a picture of your setup/wiring here.
#screen
board
Code to reproduce this issue ( 再現させるためのコード )
board pin configuration:
lvgl config
// If your code is longer than 30 lines, GIST is preferred.
When I use the latest version of Arduino_GFX with the configuration below it shows normally.
The text was updated successfully, but these errors were encountered: