Skip to content

hm1055: fix set_brightness error handling & logging #770

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

Conversation

RubenKelevra
Copy link
Contributor

@RubenKelevra RubenKelevra commented Jul 17, 2025

Description

The old code always wrote BRIGHT even if enabling ISPCTRL5 failed, while also overwriting the first error code. It also used if (ret != 0) to log/update status, so we reported success when the write actually failed.

Guard the BRIGHT write behind a successful ISPCTRL5 write and only log / update sensor->status.brightness when both writes succeed. This keeps the original error, and prevents false success reports.

Testing

I don't own the hardware.

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.

The old code always wrote BRIGHT even if enabling ISPCTRL5 failed,
while also overwriting the first error code. It also used
`if (ret != 0)` to log/update status, so we reported success when
the write actually failed.

Guard the BRIGHT write behind a successful ISPCTRL5 write and only log /
update `sensor->status.brightness` when both writes succeed. This keeps
the original error, and prevents false success reports.
@me-no-dev
Copy link
Member

i guess this is true not just for that method but to all similar ones. Do you mind fixing them all?

@RubenKelevra
Copy link
Contributor Author

@me-no-dev wrote:

i guess this is true not just for that method but to all similar ones. Do you mind fixing them all?

Yeah, I'm already working on the rest for a dedicated PR. This is a bit more critical, the rest is more cosmetic :)

@me-no-dev me-no-dev merged commit 7e08a0a into espressif:master Jul 18, 2025
30 checks passed
@RubenKelevra RubenKelevra deleted the bugfix/hm1055_set_brightness_return_handling branch July 18, 2025 13:09
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.

2 participants