Skip to content

Commit

Permalink
Added blank screen (low power mode) setting to default screensaver.
Browse files Browse the repository at this point in the history
  • Loading branch information
mickelson committed Jan 10, 2017
1 parent 8f9f5f5 commit 26112f0
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion config/screensaver/screensaver.nut
Expand Up @@ -24,6 +24,9 @@ class UserConfig {

</ label="Preserve Aspect Ratio", help="Preserve the aspect ratio of screensaver snaps/videos", options="Yes,No", order=7 />
preserve_ar="No";

</ label="Blank Screen Time", help="Minutes before switching to blank screen (low power) mode. Set this to 0 to disable.", order=8 />
blank_time="120";
}

local actual_rotation = (fe.layout.base_rotation + fe.layout.toggle_rotation)%4;
Expand Down Expand Up @@ -652,12 +655,27 @@ local first_time = true;

fe.add_ticks_callback( "saver_tick" );

local blank_time = 0;
try { blank_time = config[ "blank_time" ].tointeger() * 60000; } catch (e) {};

local do_blank=false;

//
// saver_tick gets called repeatedly during screensaver.
// stime = number of milliseconds since screensaver began.
// ttime = number of milliseconds since screensaver began.
//
function saver_tick( ttime )
{
if ( do_blank )
return;

if ( blank_time && ( ttime > blank_time ))
{
current_mode.reset();
do_blank = true;
return;
}

if ( first_time ) // special case for initializing the very first mode
{
current_mode.init( ttime );
Expand Down

0 comments on commit 26112f0

Please sign in to comment.