Commit graph

882 commits

Author SHA1 Message Date
GlassOnTin
2e9f703121 Partial rendering, remote debug protocol, frame metrics
Switched from full-frame to partial rendering — only dirty
rectangles are rendered and flushed. Static watch face flushes
in ~750us vs ~18ms (24x faster). PSRAM usage drops from 824KB
to 197KB for draw buffers.

Remote debug protocol over serial (prefix "RWS" + command byte):
  S — Screenshot (wakes display, forces full redraw, captures)
  T — Touch injection (x, y, duration)
  N — Navigate to tile by column/row
  M — Frame metrics (JSON: flush/render times, memory)
  I — Invalidate (force full redraw)

Python tool (scripts/screenshot.py) supports all commands:
  screenshot, metrics, touch, swipe, navigate, invalidate

Screenshot now works correctly with partial rendering by
keeping the capture flag active across all flush strips and
forcing a full invalidation before capture.

Frame timing instrumentation added to flush callback and
render loop for performance profiling.
2026-03-28 15:04:49 +00:00
GlassOnTin
7366a671b4 Optimize display: DMA SPI, on-demand screenshots, faster scroll
Switched all SPI operations from spi_device_polling_transmit (CPU
busy-wait) to spi_device_transmit (DMA with FreeRTOS yield). The
CPU blocks on a semaphore instead of spinning, allowing ISRs to
run during the ~18ms frame transfer.

Removed per-frame 411KB screenshot buffer copy — now only copies
when a screenshot is actually requested via serial trigger.

Shortened tileview scroll snap animation from default ~300ms to
150ms for snappier transitions with fewer intermediate frames.

Async DMA (queue_trans with deferred flush_ready) was investigated
but spi_device_queue_trans conflicts with spi_device_transmit on
the same device — needs further investigation with a fully queued
pipeline (no mixed blocking/queued calls).
2026-03-28 14:54:29 +00:00
GlassOnTin
76a45dfe53 Add 28px Montserrat Bold font, full-frame rendering, clean scrolling
Both custom fonts (96px time, 28px date/complications/sub-screens)
now render correctly using C++ namespace isolation to avoid symbol
collisions when included in the same translation unit.

Switched to LV_DISPLAY_RENDER_MODE_FULL with two 412KB PSRAM
frame buffers for tear-free scrolling. Combined with
LV_COLOR_FORMAT_RGB565_SWAPPED to eliminate byte-swap overhead
in the flush callback entirely.
2026-03-28 14:02:10 +00:00
GlassOnTin
54618f2f2d Fix custom font rendering, tearing, and scrollbar visibility
Custom 96px font was not rendering because lv_font_conv defaults
to compressed bitmap format (bitmap_format=1) which requires
LV_USE_FONT_COMPRESSED. Regenerated with --no-compress.

Eliminated scroll tearing by switching from partial-strip rendering
to full-frame double buffering (LV_DISPLAY_RENDER_MODE_FULL).
Each buffer is 412KB in PSRAM (824KB total). Removes the need for
a separate byte-swap buffer — using LV_COLOR_FORMAT_RGB565_SWAPPED
so LVGL renders directly in the display's native byte order.

Also: hidden tileview scrollbar, enabled PSRAM in build flags.
2026-03-28 13: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
c31b1908a7 Add SPM1423 PDM microphone driver, fix speaker I2S port
Microphone on I2S_NUM_0 (PDM hardware constraint), speaker moved to
I2S_NUM_1. Both init at boot, shut down before deep sleep.
Mic provides raw audio read and RMS level measurement.
Boot beep disabled (speaker confirmed working).
2026-03-27 19:08:26 +00:00
GlassOnTin
8dd50ac901 Add MAX98357A I2S speaker driver with tone generator
I2S audio output on GPIO 9/10/11 (BCLK/WCLK/DOUT). Sine wave tone
generator with predefined alert sounds: beep, alert, success, error.
Boot beep confirms speaker is working. Speaker shut down before deep
sleep to release I2S driver.
2026-03-27 19:00:48 +00:00
GlassOnTin
deb061943a Add CST9217 touch panel with touch-to-wake display blanking
Touch driver via SensorLib TouchDrvCST92xx on I2C 0x1A with interrupt
on GPIO 12. Touch events unblank the display and reset the blanking
timer. Display blanks after 10 seconds of inactivity.

XL9555 TOUCH_RST now explicitly released at boot. Touch init runs
with explicit I2C_SDA/I2C_SCL pins (same fix as XPowersLib).
2026-03-27 18:48:07 +00:00
GlassOnTin
84c7b886c4 Add BHI260AP sensor hub with deferred init
BHI260AP firmware upload (~260KB at 1MHz I2C) takes ~10 seconds and
blocks the main loop. Moved init from setup() to a deferred check in
the main loop that runs once after 5 seconds when hw_ready is true.
This allows the radio and serial to come up immediately while the
sensor firmware uploads in the background.

Also restores XL9555 DRV_EN and DISP_EN enables at boot (lost during
earlier git checkout/stash operations).
2026-03-27 18:03:33 +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
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
504fb08fdc Enable CO5300 AMOLED display with live watch face
Display now shows time (00:00 from reset RTC) and status line with
radio state, battery percentage, GPS satellites, and uptime counter.
Display blanking disabled until button input is implemented.
QSPI display driver confirmed working after I2C pin fix.
2026-03-27 16:56:30 +00:00
GlassOnTin
4ddbe83c51 Add T-Watch Ultra developer notes documenting hard-won lessons
Covers: I2C pin default mismatch (XPowersLib), flash workflow
(esptool vs JTAG), deep sleep PMU caution, display power gate,
GPS/RTC differences from T-Beam Supreme, and I2C bus architecture.
2026-03-27 16:35:28 +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
f024489aee Add T-Watch Ultra PCB reference photos
Three photos from disassembly session:
- PCB overview with back cover removed
- PCB closeup showing component labels
- Battery connector detail

Factory firmware reflashed to verify hardware integrity. I2C bus and
display confirmed working under LilyGo firmware. RNode firmware I2C
init needs debugging — Wire.begin succeeds but no slaves respond.
2026-03-27 15:53:18 +00:00
GlassOnTin
6ad9abe74d Debug display + fix I2C bus bricked by deep sleep GPIO config
Key finding: deep sleep GPIO OPEN_DRAIN configuration persists in the
battery-backed RTC domain, corrupting the I2C bus across reboots.
Wire.begin() returns false after deep sleep has been entered once.

I2C bus recovery attempt added (SCL clock-out + STOP condition) but
Wire (I2C0) peripheral remains stuck. Wire1 (I2C1) works on same pins
but no slave devices respond — bus lines may be held by stuck slaves.

Found from schematic: XL9555 DOES control VC_EN (display VCI power).
Display QSPI pins confirmed correct from schematic (sheet 4).
BHI260AP SensorLib removed (was causing boot failure due to firmware blob size).
Beacon wake cycle still disabled pending I2C fix.

Critical TODO: fix deep sleep to not set I2C pins to OPEN_DRAIN,
or add robust I2C bus recovery in early boot before PMU init.
2026-03-27 13:46:00 +00:00
GlassOnTin
ae02c5c4af Add BHI260AP sensor hub integration for display GPIO expansion
Added SensorLib dependency (v0.3.1) with BHI260AP GPIO firmware
for controlling display power gate, haptic driver, and touch reset
via the sensor's auxiliary GPIO pins.

Fixed beacon wake cycle triggering on cold boot — disabled pending
proper deep sleep vs cold boot discrimination.

Display status: BHI260AP begin() returns false (firmware upload
failing). CO5300 QSPI driver still cannot reach display controller.
Both issues under investigation.
2026-03-27 13:01:20 +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
180207aa2e Updated readme 2025-12-28 01:07:31 +01:00
Mark Qvist
4564dc3e9e Merge branch 'master' of github.com:markqvist/RNode_Firmware 2025-12-22 22:20:14 +01:00
Mark Qvist
c1efbe727d Updated readme 2025-12-22 22:19:06 +01:00
markqvist
15b8219966
Merge pull request #122 from vehsamrak/fix-readme-heltecv4
Heltec LoRa32 v4 devices added to supported hardware list in README
2025-12-19 14:10:44 +01:00
Petr Karmashev
5ac359ba06
Heltec LoRa32 v4 devices added to supported hardware list in README 2025-12-18 16:46:21 +07:00
Mark Qvist
7f868c6c28 Added interference display to waterfall. Improved Heltec V4 false interference rejection. 2025-11-22 14:19:23 +01:00
Mark Qvist
9ea2a589cb Updated console image 2025-11-22 02:09:26 +01:00
Mark Qvist
15b3e7f605 Cleanup 2025-11-22 01:12:03 +01: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
b8ab1caf96 Updated console image 2025-11-21 16:51:43 +01:00
Mark Qvist
6b21940e59 Improved Heltec v4 LNA gain-value threshold parameter 2025-11-21 16:00:40 +01:00
Mark Qvist
8382d4a08d Fixed packet buffer FIFO state mismatch on high-bitrate queue processing if raw underlying byte buffer was full 2025-11-21 14:07:43 +01:00
Mark Qvist
5e98407ee2 Updated console image 2025-11-19 16:12:56 +01:00
Mark Qvist
af904efb9e Updated console build 1.85 2025-11-19 16:05:21 +01:00
Mark Qvist
99481f751c Cleanup 2025-11-19 15:01:43 +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
1e054097dd Added WiFi host read timeout and automatic disconnect. Added automatic WiFi reconnect in STA mode. Improved host reconnection reliability and responsiveness. 2025-11-18 03:03:49 +01:00
Mark Qvist
439bece78e Set hostname on wifi network 2025-11-17 19:18:41 +01:00
Mark Qvist
86ee47bb65 Cleanup 2025-11-17 18:47:50 +01:00
Mark Qvist
c467b82014 Added ability to specify static IP for WiFi STA connection 2025-11-17 18:47:18 +01:00
Mark Qvist
90539caee9 Cleanup 2025-11-17 17:04:54 +01:00
Mark Qvist
3f7a6a8941 Updated version 2025-11-17 16:41:40 +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
aa852f4aed Fixed device name offset in display 2025-11-14 01:16:38 +01:00
Mark Qvist
6d4a48af1f Fixed incorrect display drawing offset 2025-11-10 18:34:23 +01:00
Mark Qvist
c8bb7490a2 Build fixes 1.84 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
89ea59bbe6 Added CPU temperature measurement and reporting on ESP32S3 2025-11-10 16:39:09 +01:00