forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Milestone
Description
CircuitPython version
Adafruit CircuitPython 7.0.0-rc.1-62-gbe7d963a9-dirty on 2021-09-12; Adafruit MagTag with ESP32S2
Code/REPL
import alarm
import board
import digitalio
import neopixel
import time
import microcontroller
from adafruit_magtag.magtag import MagTag
print("Hello World!")
magtag = MagTag()
magtag.add_text(
text_scale=2,
text_wrap=25,
text_maxlen=300,
text_position=(10, 10),
text_anchor_point=(0, 0),
)
pause = alarm.time.TimeAlarm(
monotonic_time=time.monotonic() + 60
)
magtag.set_text(
"battery: {}V wake_alarm: {}".format(
magtag.peripherals.battery, repr(alarm.wake_alarm)
)
)
magtag.peripherals.deinit()
print("Sleeping in 5")
time.sleep(5)
print("sleeping..")
magtag.refresh()
button = alarm.pin.PinAlarm(pin=board.D15, value=False, pull=True)
alarm.exit_and_deep_sleep_until_alarms(pause, button)
Behavior
When plugged in to USB (and so the board only pretends to deep sleep), alarm.wake_alarm is set as expected to an instance of either TimeAlarm or PinAlarm. However, when running on battery, alarm.wake_alarm is always None when the above code runs upon wake, regardless of whether it was the pin or timer alarm that caused the wake.
Description
No response
Additional information
Thanks to @KeithTheEE for helping to validate this with me on discord.
joshuapinter