Skip to content

Commit

Permalink
feat: long press function for config buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
DriftKingTW committed Dec 9, 2023
1 parent 5f5a2d7 commit 45fa527
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,16 +889,26 @@ void loop() {
// Read CFG Buttons
if (digitalRead(CFG_BTN_PIN_1) == ACTIVE) {
resetIdle();
switchBootMode();
int longPressCounter = 0;
while (digitalRead(CFG_BTN_PIN_1) == ACTIVE) {
delay(10);
if (longPressCounter > 100) {
switchBootMode();
}
longPressCounter++;
}
isCaffeinated = !isCaffeinated;
} else if (digitalRead(CFG_BTN_PIN_2) == ACTIVE) {
resetIdle();
isUsbMode = !isUsbMode;
int longPressCounter = 0;
while (digitalRead(CFG_BTN_PIN_2) == ACTIVE) {
delay(10);
if (longPressCounter > 100) {
goSleeping();
}
longPressCounter++;
}
isUsbMode = !isUsbMode;
}
}

Expand Down

0 comments on commit 45fa527

Please sign in to comment.