Z-Bolt / OctoScreen

LCD touch interface for our OctoPrint
GNU Affero General Public License v3.0
716 stars 118 forks source link

Backlite through GPIO #357

Open AstroxV opened 1 year ago

AstroxV commented 1 year ago

I have this display: https://www.waveshare.com/wiki/3.5inch_RPi_LCD_(C)

I have OctoScreen running but when the screen goes into sleep mode (i adjusted disableblankscreen.sh), the backlite remains on since it's not working with the dpms functions. Now in the documentation of the display it says you should use GPIO to control the backlite.

Is there somehow I can make OctoScreen make a command run when the screensaver kicks in? I can make a script running to check if the display is on or not and make it run the GPIO status, but thats a dirty sollution, haveing the script loop every second or so to check the status of the display and adjust the GPIO.

Hope someone can help me with this. I looked through the source code but haven't found anything yet I can adjust to make this work.

ArcAIN6 commented 4 months ago

Because the disablescreenblank.sh is just a shell script, you should be able execute a python script from within it.

Easiest way i can see, is to create two python scripts using gpiozero library, one for on, one for off.. then use an if/else in the shell script to run either one depending on if the screen is supposed to be off / on