aboutsummaryrefslogtreecommitdiff
path: root/ui.c
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2014-12-09 13:20:06 +0100
committerLars-Dominik Braun <lars@6xq.net>2014-12-09 13:20:06 +0100
commitbb7c465741fa70c8b52792ec12ded7af52056cd0 (patch)
tree5b25425f423b9b839b15b79536b70d892717f540 /ui.c
parent254fb0c490c62c0e29518cab2d8b5c90a30b378c (diff)
downloadhourglass-bb7c465741fa70c8b52792ec12ded7af52056cd0.tar.gz
hourglass-bb7c465741fa70c8b52792ec12ded7af52056cd0.tar.bz2
hourglass-bb7c465741fa70c8b52792ec12ded7af52056cd0.zip
gyro: non-blocking start/stop, enable only when required
Save energy by disabling the gyro most of the time (i.e. not in selection mode).
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ui.c b/ui.c
index df01127..e677075 100644
--- a/ui.c
+++ b/ui.c
@@ -156,6 +156,7 @@ static void doSelectFine () {
/* stop selection */
accelResetShakeCount ();
speakerStart (SPEAKER_BEEP);
+ gyroStop ();
puts ("selectfine->idle");
enterIdle ();
@@ -201,6 +202,7 @@ static void doIdle () {
} else if (accelGetShakeCount () >= 2) {
/* set timer */
accelResetShakeCount ();
+ gyroStart ();
mode = UIMODE_SELECT_COARSE;
puts ("idle->select");
speakerStart (SPEAKER_BEEP);
@@ -345,7 +347,6 @@ void uiLoop () {
for (uint8_t i = 0; i < PWM_LED_COUNT; i++) {
pwmSet (i, PWM_ON);
}
- gyroStart ();
pwmSet (0, PWM_OFF);
accelStart ();
pwmSet (1, PWM_OFF);