I read from C++ code there's an AXP command to go into light sleep. How does one do a similar call in Python?
Ref: https://github.com/m5stack/M5StickC/blob/master/examples/Advanced/AXP192/sleep/sleep.ino
I read from C++ code there's an AXP command to go into light sleep. How does one do a similar call in Python?
Ref: https://github.com/m5stack/M5StickC/blob/master/examples/Advanced/AXP192/sleep/sleep.ino
@nirvana07 I would suggest you:
No free lunch here. As newbie you should be prepared to invest time into this.
Is there any way to program StickC to wake up when it moved eg. picked up? Maybe some behavior from the IMU waking up deep sleep? I'm open for anything.
@davesee I heard about setting a flag on movement detected, written at the C level. Hoping to avoid that level of coding. Will forward your link to my (volunteer) team who do C coding if they can confirm your design.
Battery runs out fast with current drain at about 50mAh if Get VBus Current is accurate. Looking to make it last longer with regular sleep intervals. How can this be done either in Python or UiFlow?
@davesee I heard about setting a flag on movement detected, written at the C level. Hoping to avoid that level of coding. Will forward your link to my (volunteer) team who do C coding if they can confirm your design.
@thrasher I especially like the reference to his github repo for compatible libraries to be used on generic upython firmware: https://github.com/lukasmaximus89/M5Stick-C-Micropython-1.12
@m5stack By GA I mean Generally Available. As in out of beta, ready for production use.
@m5stack I will share pseudo-codes of the current implementation, which is stable so far:
CycleTimer = Timer(-1)
def main():
# init and connect mqtt client
doCycle()
def doCycle():
global CycleTimer
# send stuff from mqtt
# NOTE: do not use machine.lightsleep() as publish() is NOT synchronous
# lightsleep() will block data from being sent
CycleTimer.init(period=5000, mode=Timer.ONE_SHOT, callback=doCycle)
NOTE: this is power-intensive; calling lightsleep() will cause uiflow's mqtt client to crash quickly.
Am trying using ONE_SHOT timers. Not sure if this is the recommended approach.
Looking to write code that will send data via mqtt perpetually. Learn recently that the publish() method is NOT synchronous, which I augmented by listening to a topic for an ack message before calling the iteration done, and the next iteration publish begins.
So I tried to close the loop by calling the publish() method within the subscribe() handler, and the app crashed with message 'RuntimeError: maximum recursion depth exceeded'.
How do people get around this?
@nirvana07 I would suggest you:
No free lunch here. As newbie you should be prepared to invest time into this.
Is there any way to program StickC to wake up when it moved eg. picked up? Maybe some behavior from the IMU waking up deep sleep? I'm open for anything.
When you connect to the PC does it detect a device? Hopefully it's just the screen that blew.
I put my M5StickC to sleep after .publish() and data was never received on the server. Is there a way to confirm data receipt, maybe through a callback or some other indicator?