diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2015-06-09 14:02:21 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2015-06-09 14:02:21 +0200 |
commit | 3f861e826d621d43bd05a54dd034c517a999beed (patch) | |
tree | 2e581b43b58382dd75ff8be951de81bcf42711f1 | |
parent | 7ef723e1c217652d6b329faa6aa3120fbd91d24c (diff) | |
download | hourglass-3f861e826d621d43bd05a54dd034c517a999beed.tar.gz hourglass-3f861e826d621d43bd05a54dd034c517a999beed.tar.bz2 hourglass-3f861e826d621d43bd05a54dd034c517a999beed.zip |
Disable PWM in idle state
Reduces power consumption
-rw-r--r-- | ui.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -34,8 +34,6 @@ THE SOFTWARE. #include "timer.h" #include "pwm.h" -#define sign(x) ((x < 0) ? -1 : 1) - /* keep the lights on for 10 ms */ #define FLASH_ALARM_ON ((uint32_t) 10*1000) /* and wait 500 ms */ @@ -131,13 +129,12 @@ static int16_t limits (const int16_t in, const int16_t min, const int16_t max) { } } -/* Enter idle mode +/* Enter low-power idle mode */ static void enterIdle () { mode = UIMODE_IDLE; - pwmSetOff (); - pwmSet (horizonLed (0), 1); + pwmStop (); } static void enterFlash (const flashmode next) { @@ -268,10 +265,12 @@ static void doIdle () { const uint32_t brightnessStep = timerValue/(uint32_t) ((PWM_LED_COUNT-1)*PWM_MAX_BRIGHTNESS); mode = UIMODE_RUN; + pwmStart (); timerStart (brightnessStep, false); speakerStart (SPEAKER_BEEP); } else if (accelGetShakeCount () >= 1) { /* set timer */ + pwmStart (); accelResetShakeCount (); enterFlash (FLASH_ENTER_COARSE); return; |