A Connect IQ widget for Garmin Instinct 2/3 watches that logs battery level in the background and shows drain history, rate, time-remaining, and a drain breakdown by inferred state. Fills the gap left by Garmin's Battery Manager, which isn't available on the Instinct series.
Install from the Connect IQ Store
- Glance: current %, drain rate, estimated time remaining
- 3-day / 2-week graphs: battery level history (sampled every 30 min, 2 weeks retained)
- Since charge: graph + elapsed time, total drain, and average rate since the last charge
- Drain by state: Connect IQ exposes no per-feature power data, so drain is attributed to inferred states instead — sleep (profile sleep window), active (activity timer or step delta), idle, charging. Resets on full charge. Scroll with UP/DOWN.
| File | Role |
|---|---|
source/BatteryApp.mc |
AppBase: registers the background event, wires views |
source/BatteryService.mc |
Background service: samples battery every 30 min |
source/BatteryHistory.mc |
Chunked ring buffer in Storage + glance summary |
source/BatteryStates.mc |
State inference + per-state drain accumulators |
source/BatteryGlanceView.mc |
Glance (reads only the summary key) |
source/BatteryWidgetView.mc |
Paged full UI, graph renderer, rate fits |
source/DemoSeed.mc |
Demo-build only: seeds fake history for testing |
Constraints that shaped the design:
- Glance + background share a ~32KB memory budget on Instinct, so history is split into 7 Storage chunks (96 samples each — the background loads one, the glance loads none) and the glance renders from a small precomputed summary.
- Instinct 2 (API 3.4) predates
WatchUi.getSubscreen, so the subscreen circle bounds are hardcoded from the device profiles; the semi-octagon display's cut corners constrain where text can go.
Requires the Connect IQ SDK (device files + simulator fonts downloaded — fonts matter, the simulator segfaults without them) and a developer key:
openssl genrsa -out developer_key.pem 4096
openssl pkcs8 -topk8 -inform PEM -outform DER -in developer_key.pem \
-out developer_key.der -nocryptRelease build:
monkeyc -d instinct2 -f monkey.jungle -y developer_key.der -o bin/garmin-battery.prgSideload: plug the watch in via USB and copy the .prg to /GARMIN/APPS/.
The demo variant seeds two weeks of fake history, skips the glance, and auto-advances through every page and scroll position so the UI can be verified (or screenshotted) without button input:
monkeyc -d instinct2 -f demo.jungle -y developer_key.der -o bin/demo.prg
connectiq # launch the simulator
monkeydo bin/demo.prg instinct2Demo-only code is annotated (:demo), release-only code (:prod); each
jungle excludes the other's annotation.
Instinct 2 / 2S / 2X, Instinct 3 Solar 45mm, Instinct 3 AMOLED 45/50mm.
MIT © Rubens Farias