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

Add DISPLAY_CONTRAST to europi_config, refactor Display class #395

Merged
merged 11 commits into from
Jan 10, 2025

Conversation

chrisib
Copy link
Collaborator

@chrisib chrisib commented Dec 3, 2024

As-per a user suggestion on Discord, add DISPLAY_CONTRAST to europi_config to tune the brightness of the display. Documentation seems inconsistent, as some Arduino docs for the SSD1306_I2C I've read indicate contrast is the percentage 0-100, while the Micropython docs use 0 and 255 in their example (https://docs.micropython.org/en/latest/esp8266/tutorial/ssd1306.html. I've opted for the Micropython range, though truth be told I don't see anything changing below about 8.

I've also relocated the Display class to a new europi_display module, and added a new DummyDisplay class & custom exception that gets raised if the display hardware is not detected. I've been doing some software debugging with an extra Pico in a breadboard, but don't have a display connected. Having europi crash with an unhandled exception because the display hardware is missing doesn't feel great IMO, so instead the error gets printed for debugging, and we instantiate a software-compatible DummyDisplay. This lets the software function, and should (in theory) make things easier for a possible EuroPi Lite that doesn't have a display at all.

This eliminates some extra logic inside the Display class where functions behave differently if TEST_ENV is True or False.

@chrisib chrisib added firmware Software related issue improvement Improvement or optimization of an existing feature or script labels Dec 5, 2024
@chrisib
Copy link
Collaborator Author

chrisib commented Jan 10, 2025

Rebased to latest main, added ellipse to the new DummyDisplay class

@chrisib chrisib merged commit 85fe6a5 into Allen-Synthesis:main Jan 10, 2025
3 checks passed
@chrisib chrisib deleted the display-contrast branch January 10, 2025 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
firmware Software related issue improvement Improvement or optimization of an existing feature or script
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant