Fix up down buttons incrementing decrementing values
authorJim Morris <morris@wolfman.com>
Mon, 1 Jul 2013 18:58:00 +0000 (11:58 -0700)
committerJim Morris <morris@wolfman.com>
Mon, 1 Jul 2013 18:58:43 +0000 (11:58 -0700)
src/modules/utils/panel/Panel.cpp

index 0b720d0..304f756 100644 (file)
@@ -200,15 +200,16 @@ void Panel::on_idle(void* argument){
 
 // Hooks for button clicks
 uint32_t Panel::on_up(uint32_t dummy){
-    // this is simulating encoder clicks, but as one press should move menu one
-    // we need to increment twice as two clicks are needed to move the menu once
-    // this needs to be configurable and tied to menu increment
-    *this->counter -= 1;
+    // this is simulating encoder clicks, but needs to be inverted to
+    // increment values on up
+    int inc= (this->mode == CONTROL_MODE) ? 1 : -1;
+    *this->counter += inc;
     this->counter_changed = true;
     return 0;
 }
 uint32_t Panel::on_down(uint32_t dummy){
-    *this->counter += 1;
+    int inc= (this->mode == CONTROL_MODE) ? -1 : 1;
+    *this->counter += inc;
     this->counter_changed = true;
     return 0;
 }