[st7701s] Fix initialisation race (#7462)
Some checks failed
YAML lint / yamllint (push) Has been cancelled
CI / Create common environment (push) Has been cancelled
CI / Check black (push) Has been cancelled
CI / Check flake8 (push) Has been cancelled
CI / Check pylint (push) Has been cancelled
CI / Check pyupgrade (push) Has been cancelled
CI / Run script/ci-custom (push) Has been cancelled
CI / Run pytest (push) Has been cancelled
CI / Check clang-format (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 1/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 2/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 3/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 4/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 IDF (push) Has been cancelled
CI / Run script/clang-tidy for ESP8266 (push) Has been cancelled
CI / list-components (push) Has been cancelled
CI / Component test (push) Has been cancelled
CI / Split components for testing into 20 groups maximum (push) Has been cancelled
CI / Test split components (push) Has been cancelled
CI / CI Status (push) Has been cancelled

This commit is contained in:
Clyde Stubbs 2024-09-19 14:18:51 +10:00 committed by GitHub
parent fb7e7eb80b
commit 8e5d7337c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,14 +9,6 @@ void ST7701S::setup() {
esph_log_config(TAG, "Setting up ST7701S"); esph_log_config(TAG, "Setting up ST7701S");
this->spi_setup(); this->spi_setup();
this->write_init_sequence_(); this->write_init_sequence_();
}
// called after a delay after writing the init sequence
void ST7701S::complete_setup_() {
this->write_command_(SLEEP_OUT);
this->write_command_(DISPLAY_ON);
this->spi_teardown(); // SPI not needed after this
delay(10);
esp_lcd_rgb_panel_config_t config{}; esp_lcd_rgb_panel_config_t config{};
config.flags.fb_in_psram = 1; config.flags.fb_in_psram = 1;
@ -179,7 +171,12 @@ void ST7701S::write_init_sequence_() {
this->write_data_(val); this->write_data_(val);
ESP_LOGD(TAG, "write MADCTL %X", val); ESP_LOGD(TAG, "write MADCTL %X", val);
this->write_command_(this->invert_colors_ ? INVERT_ON : INVERT_OFF); this->write_command_(this->invert_colors_ ? INVERT_ON : INVERT_OFF);
this->set_timeout(120, [this] { this->complete_setup_(); }); // can't avoid this inline delay due to the need to complete setup before anything else tries to draw.
delay(120); // NOLINT
this->write_command_(SLEEP_OUT);
this->write_command_(DISPLAY_ON);
this->spi_teardown(); // SPI not needed after this
delay(10);
} }
void ST7701S::dump_config() { void ST7701S::dump_config() {