Refactor draw buffer handling

This commit is contained in:
GW_MC
2026-01-28 13:12:49 +08:00
parent 3e1a651833
commit 38d5facc24
5 changed files with 189 additions and 130 deletions

View File

@@ -56,7 +56,7 @@ public:
esp_err_t refresh_display(void);
esp_err_t full_write(const uint8_t* framebuffer, const bool white_basemap = true);
esp_err_t partial_refresh(const uint8_t* framebuffer, const RefreshArea& area);
esp_err_t partial_refresh(const uint8_t* framebuffer, const RefreshArea& area, const bool is_last_partial_update = true);
esp_err_t clear_display(void);
esp_err_t deep_sleep_display(void);
// Request a full refresh on next flush
@@ -84,6 +84,11 @@ private:
esp_err_t dangerous_epd_write_cmd_without_lock_(const uint8_t cmd);
esp_err_t dangerous_epd_write_data_without_lock_(const uint8_t data);
// write to the internal draw buffer
void write_to_buffer_(const uint8_t* src, const RefreshArea& area);
// write the internal draw buffer to the display's old sram
esp_err_t refresh_old_buffer_(uint32_t transaction_id);
esp_err_t begin_transaction_(TickType_t timeout, uint32_t& out_id);
esp_err_t end_transaction_(void);
// given a transaction ID, wait for current transaction to complete. The transaction ID will determine if the wait is needed.
@@ -102,6 +107,10 @@ private:
spi_device_handle_t spi_ = nullptr;
esp_lcd_panel_io_handle_t tp_io_handle_ = nullptr;
esp_lcd_touch_handle_t tp_handle_ = nullptr;
// this buffer reflects the current display state (1=black, 0=white)
uint8_t* draw_buffer_ = nullptr;
RefreshArea refresh_area_ = { 0, 0, 0, 0 };
};