antiprism / mpd_oled

MPD, Volumio, RuneAudio and Moode OLED status and spectrum display for Raspberry Pi (and similar)
Other
168 stars 46 forks source link

screensaver option #23

Closed nocturneop15 closed 1 year ago

nocturneop15 commented 5 years ago

Hello again, I tried to implement screensaver by entering -S parameter to mpd_oled. I had a partial success, but now, I'm stuck and kindly asking for help

Basic idea was simple - if player is stopped, paused (or unknown) and -S parameter provided, mpd_oled should draw "draw_screensaver" function instead of "draw_clock".

-S parmeter should toggle "screensaver" variable to "true", which initialy set to "false"

My problem is - it does not switch it. When I compile it with "true", it works as expected, but I cannot get switching by parameter working. I think this will only need some small tweak, but this is my first try to programming and I still do not understand all syntaxes fully.

main.cpp: main.txt

Maybe you can find this usefull too. It willl save OLED display life, and also provide darkness for sleeping if you have your player in a bedroom.

antiprism commented 5 years ago

Hi

You could (untested) define the draw display function like this

void draw_display(ArduiPi_OLED &display, const display_info &disp_info, bool screensaver)

and use the screensaver variable in the function to test if the screensaver is being used. Call it, in start_idle_loop(), like this

draw_display(display, disp_info, opts.screensaver);

I have easily visible screen burn on my display, but I like having the clock.

Adrian.

nocturneop15 commented 5 years ago

Thanks, I was so close :-D

Now, it works as expected, when -S is defined, display is black when nothing is playing. If -S parameter is not there, it behaves as usual, clock is displayed together with connection details

main.txt

I'm not sure how such unauthorized code changes should be handled, I hope it is OK to post this here with my changes.

For the future, I think about having multiple screensaver options:

I live in a deep forrest, so I like enjoying absolute darkness, absolute silence - and if - absolute quality sound of my music :-)

antiprism commented 5 years ago

Hi

It is fine to post specific code changes here. For ongoing or more general changes, it is better to share them through a fork of the project.

Sounds like you have an ideal listening environment!

Adrian.

antiprism commented 1 year ago

Closing. Collecting screensaver issues in https://github.com/antiprism/mpd_oled/issues/72