Add DISPLAY_CONTRAST
to europi_config
, refactor Display
class
#395
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theSSD1306_I2C
I've read indicate contrast is the percentage 0-100, while the Micropython docs use0
and255
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 neweuropi_display
module, and added a newDummyDisplay
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. Havingeuropi
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-compatibleDummyDisplay
. 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 ifTEST_ENV
is True or False.