Customer:
I’m developing with the new FLICK display. The screen looks much better than the old version. I need to show a “sleep” layout on the display when a user pushes the power button, regardless of what’s currently on screen - similar to how e-readers handle shutdown. How can I detect the power button press and act on it before the device powers off?
Originally submitted via email support on 11 September 2024. Migrated to the forum for community visibility.
Soldered Support:
Unfortunately, it’s impossible to act on the power off function as this happens at a hardware level.
You could create a ‘pre power down’ function which will happen upon pressing the ‘WAKE’ button and then write on the display something like ‘safe to power off’.
Here’s how to use the WAKE button (it’s GPIO36): Inkplate-Arduino-library/examples/Inkplate6FLICK/Advanced/DeepSleep/Inkplate6FLICK_Wake_Up_Button/Inkplate6FLICK_Wake_Up_Button.ino at master · SolderedElectronics/Inkplate-Arduino-library · GitHub
You could also do this with any other pin where you can use a button.