30 lines
1 KiB
Markdown
30 lines
1 KiB
Markdown
|
|
# Exercise 14: Power (Charging + Visual)
|
||
|
|
|
||
|
|
This exercise is intentionally narrow in scope:
|
||
|
|
- Detect if a battery is present.
|
||
|
|
- Detect if USB/VBUS power is present.
|
||
|
|
- Determine if charging is needed.
|
||
|
|
- Keep charging enabled through AXP2101 PMU settings.
|
||
|
|
- Flash the PMU charge LED while charging.
|
||
|
|
- If fully charged, leave LED off (do nothing).
|
||
|
|
|
||
|
|
OLED behavior:
|
||
|
|
- For the first 2 minutes after boot, OLED shows:
|
||
|
|
- `Exercise 14 Power`
|
||
|
|
- node name (`NODE_LABEL`)
|
||
|
|
- time (RTC/system time if available, else uptime)
|
||
|
|
- charging state and battery stats
|
||
|
|
- After 2 minutes, it switches to a steady `Power Monitor` header while continuing live stats.
|
||
|
|
|
||
|
|
## Meshtastic references used
|
||
|
|
- `src/Power.cpp`
|
||
|
|
- charging detection path (`isCharging()`, `isVbusIn()`, battery checks)
|
||
|
|
- `src/modules/StatusLEDModule.cpp`
|
||
|
|
- PMU charging LED control via `PMU->setChargingLedMode(...)`
|
||
|
|
|
||
|
|
## Build and upload
|
||
|
|
```bash
|
||
|
|
cd /usr/local/src/microreticulum/microReticulumTbeam/exercises/14_Power
|
||
|
|
pio run -e ed -t upload
|
||
|
|
pio device monitor -b 115200
|
||
|
|
```
|