Skip to content

feat(esp_lcd_sh8601): add brightness control to the panel (AEGHB-1429)#668

Open
ldab wants to merge 1 commit into
espressif:masterfrom
ldab:master
Open

feat(esp_lcd_sh8601): add brightness control to the panel (AEGHB-1429)#668
ldab wants to merge 1 commit into
espressif:masterfrom
ldab:master

Conversation

@ldab
Copy link
Copy Markdown

@ldab ldab commented Feb 24, 2026

Description

Add display brightness controll

Related

Goes with IDF espressif/esp-idf#18273

Testing


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

Copilot AI review requested due to automatic review settings February 24, 2026 15:25
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Feb 24, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 24, 2026

Messages
📖 🎉 Good Job! All checks are passing!

👋 Hello ldab, we appreciate your contribution to this project!


Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against 2fe6e49

@github-actions github-actions Bot changed the title feat(esp_lcd_sh8601): add brightness control to the panel feat(esp_lcd_sh8601): add brightness control to the panel (AEGHB-1429) Feb 24, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds brightness control support for the SH8601 LCD panel driver so users (and potentially generic panel ops) can adjust display brightness.

Changes:

  • Exposes a new public brightness-setting API in esp_lcd_sh8601.h.
  • Implements SH8601 brightness control via LCD_CMD_WRDISBV and wires it into the panel driver ops.

Reviewed changes

Copilot reviewed 1 out of 1 changed files in this pull request and generated 5 comments.

File Description
components/display/lcd/esp_lcd_sh8601/include/esp_lcd_sh8601.h Adds a public API declaration for setting SH8601 brightness.
components/display/lcd/esp_lcd_sh8601/esp_lcd_sh8601.c Implements brightness command handling and registers the new brightness op on the panel handle.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +351 to +360
static esp_err_t panel_sh8601_set_brightness(esp_lcd_panel_t *panel, int brightness)
{
sh8601_panel_t *sh8601 = __containerof(panel, sh8601_panel_t, base);
esp_lcd_panel_io_handle_t io = sh8601->io;

// Clamp brightness to 0-1023 range (10-bit)
uint16_t brightness_val = (brightness < 0) ? 0 : (brightness > 1023) ? 1023 : (uint16_t)brightness;
// Send as 2 bytes: MSB and LSB
return tx_param(sh8601, io, LCD_CMD_WRDISBV, (uint8_t[]) { (brightness_val >> 8) & 0xFF, brightness_val & 0xFF }, 2);
}
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

Brightness support is introduced here, but there are existing Unity hardware tests for SH8601 under test_apps/ and none exercise the new brightness path. Please add at least a basic call (and error check) in the test app(s) so the new API is built and executed in CI/hardware test runs.

Copilot uses AI. Check for mistakes.
Comment on lines 123 to 126
sh8601->base.swap_xy = panel_sh8601_swap_xy;
sh8601->base.disp_on_off = panel_sh8601_disp_on_off;
sh8601->base.set_brightness = panel_sh8601_set_brightness;
*ret_panel = &(sh8601->base);
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

Assigning sh8601->base.set_brightness assumes the set_brightness function pointer exists in esp_lcd_panel_t. If this component is meant to support IDF versions where that field is absent, this assignment will break the build. Please guard this assignment with an appropriate IDF version/feature check or avoid touching the base struct when building against older IDF versions.

Copilot uses AI. Check for mistakes.
Comment on lines 59 to 67
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

New public API name esp_lcd_sh8601_set_brightness() is inconsistent with the naming used by other panel drivers that expose extra panel APIs (e.g. esp_lcd_panel_co5300_set_brightness() in components/display/lcd/esp_lcd_co5300/include/esp_lcd_co5300.h:88). Consider renaming to esp_lcd_panel_sh8601_set_brightness() (and optionally keeping esp_lcd_sh8601_set_brightness() as a backward-compatible alias) to align with existing naming patterns.

Copilot uses AI. Check for mistakes.
@@ -35,6 +35,7 @@ static esp_err_t panel_sh8601_mirror(esp_lcd_panel_t *panel, bool mirror_x, bool
static esp_err_t panel_sh8601_swap_xy(esp_lcd_panel_t *panel, bool swap_axes);
static esp_err_t panel_sh8601_set_gap(esp_lcd_panel_t *panel, int x_gap, int y_gap);
static esp_err_t panel_sh8601_disp_on_off(esp_lcd_panel_t *panel, bool off);
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

The forward declaration panel_sh8601_disp_on_off(…, bool off) uses a parameter name (off) that doesn't match the implementation (bool on_off). This is minor but can be confusing when reading stack traces or debugging; consider renaming the parameter in the prototype to match the definition.

Suggested change
static esp_err_t panel_sh8601_disp_on_off(esp_lcd_panel_t *panel, bool off);
static esp_err_t panel_sh8601_disp_on_off(esp_lcd_panel_t *panel, bool on_off);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants