Bugzilla – Bug 9476
Display clock when pressing the snooze button
Last modified: 2008-12-15 12:40:15 UTC
From the forum : i have received my Boom and I love it. Except it seems to miss the only function it would need to replace my current alarm clock : - I prefer the dark, so when I sleep, the Boom screen is at its darkest setting - if I need to see the clock during the night, i have to power it up, it would be nice to be able to press the snooze button to display the time during 10s for example (using automatic brightness adjustment, to avoid getting blinded). http://forums.slimdevices.com/showthread.php?p=339695 Thanks :)
It already works this way! However, it seems that the DateTime screensaver breaks this if the the off screensaver is set to DateTime but brightness is set to Dark. We should fix this. For now, just set your off screensaver to None and it will work as you want.
Triode: the problem here is that the DateTime screensaver has its own snooze button behaviour. Could we fix this by simply making the screensaver not be pushed if the display brightness is dark or are there some non-display screensavers?
I'm missing something - why can't the fix be in the datetime screensaver? Do you want to see what it has in its handler - if so we need to add the brightness param to its showBriefly?
Should be easy to fix in the DateTime screensaver. However, we get the fix for free if the datetime screensaver isn't displayed in the first place. I was wondering if it might be a good idea in general to only start the screensavers and call their lines functions every second etc if they're actually being displayed. If this is fixed in datetime instead, its snooze button code needs to detect if brightness is zero and, if so, do a pushButton('datetime'). By default, datetime displays the next alarm when snooze is pushed.
Can't we just add something to display the clock to the Datetime button function - just duplicate the common one there. S:B:Screensaver already does far to much work in my view - testing the brightness and potentially pushing different screensaver modes is adding to this and will make it slower to react when someone pushes the brightness button in the datetime screensaver (potentially 1 second to change brightness as we would need to push a new mode)
Okay, I'll fix it in DateTime itself.
Created attachment 3987 [details] Display time when brightness is zero and always use DateTime if available The attached patch changes DateTime to display the time if brightness is zero when snooze is pushed. It also reworks the Common behaviour a little bit to make it use DateTime to generate the datetime lines if DateTime is available. This means that the time display now includes alarm info if snooze is pushed when the off screensaver is set to None. I'll give this a bit of testing, but I think it would then be worth including this in 7.2.1.
Looks good to me - I'd say put it in 7.2.1
Patch checked in as change 23173. It would be nice to be able to tap the snooze button again and have it display the next alarm time, just as DateTime does normally. Is there any way of telling when the showBriefly for the time is in effect? In other words, how would I know that I'm already displaying the time as a result of a snooze button press so should now display the next alarm time. Timers? Or is there a nicer way?
When you call showBriefly specify a 'name', you can then check if you are currently the owner of a showing showBriefly by checking $display->sbName to see if it is the one you set.
Created attachment 3991 [details] Toggle between time and next alarm when snooze is pushed repeatedly This patch lets you press snooze once to see time and then, if there's an alarm, a second press shows the next alarm time. It uses the DateTime plugin to do this and falls back to just a time display if its not available. Triode: I'm currently testing whether the datetime screensaver is active by seeing if S::B::C::mode($client) =~ /'\.datetime$'/. I understand that the mode could be /^[OFF|IDLE|PLAY].datetime$/. Should I test for this specifically or is there a better way to see if its active?
Max - as per comment on campfire, testing for *.datetime is fine The actual mode names are: (SCREEN|IDLE|OFF)SAVER\.datetime
Patch checked in as change 23189.
hi - quick question on this - does this work only for the boom? I have an SB3 w/ the latest 7.2.1 nightly and this doesn't work (pressing the sleep button). It would be nice to have this feature as I have a SB3 in my bedroom and have the same issue as the original post. thanks!
This only works on the Boom. It could probably me made to work on non-Booms by mapping sleep.single to snooze in off mode. You can try this yourself by editing IR/Default.map.
Thanks Max - I tried your suggestion, it works great! Could this be part of the official build? It seems useful. I removed the sleep.* line and put in the same as the snooze button in the default.map file: sleep.single = snooze sleep.hold = dead I know this bug is fixed, but a few other points I saw that would be nice to have included in this fix: 1. have the time show up even if the display is not 0(dark). I often have my bedroom SB set to dispay 1 when off, so I would like to be able to press sleep and have it brighten up to see better. (this could also be a user option). 2. have the time show up at max brightnes (not 'powerOn' brightness). When showing time w/ the sleep/snooze button, you can assume that a person would like to see it bright. Again, my bedroom SB 'powerOn' brightness is often 1, so pressing the sleep/snooze button and having its brightness 1 isn't all that useful. (this could also be a user option). I've made these changes in the Date/Time Plugin.pm file as below, I commented out the old code w/ '# slav' and the new line(s) follow. I'm not a programmer, so I'm sure the syntax/coding style isn't quite right, but it's working for me, thanks!: # Show time if it isn't already being displayed or it is but there's no next alarm # slav if (($currentMode !~ '\.datetime$' || $client->display->currBrightness() == 0) if (($currentMode !~ '\.datetime$' || $client->display->currBrightness() == 0 || $client->display->currBrightness() == 1 || $client->display->currBrightness() == 2 || $client->display->currBrightness() == 3) && ($currentSbName ne $sbName || ! $showAlarm)) { $client->showBriefly( dateTimeLines($client), { # slav 'brightness' => 'powerOn', 'brightness' => 4, 'duration' => 3, 'name' => $sbName, }); # display next alarm time if alarm is within the next 24h } elsif ($showAlarm) { my $line = $client->symbols('bell'); # Remove seconds from alarm time my $timeStr = Slim::Utils::DateTime::timeF($nextAlarm->time % 86400, $prefs->client($client)->timeformat, 1); $timeStr =~ s/(\d?\d\D\d\d)\D\d\d/$1/; $line .= " $timeStr"; # briefly display the next alarm $client->showBriefly( { 'center' => [ $client->string('ALARM_NEXT_ALARM'), $line, ] }, # slav { 'duration' => 3, 'brightness' => 'powerOn'}, { 'duration' => 3, 'brightness' => 4}, ); } }
Created attachment 4047 [details] changes to Date/Time Plugin.pm
Created attachment 4048 [details] change to Default.map to user sleep button as snooze
sorry - just say the option to add attachments added the proposed plugin.pm & default.map files (without the '# slav' comments like above). thx.
Verified with SqueezeCenter Version: 7.2.1 - 23502 slav, I suggest opening a new feature enhancement bug if you wish to see this functionality added to other players.
This bug has been fixed in the 7.3.0 release version of SqueezeCenter! Please download the new version from http://www.slimdevices.com/su_downloads.html if you haven't already. If you are still experiencing this problem, feel free to reopen the bug with your new comments and we'll have another look.