Skip to content

Commit 6b1709a

Browse files
Add boot button attempt
Commented out because it doesn't work.
1 parent 412de8d commit 6b1709a

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

internal_filesystem/builtin/system/button.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,8 @@
77
import _thread
88

99
from mpos.apps import Activity, ActivityNavigator, Intent
10-
1110
from mpos.bootloader import ResetIntoBootloader
1211

13-
#import mpos.config
14-
#import mpos.ui
15-
16-
#import mpos.apps
17-
1812
# Configure IO0 as input with pull-up resistor
1913
button = Pin(0, Pin.IN, Pin.PULL_UP)
2014

@@ -26,8 +20,6 @@
2620
# Timer for checking long press
2721
timer = Timer(-1)
2822

29-
30-
3123
def on_long_press(t): # Callback for when long press duration is reached.
3224
print("button.py: long press detected")
3325
global timer

internal_filesystem/lib/mpos/ui/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,12 @@ def poweroff_cb(e):
369369
if sys.platform == "esp32":
370370
#On ESP32, there's no power off but there is a forever sleep
371371
import machine
372+
# DON'T configure BOOT button (Pin 0) as wake-up source because it wakes up immediately.
373+
# Luckily, the RESET button can be used to wake it up.
374+
#wake_pin = Pin(0, machine.Pin.IN, machine.Pin.PULL_UP) # Pull-up enabled, active low
375+
#import esp32
376+
#esp32.wake_on_ext0(pin=wake_pin, level=esp32.WAKEUP_ALL_LOW)
377+
print("Entering deep sleep. Press BOOT button to wake up.")
372378
machine.deepsleep() # sleep forever
373379
else: # assume unix:
374380
lv.deinit() # Deinitialize LVGL (if supported)

0 commit comments

Comments
 (0)