lovyan03 / LovyanGFX

SPI LCD graphics library for ESP32 (ESP-IDF/ArduinoESP32) / ESP8266 (ArduinoESP8266) / SAMD51(Seeed ArduinoSAMD51)
Other
1.03k stars 189 forks source link

- Added GUITION ST7701 panel instructions. #562

Closed FigueiredoStable closed 2 weeks ago

FigueiredoStable commented 2 weeks ago

Just add a new device support for ST7701 manufactured by GUITION, link: GUITION Smart Display

* The board:

971639B2-4FC4-41CF-A686-3E82BFD55B0F

* Before the new instructions, colors were inverted or only rendered a partial size of the screen:

FD656371-C06C-403B-A00E-3FD29255FF97

* After added instructions by manufacture

6B443387-C58F-4529-8518-D653D0CE62EA

tobozo commented 2 weeks ago

both ::init() methods are identical; since LGFX has a desing pattern for display variants, let's create a Panel_ST7701_Base to handle the redundant ::init() and make both Panel_ST7701 and Panel_ST7701_guition_esp32_4848S040 inherit from it:

lgfx/v1/platforms/esp32s3/Panel_RGB.hpp

  struct Panel_ST7701_Base : public Panel_RGB
  {
    bool init(bool) override; 
  };

  struct Panel_ST7701 : public Panel_ST7701_Base
  {
  protected:
    const uint8_t* getInitCommands(uint8_t listno) const override;
  };

  struct Panel_ST7701_guition_esp32_4848S040: public Panel_ST7701_Base
  {
  protected:
    const uint8_t* getInitCommands(uint8_t listno) const override;
  };

lgfx/v1/platforms/esp32s3/Panel_RGB.cpp

FigueiredoStable commented 2 weeks ago

both ::init() methods are identical; since LGFX has a desing pattern for display variants, let's create a Panel_ST7701_Base to handle the redundant ::init() and make both Panel_ST7701 and Panel_ST7701_guition_esp32_4848S040 inherit from it:

lgfx/v1/platforms/esp32s3/Panel_RGB.hpp

  struct Panel_ST7701_Base : public Panel_RGB
  {
    bool init(bool) override; 
  };

  struct Panel_ST7701 : public Panel_ST7701_Base
  {
  protected:
    const uint8_t* getInitCommands(uint8_t listno) const override;
  };

  struct Panel_ST7701_guition_esp32_4848S040: public Panel_ST7701_Base
  {
  protected:
    const uint8_t* getInitCommands(uint8_t listno) const override;
  };

lgfx/v1/platforms/esp32s3/Panel_RGB.cpp

  • create Panel_ST7701_Base::init(bool)
  • remove Panel_ST7701::init(bool)
  • remove Panel_ST7701_guition_esp32_4848S040::init(bool)

Great point, i added Panel ST7701 base initialization. Tks

tobozo commented 2 weeks ago

looks good, thanks for your contribution :+1: