Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Driver] 3-color e-Ink on Quantum Painter #20032

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions drivers/painter/eink_panel/qp_eink_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ bool qp_eink_panel_power(painter_device_t device, bool power_on) {
// Screen clear
bool qp_eink_panel_clear(painter_device_t device) {
painter_driver_t *driver = (painter_driver_t *)device;
qp_init(device, driver->rotation);
return true;
return qp_init(device, driver->rotation);
}

// Screen flush
Expand Down Expand Up @@ -117,18 +116,19 @@ bool qp_eink_panel_flush(painter_device_t device) {
bool qp_eink_panel_viewport(painter_device_t device, uint16_t left, uint16_t top, uint16_t right, uint16_t bottom) {
eink_panel_dc_reset_painter_device_t *driver = (eink_panel_dc_reset_painter_device_t *)device;

qp_viewport(driver->black_surface, left, top, right, bottom);
qp_viewport(driver->color_surface, left, top, right, bottom);
bool ret = qp_viewport(driver->black_surface, left, top, right, bottom);
ret &= qp_viewport(driver->color_surface, left, top, right, bottom);

return true;
return ret;
}

// Stream pixel data to the current write position
bool qp_eink_panel_pixdata(painter_device_t device, const void *pixel_data, uint32_t native_pixel_count) {
eink_panel_dc_reset_painter_device_t *driver = (eink_panel_dc_reset_painter_device_t *)device;
uint8_t * pixels = (uint8_t *)pixel_data;

uint32_t i = 0;
uint32_t i = 0;
bool ret = true;
uint8_t black_data, color_data;
while (i < native_pixel_count) {
// at most, 8 pixels per cycle
Expand All @@ -138,14 +138,19 @@ bool qp_eink_panel_pixdata(painter_device_t device, const void *pixel_data, uint
// stream data to display
decode_masked_pixels(pixels, byte, &black_data, &color_data);
// this is very slow with debugging on, call the vtable's function manually instead
qp_pixdata(driver->black_surface, (const void *)&black_data, pixels_this_loop);
qp_pixdata(driver->color_surface, (const void *)&color_data, pixels_this_loop);
ret &= qp_pixdata(driver->black_surface, (const void *)&black_data, pixels_this_loop);
ret &= qp_pixdata(driver->color_surface, (const void *)&color_data, pixels_this_loop);

if (!ret) {
qp_dprintf("qp_eink_panel_pixdata: something went wrong, quitting\n");
return false;
}
Comment on lines +153 to +156
Copy link
Contributor Author

@elpekenin elpekenin Mar 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the function shouldn't have this early stopping and just keep running anyway, and let return ret; give the false value 🤔


// update position
i += pixels_this_loop;
}

return true;
return ret;
}

// Convert supplied palette entries into their native equivalents
Expand Down Expand Up @@ -210,6 +215,6 @@ bool qp_eink_panel_append_pixels(painter_device_t device, uint8_t *target_buffer
}

bool qp_eink_panel_append_pixdata(painter_device_t device, uint8_t *target_buffer, uint32_t pixdata_offset, uint8_t pixdata_byte) {
qp_dprintf("Shouldn't call append_pixdata on e-Ink displays\n");
qp_dprintf("qp_eink_panel_append_pixdata: should not get here\n");
return false;
}