Skip to content

Commit 9681dc0

Browse files
authored
Update InterruptButtonExample.ino
1 parent e8d5b17 commit 9681dc0

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

Examples/InterruptButtonExample.ino

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,21 @@ void IRAM_ATTR menu0Button1keyPress(void) { Serial.printf("Menu 0, Button
110110
void IRAM_ATTR menu0Button1longKeyPress(void) { Serial.printf("Menu 0, Button 1: Long Key Press: %lu ms\n", millis()); }
111111
void IRAM_ATTR menu0Button1autoRepeatPress(void) { Serial.printf("Menu 0, Button 1: Auto Repeat Key Press: %lu ms\n", millis()); }
112112
void IRAM_ATTR menu0Button1doubleClick(void) {
113-
Serial.printf("Menu 0, Button 1: Double Click: %lu ms - Changing to SYNCHRONOUS Mode and to Menu level ", millis());
114-
InterruptButton::setMode(Mode_Synchronous);
115-
InterruptButton::setMenuLevel(1);
116-
Serial.println(InterruptButton::getMenuLevel());
113+
Serial.printf("Menu 0, Button 1: Double Click: %lu ms - ", millis());
114+
switch(InterruptButton::getMode()){
115+
case Mode_Asynchronous:
116+
InterruptButton::setMode(Mode_Hybrid);
117+
Serial.println("Changing to HYBRID mode.");
118+
break;
119+
case Mode_Hybrid:
120+
InterruptButton::setMode(Mode_Synchronous);
121+
Serial.println("Changing to SYNCHRONOUS mode.");
122+
break;
123+
case Mode_Synchronous:
124+
InterruptButton::setMode(Mode_Asynchronous);
125+
Serial.println("Changing to ASYNCHRONOUS mode.");
126+
break;
127+
}
117128
}
118129

119130
// MENU 1 -----

0 commit comments

Comments
 (0)