Commit Graph
122 Commits
Author SHA1 Message Date
liquidraver 9c166ebefc revert BT back to 4dBm (no change in range) 2026-06-15 11:14:16 +02:00
liquidraver 18b63bd6f5 Add Lilygo T-beam 1.2 (SX1262) 2026-06-14 14:00:51 +02:00
liquidraver 9d4fed9119 wismesh tag adc fix 2026-06-13 08:37:25 +02:00
liquidraver bf71542751 Make Rxdutycycling Great Again 2026-06-13 08:23:01 +02:00
liquidraver a43f46f942 bump to 1.16.1 2026-06-08 12:23:46 +02:00
liquidraver 2b90605fe1 bump Service Changed to 2 2026-06-08 11:56:38 +02:00
liquidraver 81a4365b0f fix nrf54 build 2026-06-08 09:11:26 +02:00
liquidraver 2ad185bab4 license "refactor" :) 2026-06-07 22:47:17 +02:00
liquidraver 2cf4b9704e BT DFU fixes + power bump up 2026-06-07 22:33:50 +02:00
liquidraver 01fd56a573 wire up RTC to out-of-the-box capable nodes 2026-06-07 12:00:05 +02:00
liquidraver ffe9ea652d sync to vanilla 1.16 2026-06-06 16:42:39 +02:00
liquidraver 4353936328 lr2021 experiments 2026-06-06 15:33:37 +02:00
liquidraver d13d6f4621 version to 1.15.9 2026-06-05 14:59:12 +02:00
liquidraver 743076b850 bump some magic numbers 2026-06-03 14:02:46 +02:00
liquidraver a77e877ad8 linux native Pi fixes 2026-06-03 13:48:54 +02:00
liquidraver d37b401033 battery: centralized LiPo OCV curve + ADC multiplier corrections
Add a board-aware battery SOC system replacing the two independent
linear approximations that existed in the UI helpers.

New helpers/battery_curve.{h,c}: a 21-point (5% step) OCV lookup table
with integer linear interpolation. The default generic LiPo curve is a
weak symbol — any board can override it by dropping a battery_curve.c
into its board directory. CMakeLists.txt selects the board-specific file
when present, falling back to the generic.

Board.h gains getBattPercent() (default 0); ZephyrBoard implements it
via battery_curve_lookup().

Board-specific curves added for boards with measured cell data:
t1000_e, rak_wismesh_tag, thinknode_m6, sensecap_solar, wio_tracker_l1.

ADC multiplier corrections applied across all nRF52840 boards:
- Boards using a correctly-derived 3600×ratio formula get +0.5% to
  compensate for nRF SAADC gain error (7200→7236, 6300→6332, etc.)
- rak_wismesh_tag, rak3401_1watt, gat562_30s had multipliers copied
  from Arduino's 3.0V AREF formula; corrected to 3600×1.73×1.005=6259
- xiao_nrf52840 (10911) left unchanged — empirically calibrated value
  above the theoretical, assumed already correct for that hardware

get adc.multiplier now reports current mV reading and the board's
curve 100% target, making field calibration self-guiding.
2026-06-03 13:21:06 +02:00
liquidraver 8761a82d93 fix USB protocol handling and bump version 2026-06-03 10:09:43 +02:00
liquidraver 9ffb3802bf Merge pull request #25 from rlwilliamson-dev/room-server
app: add Room Server (BBS) role
2026-06-02 23:05:25 +02:00
liquidraver 209f74411c fix linux repeater build 2026-06-02 22:56:32 +02:00
rlwilliamson-dev 79afecf11b docs: document the Room Server role
- README: add Room Server to "Device Roles" + a build command in "Building"
- ARCHITECTURE.md: role list two -> four (add Room Server + the
  previously-undocumented Observer)
- Repeater_CLI_commands.md: note the room server shares this CLI
- boards/example_board/README.md: add the room_server.conf build snippet
2026-06-02 15:53:27 -05:00
liquidraver 9f7029abaa GAT562 cleanup + gps
Cleanups 1–3 (cosmetic):

Removed the dead uart1_default/uart1_sleep pinctrl groups + stale "GPS on UART1" comments → gat562_30s-pinctrl.dtsi
Removed the QSPI pinctrl groups (board has no QSPI; pins collide with the joystick) and replaced them with a comment explaining why
Untangled the GPS UART0-vs-async rationale in the DTS and the &uart1 comment
GPS driver switch (functional, you approved the full switch) → gat562_30s.dts, board.conf:

gnss-nmea-generic → luatos,air530z with on-off-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH> (matches the sibling rak_wismesh_tag, same AT6558R chip)
Deleted the always-on gps_power_en gpio-hog (the driver owns P1.02 now → GPS can be powered down)
Removed the CONFIG_UART_ASYNC_API=y override
Updated all related comments
2026-06-02 21:22:55 +02:00
rlwilliamson-dev bb6d9c60e1 app: add Room Server (BBS) role
Add the MeshCore Room Server role to ZephCore — a store-and-forward
shared message room. Clients log in with an admin or guest password
and post messages; the server pushes each new post to all other
logged-in clients (round-robin, per-client sync cursor, ACK + retry,
3-strike eviction).

Ported from upstream MeshCore's simple_room_server, structured as a
near-clone of RepeaterMesh so it reuses the proven ACL, region
filtering, CLI, adverts and telemetry; the post buffer + push engine
are the only net-new pieces:
- RoomServerMesh: PostInfo ring (MAX_UNSYNCED_POSTS=32), addPost,
  pushPostToClient, getUnsyncedCount, processAck, onAckRecv, the
  loop() push driver; room login (onAnonDataRecv parses the
  sync_since cursor); posts/admin-CLI/keep-alive (onPeerDataRecv);
  ADV_TYPE_ROOM advert; ServerStats wire layout; disable_fwd=1.
- main_room_server.cpp: event-loop entry (USB serial CLI, no BLE).
- Kconfig: ZEPHCORE_ROLE_ROOM_SERVER + ZEPHCORE_MAX_UNSYNCED_POSTS.
- CMakeLists role gating; boards/common/room_server.conf.

Post frame, SHA-256 ACK and login-reply layouts match upstream for
MeshCore app compatibility. Builds for gat562_30s
(FLASH 30.95% / RAM 32.46%). Not yet hardware-tested.
2026-06-02 13:02:57 -05:00
rlwilliamson-dev 568d311ab0 boards: add GAT562 30S Mesh Kit (nRF52840, RAK4631 core)
The GAT562 30S Mesh Kit is an nRF52840 + SX1262 board built on the
RAK4631 WisBlock core module with a 30 dBm (1 W) external PA, so it
reuses the proven rak4631 LoRa path. Deltas vs rak4631: 1.8 V TCXO
(per the MeshCore variant), battery multiplier 6232, buzzer on P1.01,
an AT6558R UART GPS, active-high LEDs, and a 5-way joystick that
selects the joystick companion menu UI.

A single board serves both the full kit and the screenless solar
repeater pod; absent peripherals (OLED, GPS, joystick, buzzer) are
optional in devicetree and skipped at runtime.

Board-specific notes:
- GPS: AT6558R NMEA on UART0 @ 9600 (P0.15 RX / P0.16 TX), powered by a
  WB_IO2/P1.02 gpio-hog and parsed by gnss-nmea-generic. Uses
  CONFIG_UART_ASYNC_API (DMA receive); nRF UARTE interrupt-driven RX did
  not feed the modem backend.
- The 6 button/joystick inputs are routed to GPIO SENSE (sense-edge-mask
  on &gpio0) so they don't consume the GPIOTE channel the SX1262 DIO1
  "done" IRQ needs.

Registration: board definition, CMakeLists.txt platform-conf match,
build.sh (nRF_boards), supported_boards.md, the top-level README board
table, and the porting-guide board table.

Hardware-tested on the kit, companion and repeater: LoRa TX/RX with BLE
active (no CAD errors), BLE pairing (PIN 123456) and two-way messaging,
joystick menu UI, SSD1306 OLED, buzzer, battery %, UF2 + DFU-zip
flashing, and a 14-satellite GPS fix.
2026-06-02 11:28:44 -05:00
liquidraver 3c94b83f70 linux native fixup #3 2026-06-02 16:08:51 +02:00
liquidraver eb4e6583c7 linux native fixup #2 2026-06-02 14:50:31 +02:00
liquidraver eded1d7f04 linux native fixup #1 2026-06-01 22:29:53 +02:00
liquidraver ff705b0d5d fix: unbreak the production (CONFIG_LOG=n) build
553b71c made production the default but broke configure+link:
- ZEPHCORE_COMPANION_USB sat inside the role choice (recursive dep)
- CONFIG_RESET_ON_FATAL_ERROR was an undefined, unimplemented symbol
- USB companion sources still gated on CONFIG_LOG, not ZEPHCORE_USB_STACK

Move the USB toggle out of the choice, add a real
ZEPHCORE_RESET_ON_FATAL_ERROR Kconfig + k_sys_fatal_error_handler that
cold-reboots, and match the CMake USB guard to ZEPHCORE_USB_STACK.
2026-05-31 15:36:10 +02:00
liquidraver 553b71c44a Make production the default build; decouple USB companion from CONFIG_LOG
Production (LOG=n, ASSERT=n, RTT=n, reboot-on-fatal) is now the prj.conf
default; debug.conf is the opt-in bundle. Removed prod.conf and the
logging.conf auto-include; relocated RTT/ASSERT out of the always-on
platform confs so they no longer override the prod defaults.

Add CONFIG_ZEPHCORE_COMPANION_USB so the USB CDC companion transport
compiles independently of logging (default-y on USB-capable companions,
opt-in on ESP32-S3 via esp32s3_usb.conf). Gate all USB sites behind one
ZEPHCORE_USB_STACK macro.

Rework BLE/USB interface arbitration to first-come-first-served: neither
transport evicts a live session. Make active_iface mutation thread-safe
(mutex + atomic claim) across the BLE callback thread and USB workqueue.

Share the ESP32-S3 USB OTG / console DTS via common dtsi includes; enable
uart0 (GPIO43/44) on station_g2 and xiao so the console reroute works.
2026-05-30 21:05:42 +02:00
liquidraver 5f265fddeb fix repeater+observer combo 2026-05-27 09:05:22 +02:00
liquidraver f06c472e87 usb: unify companion + repeater CDC ACM init, drop boot waits
Single ZephyrUSBCDC module owns the usbd context, 1200-baud DFU
detection, and DTR transitions for both roles. The boot banner
now blocks on a k_event signalled by the usbd_msg_callback when
DTR transitions high — host attached → wakes immediately; no host
→ bounded timeout (2 s repeater, 1 s companion). Replaces the
fixed k_sleep delays in both mains.

Deletes the companion's 10 s DTR-polling work — line state changes
arrive as events now, same callback handles disconnect (resets V3
parser, flips active_iface) and DFU touch (reboots to bootloader).

Side effect: prod companion no longer enumerates a phantom CDC ACM
port (CONFIG_LOG=n skips the whole stack instead of auto-initing
an unused device).
2026-05-27 09:04:32 +02:00
liquidraver 051adef93e native linux initial commit 2026-05-24 20:06:49 +02:00
liquidraver 597daee6c3 Merge Calvario/ZephCore ui_joystick into joysticktest
# Conflicts:
#	zephcore/helpers/ui-button/ui_task.c
2026-05-20 22:14:35 +02:00
Steve Calvário 56b10f70a1 Init 2026-05-20 20:40:58 +01:00
Steve Calvário 0eedb72d73 Improve CMakeLists handling for T114 2026-05-20 20:02:27 +01:00
Steve Calvário f7f1603536 Fix T114 long press 2026-05-20 17:16:12 +01:00
liquidraver 65311f0ea9 fix(ble): resolve two Phase 3 audit findings
1. CONFIG_BT_DEVICE_NAME_GATT_WRITABLE=y removed. The default GAP
   Device Name write permission is plain BT_GATT_PERM_WRITE — no
   bonding required (Zephyr gap_svc.c:158). Any connected peer
   (bonded or not) could rename the device. Worse, a GAP write
   updates bt_get_name() but NOT prefs.node_name, so the advertised
   name wouldn't track the renamed value. Rename now flows
   exclusively through CMD_SET_ADVERT_NAME, which is NUS-protected
   (AUTHEN required) and properly propagates via
   zephcore_ble_update_name() to prefs + GATT + adv data.

2. CONFIG_BT_DIS_FW_REV_STR synced from "1.13.0" to "v1.15.1-zephyr"
   to match CompanionMesh.cpp CMD_DEVICE_QUERY's version string.
   Comment added requiring the two to stay in sync.
2026-05-20 16:00:17 +02:00
liquidraver f0c29a612f ble cleanup 2026-05-20 10:27:42 +02:00
liquidraver a9f3b8ef3b cleanup t114, add build 2026-05-19 07:00:03 +02:00
liquidraver 924130b408 Merge pull request #20 from Calvario/t114
Add T114 variants (screen and screenless)
2026-05-19 06:54:16 +02:00
liquidraver b271179cc9 activate PSRAM in capable devices to fit OTA 2026-05-18 22:31:04 +02:00
Steve Calvário d65703d82b Add T114 screen and screenless 2026-05-16 22:43:36 +01:00
Steve Calvário 6dc86cc443 Init T114 without screen 2026-05-15 19:04:14 +01:00
liquidraver 66f7b8508f add/fix promicro_sx1262 build 2026-05-07 22:35:30 +02:00
liquidraver 6bc3ba7405 disable default duty cycling + SX driver fixes 2026-05-05 21:56:00 +02:00
InvisibleSymbol 360b3b578d fix(rak4631): dont touch sx1262 power-enable pin
Upstream Zephyr DTS
[rak4631_nrf52840.dts:124](https://github.com/zephyrproject-rtos/zephyr/blob/c6f781a4988fbb5cc3420f74e36add5ef65dbb94/boards/rakwireless/rak4631/rak4631_nrf52840.dts#L124)
declares P1.05 as `rx-enable-gpios = <&gpio1 5 GPIO_ACTIVE_LOW>`.
MeshCore treats the same pin as `SX126X_POWER_EN`
([variants/rak4631/variant.h:155](https://github.com/meshcore-dev/MeshCore/blob/1a7b3614a8439894714a58af55ab7f501e6bb928/variants/rak4631/variant.h#L155))
and only ever drives it HIGH (= module on,
[RAK4631Board.cpp:51](https://github.com/meshcore-dev/MeshCore/blob/1a7b3614a8439894714a58af55ab7f501e6bb928/variants/rak4631/RAK4631Board.cpp#L51)).
Our driver toggles it per direction at
[sx126x.c:474-475](https://github.com/zephyrproject-rtos/zephyr/blob/684c9e8f32e4373a21098559f748f06915f950c9/drivers/lora/native/sx126x/sx126x.c#L474-L475)
— RX state sets it electrically LOW.

This resulted in degraded rx performance.
2026-04-29 09:26:39 +02:00
liquidraver fb25554dcb fix stack overflow on ESP Wifi AP used for OTA 2026-04-25 13:09:58 +02:00
liquidraver 83fca69782 remove hardcoded max TX, set optional defaults instead 2026-04-24 22:46:03 +02:00
liquidraver 1dde69c653 add t-echo board
fix e-ink displays
fix one-button confirmation bug (eg shutdown)
2026-04-24 10:10:58 +02:00
liquidraver a3244e2dc2 Three driver fixes for RX duty cycle, all applied to the existing patch
stolen from Zephyr main:

  1. Issue StopTimerOnPreamble=1 before SetRxDutyCycle so the chip's
     timer is not reset on every preamble detect (per §13.1 of the
     datasheet). Without this, duty cycle effectively never sleeps in
     noisy RF and current draw spikes.
  2. On IRQ_RX_TX_TIMEOUT during duty-cycle RX, re-arm via
     sx126x_restart_rx() instead of falling through to set_sleep().
     The old path silently killed duty cycle after the first preamble
     false-positive.
  3. On recv_duty_cycle(NULL) cancel, wake the radio before issuing
     SetStandby — BUSY stays asserted during the sleep phase and the
     standby command was being dropped.

Also adds a dc_timeout_restarts atomic counter incremented on the Fix 2
path, exposed end-to-end: sx126x_ext.h accessors → LoRaRadioBase vtable
→ SX126xRadio override → CommonCLICallbacks → RepeaterMesh. Query via
`get dc.restarts` on the repeater CLI; cleared by `clear stats`. High
values indicate a noisy environment or a too-loose preamble threshold.

(+increase ESP BT stack because future zephyr pin advance will trip that mine)
2026-04-20 13:36:45 +02:00
jakobmn 5d0b66bc4f Update ThinkNode M1 target to match datasheet
- only two leds, red and blue
 - fix pin definition and polarity for leds
 - remove unmapped pins
 - swap buttons, so they match datasheet and marking on buttons
2026-04-18 15:47:15 +02:00