8000 Screensaver while playing option / blank screen instead of clock options by trip5 · Pull Request #129 · e2002/yoradio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Screensaver while playing option / blank screen instead of clock options #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 16, 2025

Conversation

trip5
Copy link
Contributor
@trip5 trip5 commented Dec 29, 2024

Another pull request!

This adds an option to display the screensaver while music is playing. Timeout is measured in minutes -- to a maximum of 1080 minutes = 18 hours = 64800 seconds just to keep it as a uint_16 like the other. This time I followed your lead on adding this option to the WebUI.

By the way, I love how dense and modular this code is! It makes editing it a bit hard at first but clean and efficient!

I added a bit of enforcement to the screensaver timeout so the lowest setting possible for screensaver is 5 (seconds) and for screensaverPlaying is 1 (measured in minutes) (added enforcement to both html and cpp).

I also "fixed" the screensaver which was getting cut off if located too low on the display... but I'm not entirely certainly using dsp.plItemHeight was correct. I couldn't seem to find the pixel height of the clock font but on my small OLED, it looks like the playlist and clock use a similar enough font size.

In display.cpp: 537:

_clock.moveTo({clockConf.left, static_cast<uint16_t>(random(TFT_FRAMEWDT+clockConf.textsize, (dsp.height()-dsp.plItemHeight-TFT_FRAMEWDT*2))), 0});

Didn't want to edit the readme because I'm not sure what version number you'd like. Unfortunately, it means yet another full update.

### v0.9.xxx
**!!! a [full update](#update-over-web-interface) with Sketch data upload is required. After updating please press CTRL+F5 in browser !!!**
- added a setting that allows the screensaver to turn on while playing music [#xxx](https://github.com/e2002/yoradio/pull/xxx)

Relevant bits in script.js (4 lines added):

  if(typeof data.flip !== 'undefined'){
---clipped---
    if(typeof data.scre !== 'undefined') checkSelectSet("screensaverenabled",data.scre);
    if(typeof data.scrt !== 'undefined') document.getElementById("screensavertimeout").value=data.scrt;
    if(typeof data.scre !== 'undefined') checkSelectSet("screensaverblank",data.scrb);
    if(typeof data.scrpe !== 'undefined'
8000
) checkSelectSet("screensaverplayingenabled",data.scrpe);
    if(typeof data.scrpt !== 'undefined') document.getElementById("screensaverplayingtimeout").value=data.scrpt;
    if(typeof data.scre !== 'undefined') checkSelectSet("screensaverplayingblank",data.scrpb);
    return;

Edit/Addition:
Also added an option to completely blank the display for either screensaver option. I personally like the clock on when not playing but I use it at night when sleeping and my OLED is too bright so I can now just have it turn off after a minute.

BTW, next up I will try tackling the problem of time zones. I have a bit of experience with this one on other projects (I like clocks!), so it shouldn't add to much to the codebase (although may require another file in data. We should be able to use named TZs instead of UTC offfset... this is a bit of a selfish one because although I live in Korea right now, I'll be going back to Canada soon and Daylight Savings times is silly but a fact of life for most North Americans (and some Europeans).

@trip5 trip5 marked this pull request as draft December 30, 2024 09:49
@trip5
Copy link
Contributor Author
trip5 commented Dec 30, 2024

Actually, I'd like to make some further changes to this PR. The screensaver is nice but I wish it could go completely dark sometimes, too. My OLED is just too bright when trying to sleep.

@trip5
Copy link
Contributor Author
trip5 commented Dec 30, 2024

OK Additions to screensaver options added. UI Edited slightly to make room. First post edited to reflect changes.

image

@trip5 trip5 marked this pull request as ready for review December 30, 2024 10:23
@trip5 trip5 changed the title Screensaver while playing option Screensaver while playing option / blank screen instead of clock options Dec 30, 2024
@e2002 e2002 merged commit 98c005d into e2002:main Jan 16, 2025
@e2002
Copy link
Owner
e2002 commented Jan 16, 2025

@trip5
Good day! Changes were made as part of the update to 0.9.420. Thanks for the amazing code!

@trip5
Copy link
Contributor Author
trip5 commented Jan 16, 2025

Thank you. Good to hear!

@trip5 trip5 deleted the screensaver branch January 16, 2025 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0