Commit graph

143 commits

Author SHA1 Message Date
GlassOnTin
2f693131a3 Add provision-twatch_ultra and TWATCH_PORT to Makefile
New targets:
  make provision-twatch_ultra  — provisions EEPROM + sets firmware hash
  make flash-twatch_ultra-full TWATCH_PORT=/dev/ttyACM0  — full flash

TWATCH_PORT defaults to /dev/ttyACM4, override for remote Pi:
  make provision-twatch_ultra TWATCH_PORT=/dev/ttyACM0
2026-03-29 11:47:36 +01:00
GlassOnTin
926330253a Fix 950ms main loop bottleneck: beacon and radio init on every iteration
Root cause found via loop profiling: two functions called every loop
iteration on unprovisioned devices consumed 950ms:

1. beacon_update() called startRadio() every loop when GPS had fix
   but device wasn't provisioned (hw_ready=false). startRadio() does
   full radio init with SPI commands and delays (~600ms). Fix: gate
   beacon_update() on hw_ready.

2. stopRadio() called LoRa->end() (SPI sleep + SPI.end()) every loop
   in the !hw_ready path (~99ms). Fix: only call when radio_online
   is true (stop once, not repeatedly).

Result: loop time 950ms → 0.3ms (3200x improvement).

Also added:
- Main loop profiling (radio/serial/display/pmu/gps/bt/imu timing)
- Build timestamp in metrics command for version verification
- Visible-tile-only label updates (GPS float formatting skipped
  when GPS screen not shown)
- Reverted to hwcdc USB mode (TinyUSB adds ~900ms/loop overhead)
- USB MSC SD card code preserved but inactive (needs TinyUSB)
2026-03-29 10:52:50 +01:00
GlassOnTin
5e19294dea Add shared SPI bus mutex for LoRa + SD card coexistence
SharedSPI.h: FreeRTOS mutex protecting the shared SPI bus (pins
33/34/35) used by LoRa (SX1262), SD card, and future NFC.

sx126x.cpp: All 6 SPI transaction blocks wrapped with
shared_spi_mutex acquire/release. LoRa uses portMAX_DELAY
(always gets access, just delayed by SD if needed).

USBSD.h: USB MSC SD card access uses shared_spi_mutex with
200ms timeout. Deferred init (3s after boot) for SPI bus
readiness. Metrics: sd_ready, sd_reads, sd_fails counters.

IMULogger.h, Gui.h: SD card writes wrapped in shared_spi_mutex.

Status: SD card correctly reports 29.7GB via USB MSC. Reads
work intermittently (~50% success). Root cause: main loop
takes ~700ms per iteration, causing mutex timeout for MSC
callbacks. Needs loop time investigation to achieve reliable
USB mass storage.

The CO5300 display uses a separate SPI3 bus — not affected.
2026-03-28 20:59:52 +00:00
GlassOnTin
2c0c9f3d5a Add LVGL watch GUI with tileview navigation and serial screenshot
LVGL 9.5.0 integration replacing direct framebuffer rendering.
Watch face with time, date, status bar (mode/battery), and three
complications (LoRa/GPS/Steps). Tileview swipe navigation between
five screens: watch face, radio status, GPS, messages, settings.
Haptic feedback on screen transitions via DRV2605.

Radio status screen shows frequency, LoRa params, RSSI bar gauge,
channel utilization, BLE state, and packet counts. GPS screen shows
coordinates, fix quality, altitude/speed, and beacon status.

Serial screenshot tool (scripts/screenshot.py) captures display
contents over USB CDC by sending trigger bytes and receiving the
shadow framebuffer as raw RGB565.

Build changes:
- FlashSize=16M in FQBN (bootloader embeds flash size, defaults 4MB)
- PSRAM=enabled for LVGL draw buffers and screenshot shadow buffer
- Custom 8MB app partition (partition_twatch.csv) for 16MB flash
- flash-twatch_ultra-full make target for full bootloader+partition+app flash

Architecture notes in code:
- display_init() must run BEFORE xl9555_init() (display power gate
  defaults high at power-on, reordering causes black screen)
- LVGL draw buffers use separate swap buffer for RGB565 byte-order
  conversion to avoid corrupting LVGL's internal buffer state
- Touch input registered via function pointer to decouple Gui.h from
  touch library include order
2026-03-28 11:41:45 +00:00
GlassOnTin
9f034e8d0d Add DRV2605 haptic driver with boot and sleep feedback
Minimal I2C driver for the DRV2605 ERM vibration motor. 117 built-in
effects via the ERM effect library. Named constants for watch use
cases (click, bump, alert, buzz, tick, etc.).

Boot: sharp click on startup. Sleep: soft bump before entering deep
sleep. XL9555 DRV_EN and DISP_EN now explicitly enabled at boot.

Updated Makefile upload-twatch_ultra to set firmware hash after JTAG flash.
2026-03-27 17:45:01 +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
e0f3ac1aee Cleanup 2025-11-22 00:08:47 +01:00
Mark Qvist
7b0658b197 Handle GC1109 LNA gain variance properly 2025-11-22 00:04:56 +01:00
Mark Qvist
af904efb9e Updated console build 2025-11-19 16:05:21 +01:00
Mark Qvist
c48b7bce4c Cleanup 2025-11-19 14:40:45 +01:00
Mark Qvist
121f9e79e8 Added support for handling noise floor calculations on devices with LNA gain variance during LNA recalibration. Fixed potential incoming packet buffer corruption on split packet reception at high bitrates. 2025-11-19 14:40:34 +01:00
Mark Qvist
86ee47bb65 Cleanup 2025-11-17 18:47:50 +01:00
Mark Qvist
2319813a65 Added support for connecting ESP32S3 RNodes over WiFi 2025-11-17 16:41:25 +01:00
Mark Qvist
5b7b0d3afe Updated makefile 2025-11-14 01:40:06 +01:00
Mark Qvist
c8bb7490a2 Build fixes 2025-11-10 18:19:55 +01:00
Mark Qvist
3cc2041516 Added device ID to display 2025-11-10 17:27:56 +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
d06ec065de Implemented support for Heltec V4 with PA 2025-11-07 19:13:29 +01:00
Mark Qvist
23c580d0df Cleanup 2025-04-15 16:45:24 +02:00
Mark Qvist
1ec84743f4 Cleanup 2025-04-15 16:27:01 +02:00
Mark Qvist
d80f866418 Cleanup 2025-04-13 18:46:20 +02:00
Mark Qvist
9ef504392b Improved ESP32 BLE pairing. Added unpair command. 2025-04-13 16:56:45 +02:00
Mark Qvist
e291f3bcae Added XIAO ESP32S3 to release 2025-04-13 00:21:43 +02:00
Mark Qvist
7d868b4db6 Support for XIAO ESP32S3 2025-04-13 00:11:21 +02:00
Mark Qvist
33dedb202f Cleanup 2025-04-12 20:59:00 +02:00
Mark Qvist
68349aaa70 Fixed T-Echo build paths 2025-01-16 10:19:34 +01:00
Mark Qvist
3e98ea14d2 Fixed T-Echo build paths 2025-01-16 09:46:30 +01:00
Mark Qvist
01e346f21f Added T-Echo to release 2025-01-15 23:57:38 +01:00
Mark Qvist
2d2d90847a Initial T-Echo support 2025-01-15 18:38:14 +01:00
Mark Qvist
b4b1d13dc9 Cleanup 2025-01-13 11:38:17 +01:00
Mark Qvist
95895f3756 Set firmware hashes on nRF 2025-01-13 11:37:29 +01:00
Mark Qvist
71e73580f7 Cleanup 2025-01-09 18:41:35 +01:00
Mark Qvist
6e7370acdc Added interference avoidance option 2025-01-09 17:58:46 +01:00
Mark Qvist
dbebb4080a Cleanup 2025-01-09 00:28:18 +01:00
Mark Qvist
aa7bb49b30 Cleanup 2025-01-08 16:52:50 +01:00
Mark Qvist
08651f92f7 Reworked SX1262 LoRa carrier detection 2025-01-07 15:14:44 +01:00
Mark Qvist
e40532ed35 Revert min preamble symbols 2025-01-06 14:21:09 +01:00
Mark Qvist
df6463144f Temporarily disabled Heltec T114 from release artifacts 2025-01-05 16:07:32 +01:00
Mark Qvist
01fcaadea5 Heltec T114 build config 2025-01-05 15:50:29 +01:00
Mark Qvist
bc9ce056ee Add Heltec T114 to release artifacts 2025-01-05 15:05:49 +01:00
Mark Qvist
217db4bcd3 Update release builds to include T3S3 SX1280 PA 2025-01-04 20:20:35 +01:00
Mark Qvist
b891932353 Add T3S3 SX1280 PA release 2025-01-03 21:58:43 +01:00
Mark Qvist
470f4f4d09 Merge branch 'master' of github.com:markqvist/RNode_Firmware 2025-01-03 12:01:33 +01:00
Mark Qvist
9174dbd34a Board defines for T3S3-SX1280 2025-01-03 11:54:48 +01:00
liamcottle
f9234733e2 add support for heltec t114 2025-01-02 15:14:18 +13:00
Mark Qvist
6c82de161c Added display reconditioning function 2024-12-31 14:20:43 +01:00
Mark Qvist
571e7d7105 Added display reconditioning function 2024-12-31 14:13:52 +01:00
Mark Qvist
76eaae8554 Cleanup 2024-10-11 16:39:38 +02:00