Skip to content

Commit

Permalink
feat: change long press config buttion's action
Browse files Browse the repository at this point in the history
  • Loading branch information
DriftKingTW committed Dec 9, 2023
1 parent 45fa527 commit 902822b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -893,18 +893,18 @@ void loop() {
while (digitalRead(CFG_BTN_PIN_1) == ACTIVE) {
delay(10);
if (longPressCounter > 100) {
switchBootMode();
goSleeping();
}
longPressCounter++;
}
isCaffeinated = !isCaffeinated;
isOutputLocked = !isOutputLocked;
} else if (digitalRead(CFG_BTN_PIN_2) == ACTIVE) {
resetIdle();
int longPressCounter = 0;
while (digitalRead(CFG_BTN_PIN_2) == ACTIVE) {
delay(10);
if (longPressCounter > 100) {
goSleeping();
switchBootMode();
}
longPressCounter++;
}
Expand Down Expand Up @@ -1464,7 +1464,8 @@ void switchBootMode() {
*/
void checkIdle() {
if (!isCaffeinated &&
currentMillis - sleepPreviousMillis > SLEEP_INTERVAL) {
currentMillis - sleepPreviousMillis > SLEEP_INTERVAL &&
getUSBPowerState()) {
goSleeping();
} else if (!isCaffeinated &&
currentMillis - sleepPreviousMillis > SCREEN_SLEEP_INTERVAL) {
Expand Down

0 comments on commit 902822b

Please sign in to comment.