Fix #207 adjust OLED Brightness by attachDuringLongPress

adjust the OLED Brightness by "attachDuringLongPress" from "OneButton". It will cycle trough 0 to 254 as long as the button is pressed
This commit is contained in:
Professr
2020-06-22 12:03:26 -07:00
committed by Marlon Spangenberg
parent f1da6469a3
commit ec10e784e1
3 changed files with 59 additions and 1 deletions

View File

@@ -136,6 +136,9 @@ Periodic ledPeriodic(ledBlinker);
void userButtonPressed() {
powerFSM.trigger(EVENT_PRESS);
}
void userButtonPressedLong(){
screen.adjustBrightness();
}
#ifndef NO_ESP32
void initWifi()
@@ -197,10 +200,12 @@ void setup()
#ifdef BUTTON_PIN
userButton = OneButton(BUTTON_PIN, true, true);
userButton.attachClick(userButtonPressed);
userButton.attachDuringLongPress(userButtonPressedLong);
#endif
#ifdef BUTTON_PIN_ALT
userButtonAlt = OneButton(BUTTON_PIN_ALT, true, true);
userButtonAlt.attachClick(userButtonPressed);
userButton.attachDuringLongPress(userButtonPressedLong);
#endif
#ifdef LED_PIN
pinMode(LED_PIN, OUTPUT);