0

I've got a touch screen without backlight control and and turning off the HDMI-output just brings up a "no signal" placeholder on the screen.

I've soldered a octocoupler to the power toggle to control it via the GPIO-pins and that works fine.

What I would like to do is to toggle a shell script (screen_toggle.sh) everytime the Pi changes DPMS state. I.e as soon as DMPS blanks the screen the screen_toggle.sh would be triggered, and as soon as mouse (touch) input is registered screen_toggle.sh would be triggered again to wake the screen.

Anyone with ideas on how to get this working?

1 Answer 1

0

Got it working by doing the following for anyone coming here searching a solution to the same problem with the Sunfunder 10 inch touchscreen.

#!/bin/bash

idletime=60000 # in milliseconds
screen_toggle=1

while true; do
    idle=`xprintidle`
    #echo $idle >> /home/pi/idle.log
    if [ "$idle" -gt "$idletime" ] && [ "$screen_toggle" == 1 ]
    then
      screen_toggle=0
      source /home/pi/screen_switch.sh
      echo "Turned off" >> /home/pi/screen_check.log
    elif [ "$idle" -lt "$idletime" ] && [ "$screen_toggle" == 0 ]
      then
        screen_toggle=1
        source /home/pi/screen_switch.sh
        echo "Turned on" >> /home/pi/screen_check.log
    fi
    sleep 1
done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.