I have a li-po battery hooked up to the battery port on my Argon, but I don’t want to have to unplug my battery every time I want to turn off my Argon to conserve battery power. If I wanted to unplug the battery I would have to remove a lot of hardware in order to get to the Argon, and then put the hardware back once I unplugged it, which takes a pretty long time. Is there any way I can program the Argon to stop using battery power when a button is pushed?
If you have access to the MODE button you can tap it twice to enter soft power off mode. Tapping RESET will wake up the device. This uses SLEEP_MODE_DEEP. You can also do this from user firmware for a different button and calling System.sleep.
For devices with the bq24195 PMIC (Boron, Tracker SoM, Electron, E Series) there’s another option to disconnect the battery in software using BATFET. This is known as shipping mode on the Tracker SoM, but it’s not available on the Argon (no PMIC). Also it requires connecting to an external power supply to wake, but devices can last many months in shipping mode.
So, I’ve been looking at the reference sheets for a while now, but I still can’t figure out how exactly I can program a way to use an external button (as in not the RESET button) to toggle Sleep Mode? Can you help me out or give me some example code to learn from?
If you are using the MODE button sleep, the only way to wake from a button is to wire it to reset. Just connect the button between RST and GND. It’s safe to do that.
If you are using
System.sleep from code to sleep, use one of the variations that takes a pin, that’s the pin you’ll use for your wakeup pin.