Commit graph

34 commits

Author SHA1 Message Date
GlassOnTin
b9319fa761 Fix deep sleep: remove PMU enableSleep, fix GPIO handling, add shared helper
Three critical fixes:
- Remove PMU->enableSleep() which bricked AXP2101 I2C across resets
- Remove I2C pins (GPIO 2/3) from OPEN_DRAIN list — gpio_reset_pin()
  already sets INPUT mode, and OPEN_DRAIN persists in battery-backed
  RTC domain, corrupting the I2C bus
- Use esp_reset_reason() == ESP_RST_DEEPSLEEP for reliable cold boot
  vs timer wake discrimination

Extracted twatch_enter_deep_sleep() shared helper used by both
sleep_now() and beacon_wake_cycle(). Adds co5300_sleep() call
before SPI.end() to properly shut down display controller.

Tested: sleep via long-press, wake via button, radio reconnects,
display re-initialises, I2C bus intact across multiple cycles.
2026-03-27 17:08:05 +00:00
GlassOnTin
999933386b Fix I2C bus failure — XPowersLib was using wrong default SDA/SCL pins
Root cause: XPowersAXP2101(Wire) constructor defaults to SDA=8, SCL=9
(from generic esp32s3 variant pins_arduino.h). Its begin() method then
calls Wire.begin(8, 9), overriding our Wire.begin(3, 2). All I2C
traffic went to the wrong GPIO pins.

Fix: pass explicit I2C_SDA, I2C_SCL to the XPowersAXP2101 constructor
so it uses GPIO 3/2 (the T-Watch Ultra's actual I2C pins).

Also removed I2C diagnostic/recovery code that was debugging the
wrong problem.
2026-03-27 16:31:10 +00:00
GlassOnTin
09d1f6409f Add R-Watch (T-Watch Ultra) board support with LoRa, GPS, PMU, RTC, and deep sleep
Board definition (BOARD_TWATCH_ULT = 0x45) for LilyGo T-Watch Ultra
with verified pin mapping from LilyGoLib hardware docs.

Working subsystems:
- SX1262 LoRa radio: online at 868 MHz, tested with rnsd/Reticulum
- AXP2101 PMU: all power rails configured, battery monitoring, charging
- MIA-M10Q GPS: UART at 38400 baud, TinyGPSPlus NMEA parsing
- PCF85063A RTC: time read/write, GPS sync infrastructure
- XL9555 GPIO expander: I2C driver, LoRa antenna switch
- BLE: initialized, KISS protocol responsive
- Deep sleep: button wake (PMU IRQ GPIO 7), timer wake for beacon
- Beacon sleep cycle: periodic wake for GPS beacon TX in standalone mode

New files:
- VISION.md: R-Watch product vision document
- XL9555.h: minimal I2C GPIO expander driver
- CO5300.h: QSPI AMOLED display driver (not yet functional)

Display driver (CO5300.h) is written but disabled (HAS_DISPLAY=false).
QSPI init succeeds but pixel writes don't reach the display controller.
Suspected XL9555/BHI260AP GPIO expander pin mapping issue under investigation.
2026-03-27 12:18:46 +00:00
GlassOnTin
033ddd6757 Add GPS beacon and LXMF telemetry for T-Beam Supreme and Heltec V4
Standalone GPS beacon mode: when no KISS host is connected for 15s,
the RNode transmits position and battery telemetry over LoRa.

Two beacon paths:
- LXMF (recommended): encrypted per-packet messages with announces,
  compatible with Sideband and any LXMF application. Supports IFAC
  network authentication.
- Legacy JSON: plaintext or encrypted raw packets for simple collectors.

Key changes:
- GPS support for T-Beam Supreme S3 (L76K) and Heltec V4 (external)
- SX1262 radio fixes: IQ polarity, DCD preamble lockup, RX reliability
- LXMF identity management with NVS-backed Ed25519/X25519 keys
- IFAC authentication (CMD_IFAC_KEY 0x89) for private networks
- Per-channel serial isolation (USB, BLE, WiFi)
- GPS status page in OLED display rotation
- Provisioning via rnlog: provision-lxmf, provision-ifac
- Documentation in Documentation/BEACON.md
2026-03-12 17:01:29 +00:00
Mark Qvist
aa852f4aed Fixed device name offset in display 2025-11-14 01:16:38 +01:00
Mark Qvist
89ea59bbe6 Added CPU temperature measurement and reporting on ESP32S3 2025-11-10 16:39:09 +01:00
Mark Qvist
8a3db4f0c3 Cleanup 2025-11-10 15:50:46 +01:00
Mark Qvist
59c0a60b33 Reworked battery charge state detection for boards with only ADC-based PMU. Improved battery charge status info on display. 2025-11-10 15:49:52 +01:00
Mark Qvist
427c06bf81 Reverted battery parameters for Heltec v3 to correct values 2025-11-10 12:02:36 +01:00
markqvist
ee9335517e
Merge pull request #109 from alligitor/Heltec_V3_Battery_Status
Fixed reading of battery voltage for Heltec V3.2.
2025-11-10 11:45:15 +01:00
Mark Qvist
2947df3349 Added Heltec v4 board defines and scaffold 2025-11-01 15:33:24 +01:00
Alligitor
828623c70c Fixed reading of battery voltage for Heltec V3.2. Comments from the code:
// there are three version of V3: V3, V3.1, and V3.2
    // V3 and V3.1 have a pull up on pin_ctrl and are active low
    // V3.2 has a transistor and active high
    // put the pin input mode and read it.  if it's high, we have V3 or V3.1
    // other wise, it's a V3.2

Also, changed the min, max, float values for V3 boards.  From what I can see, most are sold with
a battery like this:  https://www.amazon.com/dp/B0D3LMQSGL
These batteries advertise a min voltage of 3 and max of 4.  Float should be a tiny bit below Max.
2025-04-24 00:09:33 +00:00
Mark Qvist
6bbcaa0ba9 Report battery percentage over BLE battery service 2025-01-18 15:20:58 +01:00
Mark Qvist
113b2f1081 Battery management for T-Echo 2025-01-15 21:18:52 +01:00
Mark Qvist
2d2d90847a Initial T-Echo support 2025-01-15 18:38:14 +01:00
Mark Qvist
2119d381b3 Refactored T3S3 board name variable 2025-01-15 10:21:15 +01:00
Mark Qvist
6eaacb7f99 Cleanup 2025-01-13 20:06:51 +01:00
Mark Qvist
8cf6e9cb40 Added battery support to Heltec T114 2025-01-13 18:05:35 +01:00
Mark Qvist
0057852b6c Battery management for T3S3 2025-01-05 14:53:28 +01:00
Mark Qvist
b7b9fb0c04 Battery management for T3S3 2025-01-05 12:03:27 +01:00
Mark Qvist
76eaae8554 Cleanup 2024-10-11 16:39:38 +02:00
Mark Qvist
335c6cbc5c Updated charge status 2024-10-11 10:21:10 +02:00
Mark Qvist
6974a50d10 Added T-Beam Supreme support 2024-10-05 00:42:19 +02:00
Mark Qvist
8bdd85e648 Added T-Deck support 2024-10-03 00:38:49 +02:00
Mark Qvist
5bd2e539eb Update battery status output on missing battery 2024-10-01 18:07:10 +02:00
Mark Qvist
0b9f19916e Improved battery calculations for devices without dedicated PMU 2024-10-01 15:33:03 +02:00
Mark Qvist
0f0a711cd7 Improved battery calculations for devices without dedicated PMU 2024-10-01 14:57:57 +02:00
Mark Qvist
d2133ba5e0 Added battery status and console support to Heltec V3 2024-09-27 00:28:37 +02:00
attermann
6e9a1ebfbd Switch from old AXP202X_Library to new XPowersLib 2023-12-18 19:23:08 -07:00
Mark Qvist
6d26997fa4 Added battery state reporting over USB/Serial/Bluetooth. Implements #39. 2023-10-07 19:46:32 +02:00
Mark Qvist
6052c8cb40 Improved power management for v2 RNodes and T-Beam devices 2022-12-16 19:59:30 +01:00
Mark Qvist
312e4ec2fe Added firmware hash readout 2022-11-01 22:21:07 +01:00
Mark Qvist
8059204050 Added T-Beam PMU support 2022-10-30 22:27:30 +01:00
Mark Qvist
ef771bba36 Added power and battery management 2022-10-29 00:50:16 +02:00