Added lvgl init, display not refresh correctly
This commit is contained in:
@@ -151,7 +151,7 @@ esp_err_t EInkDisplayHandler::full_write(const uint8_t* framebuffer) {
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t EInkDisplayHandler::partial_refresh(const uint8_t* framebuffer, const RefreshArea& area) {
|
||||
esp_err_t EInkDisplayHandler::partial_refresh(const uint8_t* partial_framebuffer, const RefreshArea& area) {
|
||||
ESP_LOGI(TAG, "Starting partial refresh (0.3 seconds)...");
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
@@ -179,13 +179,18 @@ esp_err_t EInkDisplayHandler::partial_refresh(const uint8_t* framebuffer, const
|
||||
}
|
||||
// Step 3: Set partial window
|
||||
{
|
||||
if (area.x1 % 8 != 0 || area.x2 % 8 != 7) {
|
||||
ESP_LOGE(TAG, "Partial refresh area x1 and x2 must be byte-aligned (x1 %% 8 == 0 and x2 %% 8 == 7)");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
// no rounding needed, area is expected to be aligned
|
||||
std::vector<uint8_t> window_data = {
|
||||
// x start
|
||||
static_cast<uint8_t>((area.x1 >> 8) & 0xFF), // x start high byte
|
||||
static_cast<uint8_t>(area.x1 & 0xFF), // x start low byte
|
||||
static_cast<uint8_t>(area.x1 & 0x07), // x start low byte
|
||||
// x end
|
||||
static_cast<uint8_t>((area.x2 >> 8) & 0xFF),
|
||||
static_cast<uint8_t>(area.x2 & 0xFF),
|
||||
static_cast<uint8_t>(area.x2 & 0x07),
|
||||
// y start
|
||||
static_cast<uint8_t>((area.y1 >> 8) & 0xFF),
|
||||
static_cast<uint8_t>(area.y1 & 0xFF),
|
||||
@@ -209,9 +214,9 @@ esp_err_t EInkDisplayHandler::partial_refresh(const uint8_t* framebuffer, const
|
||||
return err;
|
||||
}
|
||||
|
||||
err = transfer_spi_data(framebuffer, DISPLAY_BUFFER_SIZE, transaction_guard.transaction_id()); // Send new framebuffer data
|
||||
err = transfer_spi_data(partial_framebuffer, DISPLAY_BUFFER_SIZE, transaction_guard.transaction_id()); // Send new framebuffer data
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to send framebuffer data for partial refresh: %s", esp_err_to_name(err));
|
||||
ESP_LOGE(TAG, "Failed to send partial_framebuffer data for partial refresh: %s", esp_err_to_name(err));
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user