mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Improve button response times (100ms filter)
This commit is contained in:
@@ -21,7 +21,7 @@ struct {
|
|||||||
uint32_t SleepTemp; //temp to drop to in sleep
|
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 version; //Used to track if a reset is needed on firmware upgrade
|
||||||
uint8_t SleepTime; //minutes timeout to sleep
|
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 movementEnabled:1; //If movement is enabled
|
||||||
uint8_t displayTempInF:1; //If we need to convert the C reading to F
|
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
|
uint8_t flipDisplay:1; //If true we want to invert the display for lefties
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
void ProcessUI() {
|
void ProcessUI() {
|
||||||
uint8_t Buttons = getButtons(); //read the buttons status
|
uint8_t Buttons = getButtons(); //read the buttons status
|
||||||
static uint32_t lastModeChange = 0;
|
static uint32_t lastModeChange = 0;
|
||||||
if (millis() - getLastButtonPress() < 200)
|
if (millis() - getLastButtonPress() < 100)
|
||||||
Buttons = 0;
|
Buttons = 0;
|
||||||
//rough prevention for de-bouncing and allocates settling time
|
//rough prevention for de-bouncing and allocates settling time
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ void ProcessUI() {
|
|||||||
resetLastButtonPress();
|
resetLastButtonPress();
|
||||||
resetButtons();
|
resetButtons();
|
||||||
} else if (Buttons == (BUT_A | BUT_B)) {
|
} 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
|
//Both buttons were pressed, exit back to the cooling screen
|
||||||
operatingMode = COOLING;
|
operatingMode = COOLING;
|
||||||
resetLastButtonPress();
|
resetLastButtonPress();
|
||||||
@@ -66,7 +66,7 @@ void ProcessUI() {
|
|||||||
resetButtons();
|
resetButtons();
|
||||||
lastModeChange = millis();
|
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);
|
int32_t newOutput = computePID(systemSettings.SolderingTemp);
|
||||||
|
|
||||||
setIronTimer(newOutput);
|
setIronTimer(newOutput);
|
||||||
@@ -87,7 +87,7 @@ void ProcessUI() {
|
|||||||
} else {
|
} else {
|
||||||
//we check the timeout for how long the buttons have not been pushed
|
//we check the timeout for how long the buttons have not been pushed
|
||||||
//if idle for > 3 seconds then we return to soldering
|
//if idle for > 3 seconds then we return to soldering
|
||||||
if (millis() - getLastButtonPress() > 3000) {
|
if (millis() - getLastButtonPress() > 2000) {
|
||||||
operatingMode = SOLDERING;
|
operatingMode = SOLDERING;
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
@@ -96,8 +96,6 @@ void ProcessUI() {
|
|||||||
case SETTINGS:
|
case SETTINGS:
|
||||||
//Settings is the mode with the most logic
|
//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
|
//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) {
|
if (Buttons & BUT_A) {
|
||||||
resetLastButtonPress();
|
resetLastButtonPress();
|
||||||
|
|||||||
Reference in New Issue
Block a user