diff options
author | Ben V. Brown <[email protected]> | 2017-05-15 23:19:56 +1000 |
---|---|---|
committer | Ben V. Brown <[email protected]> | 2017-05-15 23:19:56 +1000 |
commit | fcaf909a546278a0823781fce4afa6d2c1b32f40 (patch) | |
tree | e373d03512f640638cf93f7b89109d042e8295c4 | |
parent | 9b51750a1d5a88a8bd92dcb7e98e514a32296bc4 (diff) | |
download | IronOS-fcaf909a546278a0823781fce4afa6d2c1b32f40.tar.gz IronOS-fcaf909a546278a0823781fce4afa6d2c1b32f40.zip |
Improve button response times (100ms filter)
-rw-r--r-- | workspace/ts100/inc/Settings.h | 2 | ||||
-rw-r--r-- | workspace/ts100/src/Modes.c | 10 |
2 files changed, 5 insertions, 7 deletions
diff --git a/workspace/ts100/inc/Settings.h b/workspace/ts100/inc/Settings.h index ec162cf6..25db9f15 100644 --- a/workspace/ts100/inc/Settings.h +++ b/workspace/ts100/inc/Settings.h @@ -21,7 +21,7 @@ struct { uint32_t SleepTemp; //temp to drop to in sleep uint8_t version; //Used to track if a reset is needed on firmware upgrade uint8_t SleepTime; //minutes timeout to sleep - uint8_t cutoutVoltage:1; //The voltage we cutout at for undervoltage + uint8_t cutoutVoltage:5; //The voltage we cutout at for undervoltage uint8_t movementEnabled:1; //If movement is enabled uint8_t displayTempInF:1; //If we need to convert the C reading to F uint8_t flipDisplay:1; //If true we want to invert the display for lefties diff --git a/workspace/ts100/src/Modes.c b/workspace/ts100/src/Modes.c index d04098fc..8fab17e4 100644 --- a/workspace/ts100/src/Modes.c +++ b/workspace/ts100/src/Modes.c @@ -9,7 +9,7 @@ void ProcessUI() { uint8_t Buttons = getButtons(); //read the buttons status static uint32_t lastModeChange = 0; - if (millis() - getLastButtonPress() < 200) + if (millis() - getLastButtonPress() < 100) Buttons = 0; //rough prevention for de-bouncing and allocates settling time @@ -42,7 +42,7 @@ void ProcessUI() { resetLastButtonPress(); resetButtons(); } else if (Buttons == (BUT_A | BUT_B)) { - if (millis() - getLastButtonPress() > 1000) { + if (millis() - getLastButtonPress() > 500) { //Both buttons were pressed, exit back to the cooling screen operatingMode = COOLING; resetLastButtonPress(); @@ -66,7 +66,7 @@ void ProcessUI() { resetButtons(); lastModeChange = millis(); } - //If no buttons pushed we need to perform the PID loop for the iron temp + //Update the PID Loop int32_t newOutput = computePID(systemSettings.SolderingTemp); setIronTimer(newOutput); @@ -87,7 +87,7 @@ void ProcessUI() { } else { //we check the timeout for how long the buttons have not been pushed //if idle for > 3 seconds then we return to soldering - if (millis() - getLastButtonPress() > 3000) { + if (millis() - getLastButtonPress() > 2000) { operatingMode = SOLDERING; saveSettings(); } @@ -96,8 +96,6 @@ void ProcessUI() { case SETTINGS: //Settings is the mode with the most logic //Here we are in the menu so we need to increment through the sub menus / increase the value - if (millis() - getLastButtonPress() < 300) - return; if (Buttons & BUT_A) { resetLastButtonPress(); |