Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Solved: Screen not blanking while play
#1
Hi

It seems, that the option screensaver timeout is disabled while the player is running.
Only when not playing anything the display blanks.

Is it possible to change this behaviour by enable screensaver all the time?
Furthermore would it be possible to dim the display after some time? (instead of blanking it)

I am using a DSI display which has the possibility to adjust brightness.
(brightness adjust utility works on RaspiOS desktop so far)

-Felix
Reply
#2
Yes, when music starts playing the auto-screenblank is cancelled because in the general usage scenario its useful to be able to see whats playing, how much time is left, whats next in the Queue etc. Auto-dimming if it were possible would also need to be cancelled to satisfy this scenario.

Theres a brightness option in Peripheral Config for DSI displays. It should work as long as the display uses the same system parameter for brightness as does the Pi Touch 1 or 2.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
(02-03-2025, 07:23 PM)Tim Curtis Wrote: Yes, when music starts playing the auto-screenblank is cancelled because in the general usage scenario its useful to be able to see whats playing, how much time is left, whats next in the Queue etc. Auto-dimming if it were possible would also need to be cancelled to satisfy this scenario.

Theres a brightness option in Peripheral Config for DSI displays. It should work as long as the display uses the same system parameter for brightness as does the Pi Touch 1 or 2.

Well the brightness option does not work in my case with that Waveshare 7.9" display.

To solve my problem a handy script inserted in /etc/rc.local helped.

Code:
#!/bin/bash
#dim_display.sh - look play status and dim display after 60 Sec. to conserve local display

DELAY=60
TIMER=$DELAY
DIMMED=80

while sleep 1;
do
    # check if any input piped in
    if IFS= read -d '' -n1 -t 0.01; then
            # echo 'Not empty!'
              while IFS= read -r -t 0.01;
              do
            # echo "$REPLY"
            if [[ $REPLY == *"RawTouchBegin"* ]]; then
                         # echo "Touch Event"
                      # in any case reset timeout and max brightness
                  TIMER=$DELAY
                  echo 255 > /sys/class/backlight/10-0045/brightness
              fi
              done
      fi

    
    DIMSTATE=$(cat /sys/class/backlight/10-0045/brightness )
    STATUS=$(mpc status)
    if [[ $STATUS = *"playing"* ]];
    then
        # echo "is playing"
        if [[ $DIMSTATE -eq 255 ]];
        then
            # echo "not dimmed"
            if [[ $TIMER -gt 0 ]];
            then
                # echo "decrement timer $TIMER"
                TIMER=$((TIMER-1))
            else
                # echo "dim display"
                echo $DIMMED > /sys/class/backlight/10-0045/brightness
            fi
        fi
    else
        # echo "not playing"
        if (( DIMSTATE < 255 ));
        then
            # echo "reset dimmed"
            TIMER=$DELAY
            echo 255 > /sys/class/backlight/10-0045/brightness
        fi
    fi
done

One needs to install xinput tool
$ sudo apt-get install xinput

In /etc/rc.local insert this command to the end before exit 0

Code:
# this handles display brightness
DISPLAY=:0.0 xinput --test-xi2 --root | /home/moode/dim_display.sh 2>&1 &

So when moode is playing the display dims after 60 seconds. Any touch event will return to max brightness
If moode is not playing then display blanks after time set in peripherial configuration. Again any touch event makes display visible.

This is a little bit clumpsy solution, but works perfectly for me. 

Regards
Felix
Reply
#4
Does the touch that restores brightness also register as control touch. By that I mean if you touch to restore brightness and that touch is also on the volume wheel, does the volume change, for example?
----------------
Robert
Reply
#5
(02-05-2025, 09:11 AM)the_bertrum Wrote: Does the touch that restores brightness also register as control touch.  By that I mean if you touch to restore brightness and that touch is also on the volume wheel, does the volume change, for example?

Yes of course, because the xinput tool monitors any input event going to the x.org server. So the script reacts on all touch (exactly 'RawTouchBegin') events no matter where on the display they occur without interrupt the event itself.
Reply
#6
(02-05-2025, 09:21 AM)felix1024 Wrote:
(02-05-2025, 09:11 AM)the_bertrum Wrote: Does the touch that restores brightness also register as control touch.  By that I mean if you touch to restore brightness and that touch is also on the volume wheel, does the volume change, for example?

Yes of course, because the xinput tool monitors any input event going to the x.org server. So the script reacts on all touch (exactly 'RawTouchBegin') events no matter where on the display they occur without interrupt the event itself.

I thought it might.  There was talk a while back about the desirability of a "wake up" touch that was independent of any "control" touch so I was speculating this might be a way into that.
----------------
Robert
Reply


Forum Jump: