How is the M5StickC Plus 2 turned off in the User Demo?
-
Hello everyone,
I am enjoying using my M5StickC Plus 2 since I found the User Demo (https://github.com/m5stack/M5StickCPlus2-UserDemo) and started modifying it for my needs.
Everything works flawlessly but I don't understand how the device is turned off.
I think the function
void TEST::power_off()
in test.cpp does the magic (it no longer works when I comment it out along with its declaration in test.h) but I don't see it being called.
Sorry for the rookie question. I tried searching and was unable to find anything useful so far.
Thanks a lot,
Ben
-
Hello @foudrou
there is an alternate way which can turn off the device: if
is_test_mode
istrue
then at the end oftest_loop()
rtc_wakeup_test()
is called which at the end setsPOWER_HOLD_PIN
toLOW
turning off the device.Note: not sure why it doesn't work when you comment out
power_off()
function as I also don't see it being called anywhere either.Thanks
Felix -
Thanks @felmue,
I'll continue to play around with the demo to get a better grasp of it.
If anyone has another (ideally PlatformIO-based) demo to propose I will have a look at it.
Thanks again,
Ben
-
Hello @foudrou
M5StickCPlus2 has dedicated hardware (U8 etc.) to power off when the power button is pressed and hold. See schematic here.
Instead of setting
POWER_HOLD_PIN
low, the power off hardware pulls 3V3EN low which disables the 3.3 V DC/DC converter and thus killing the power to the ESP32.Note: when the power button is hold long enough you'll see the green LED being turned on, indicating that 3V3EN is low.
Note: power off only works when run from battery.
Thanks
Felix