From 2a12caa955f6597c93a563dd549b0390891e86e3 Mon Sep 17 00:00:00 2001 From: Samuel Sieb Date: Wed, 10 Mar 2021 21:17:50 -0800 Subject: [PATCH] change lcd clear() to clear the buffer (#1600) Co-authored-by: Samuel Sieb --- esphome/components/lcd_base/lcd_display.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/esphome/components/lcd_base/lcd_display.cpp b/esphome/components/lcd_base/lcd_display.cpp index 25ac143817..50bd818cdb 100644 --- a/esphome/components/lcd_base/lcd_display.cpp +++ b/esphome/components/lcd_base/lcd_display.cpp @@ -104,9 +104,7 @@ void HOT LCDDisplay::display() { } } void LCDDisplay::update() { - for (uint8_t i = 0; i < this->rows_ * this->columns_; i++) - this->buffer_[i] = ' '; - + this->clear(); this->call_writer(); this->display(); } @@ -149,9 +147,8 @@ void LCDDisplay::printf(const char *format, ...) { this->print(0, 0, buffer); } void LCDDisplay::clear() { - // clear display, also sets DDRAM address to 0 (home) - this->command_(LCD_DISPLAY_COMMAND_CLEAR_DISPLAY); - delay(2); + for (uint8_t i = 0; i < this->rows_ * this->columns_; i++) + this->buffer_[i] = ' '; } #ifdef USE_TIME void LCDDisplay::strftime(uint8_t column, uint8_t row, const char *format, time::ESPTime time) {