diff options
-rw-r--r-- | workspace/ts100/inc/Interrupt.h | 7 | ||||
-rw-r--r-- | workspace/ts100/src/Modes.c | 9 |
2 files changed, 10 insertions, 6 deletions
diff --git a/workspace/ts100/inc/Interrupt.h b/workspace/ts100/inc/Interrupt.h index ef0ed2fa..c7eba7c1 100644 --- a/workspace/ts100/inc/Interrupt.h +++ b/workspace/ts100/inc/Interrupt.h @@ -26,9 +26,9 @@ inline void resetLastButtonPress() { }
inline void resetButtons() {
- lastKeyPress = millis();
keyState = 0;
}
+
inline uint32_t getLastMovement() {
return lastMovement;
}
@@ -39,7 +39,10 @@ inline uint16_t getButtons() { inline uint16_t getRawButtons() {
return rawKeys;
}
-
+inline void restoreButtons()
+{
+ keyState=getRawButtons();
+}
/*IRQ prototypes*/
void NMI_Handler(void);
diff --git a/workspace/ts100/src/Modes.c b/workspace/ts100/src/Modes.c index 41e69fd9..8fba445c 100644 --- a/workspace/ts100/src/Modes.c +++ b/workspace/ts100/src/Modes.c @@ -22,13 +22,14 @@ uint32_t temporaryTempStorage = 0; void ProcessUI() { uint8_t Buttons = getButtons(); //read the buttons status static uint32_t lastModeChange = 0; - if (millis() - getLastButtonPress() < 30) + if (getRawButtons() && ((millis() - getLastButtonPress()) > 1000)) { + lastKeyPress = millis() - 600; + Buttons = getRawButtons(); + } else if (millis() - getLastButtonPress() < 80) { Buttons = 0; - else if (Buttons != 0) { - resetLastButtonPress(); + } else if (Buttons != 0) { resetButtons(); } - //rough prevention for de-bouncing and allocates settling time switch (operatingMode) { case STARTUP: |