Description
Yesterday my pull request #44 that introduces a property for the display sleep mode was merged. Unfortunately after further testing I realized, that the sleep mode persists after a soft reboot of the device. This happens for example when I copy new code to the circuitpython drive.
Steps to reproduce
- Open a serial connection to the device and enter the REPL
- Run the following
from adafruit_macropad import MacroPad m = MacroPad() m.display_sleep = True
- Watch the display enter sleep mode
- Hit
Ctrl + D
to trigger a soft reboot and enter the REPL again
Expectation
The display wakes up again.
Actual result
The display is still in sleep mode and
>>> from adafruit_macropad import MacroPad
>>> m = MacroPad()
>>> m.display_sleep
False
Workaround
It is still possible to wake up the display manually by always calling
from adafruit_macropad import MacroPad
m = MacroPad()
m.display_sleep = True
m.display_sleep = True
at the beginning of your code. But this is rather ugly because the property needs to be changed twice.
Proposed solution
I did not found a way to query the displays sleep state in the manual. However sending the wake command multiple times to the display seems to have no side effect. Therefore I propose sending the wake command during the initialization of the MacroPad
class to ensure the state of the display.
I will provide a pull request for the proposed solution.