mirror of
https://github.com/nacabaro/nacapet.git
synced 2026-06-05 14:02:53 +00:00
Add ALLOW_SLEEP flag to enable sleep mode in inactivity checks
This commit is contained in:
parent
f15ea8190f
commit
3de6c121a5
@ -30,6 +30,7 @@ build_flags =
|
||||
-DBOARD_HAS_PSRAM
|
||||
-DARDUINO_USB_CDC_ON_BOOT=0
|
||||
-DDEV_UNIT
|
||||
-DALLOW_SLEEP
|
||||
-DDEBUG
|
||||
|
||||
upload_port = COM8
|
||||
@ -49,7 +50,9 @@ build_flags =
|
||||
-DBOARD_HAS_PSRAM
|
||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
-DARDUINO_USB_MODE=1
|
||||
-DALLOW_SLEEP
|
||||
-DDEV_UNIT
|
||||
-DDEBUG
|
||||
|
||||
board_build.partitions = default.csv
|
||||
lib_deps = TFT_eSPI, fbiego/ESP32Time@^2.0.6, electroniccats/MPU6050@^1.4.3
|
||||
|
||||
@ -16,9 +16,11 @@ bool k4_prev = HIGH;
|
||||
|
||||
void buttons_checkInactivity() {
|
||||
uint64_t currentTime = esp_timer_get_time();
|
||||
if (currentTime - lastPressedButtonTime > INACTIVITY_THRESHOLD_TIME_US && !screenOff) {
|
||||
if (currentTime - lastPressedButtonTime > INACTIVITY_THRESHOLD_TIME_US && !screenOff && !alwaysOnEnabled) {
|
||||
#ifdef ALLOW_SLEEP
|
||||
digitalWrite(BL_PIN, LOW);
|
||||
screenKey = OFF_SCREEN;
|
||||
#endif
|
||||
|
||||
} else if (currentTime - lastPressedButtonTime > LAST_PRESSED_BUTTON_THRESHOLD_TIME_US && !inactive) {
|
||||
screenKey = MAIN_SCREEN;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user