Browse Source

Adjust screen brightness at idle; use new kernel function for getting

actual time since last tick; decrease run interval (make shorter) when
waiting for tasks to shutdown
master
Adam Pippin 4 years ago
parent
commit
01da8bc03f
  1. 5
      PowerManagement.cpp

5
PowerManagement.cpp

@ -21,7 +21,7 @@ void sleep()
void idle() void idle()
{ {
power_state = POWER_STATE_IDLE; power_state = POWER_STATE_IDLE;
M5.Axp.ScreenBreath(7); M5.Axp.ScreenBreath(8); // 7-12
} }
void wake() void wake()
@ -41,7 +41,7 @@ int PowerManagement(int pid, unsigned int signal)
// Accumulate time every time we run // Accumulate time every time we run
if ((signal & SIGNAL_START) == 0 && signal & SIGNAL_TICK) if ((signal & SIGNAL_START) == 0 && signal & SIGNAL_TICK)
{ {
accumulator += Kernel_get_run_interval(pid); accumulator += Kernel_get_last_tick_duration();
} }
// But reset it whenever a button is pressed // But reset it whenever a button is pressed
@ -71,6 +71,7 @@ int PowerManagement(int pid, unsigned int signal)
} }
else else
{ {
Kernel_set_run_interval(pid, 50);
Kernel_signal(SIGNAL_STOP); Kernel_signal(SIGNAL_STOP);
} }
} }

Loading…
Cancel
Save