From 9080d8339d04c59a664c5986ee61f4317167c0e2 Mon Sep 17 00:00:00 2001 From: TeTeHacko Date: Fri, 13 Nov 2026 14:49:17 +0100 Subject: [PATCH] Masts run the public observer image: one env SenseCap_Solar_repeater Co-Authored-By: Claude Opus 5.5 --- .github/fw-flags.sh | 25 +++++ .github/workflows/pub-release.yml | 21 +---- variants/sensecap_solar/platformio.ini | 124 +++++++++++++------------ 3 files changed, 91 insertions(+), 79 deletions(-) create mode 100644 .github/fw-flags.sh diff --git a/.github/fw-flags.sh b/.github/fw-flags.sh new file mode 100644 index 00000000..24a1a183 --- /dev/null +++ b/.github/fw-flags.sh @@ -0,0 +1,25 @@ +# shellcheck shell=bash +# Build flags of the public firmware, sourced by pub-release.yml -- and by the +# private mast release, which builds the very same observer image, so what the +# fork publishes is what runs on its own nodes. PlatformIO appends +# PLATFORMIO_BUILD_FLAGS after each env's flags: last -D wins. +# +# 869.432/62.5/SF7/CR5; repeater + room server: zero-hop advert off, flood +# advert 25 h, af 9 (= 10 % duty cycle); repeater: regions cz,cs next to *. +# Path hash 2 B is this fork's default anyway. TX power stays the board's. +# FILTER_CHANNEL_PSKS = [channel_filter] in platformio.ini (#meshcore, Public, +# #test -- public keys): compiles the repeater's `filter` (deny-forward by +# sender name); inert until an operator adds a name. +PUB_FLAGS='-D LORA_FREQ=869.432 -D LORA_BW=62.5 -D LORA_SF=7 -D LORA_CR=5 +-D ADVERT_INTERVAL_DEFAULT=0 -D FLOOD_ADVERT_INTERVAL_DEFAULT=25 +-D AIRTIME_FACTOR_DEFAULT=9.0 -D DEFAULT_REGIONS=\"cz,cs\" +-D FILTER_CHANNEL_PSKS=\"2fa78a5aef618e7c2a78f0ab5c8869b3,8b3387e9c5cdea6ac9e5edbaa115cd72,9cd8fcf22a47333b591d96a2b848b73f\"' +# Observer variants of the nRF52 repeaters: BLE console (starts OFF, +# RPT_BLE_DEFAULT_OFF -- placeholder PIN), `rxlog`/`nodes` and the `pktlog` +# raw-frame ring that the repeater observer reads over BLE or USB. +OBS_FLAGS='-D BLE_PIN_CODE=123456 -D RPT_BLE_DEFAULT_OFF=1 +-D MAX_HEARD_NODES=128 -D RXLOG_SIZE=512 -D PKTFEED_SIZE=64' +# one line each, as the YAML folded scalars they replace were +PUB_FLAGS=${PUB_FLAGS//$'\n'/ } +OBS_FLAGS=${OBS_FLAGS//$'\n'/ } +export PUB_FLAGS OBS_FLAGS diff --git a/.github/workflows/pub-release.yml b/.github/workflows/pub-release.yml index 5e74964d..51a9ac11 100644 --- a/.github/workflows/pub-release.yml +++ b/.github/workflows/pub-release.yml @@ -38,24 +38,8 @@ concurrency: env: GITEA: https://git.rfa.cz KEEP: 5 - # 869.432/62.5/SF7/CR5; repeater + room server: zero-hop advert off, flood - # advert 25 h, af 9 (= 10 % duty cycle); repeater: regions cz,cs next to *. - # Path hash 2 B is this fork's default anyway. TX power stays the board's. - # FILTER_CHANNEL_PSKS = [channel_filter] in platformio.ini (#meshcore, Public, - # #test -- public keys): compiles the repeater's `filter` (deny-forward by - # sender name); inert until an operator adds a name. - PUB_FLAGS: >- - -D LORA_FREQ=869.432 -D LORA_BW=62.5 -D LORA_SF=7 -D LORA_CR=5 - -D ADVERT_INTERVAL_DEFAULT=0 -D FLOOD_ADVERT_INTERVAL_DEFAULT=25 - -D AIRTIME_FACTOR_DEFAULT=9.0 -D DEFAULT_REGIONS=\"cz,cs\" - -D FILTER_CHANNEL_PSKS=\"2fa78a5aef618e7c2a78f0ab5c8869b3,8b3387e9c5cdea6ac9e5edbaa115cd72,9cd8fcf22a47333b591d96a2b848b73f\" - # Observer variants of the nRF52 repeaters: BLE console (starts OFF, - # RPT_BLE_DEFAULT_OFF -- placeholder PIN), `rxlog`/`nodes` and the `pktlog` - # raw-frame ring that the repeater observer reads over BLE or USB. - # RAM 37-39 %, flash 41-58 % on these boards. - OBS_FLAGS: >- - -D BLE_PIN_CODE=123456 -D RPT_BLE_DEFAULT_OFF=1 - -D MAX_HEARD_NODES=128 -D RXLOG_SIZE=512 -D PKTFEED_SIZE=64 + # PUB_FLAGS / OBS_FLAGS: .github/fw-flags.sh (shared with the private mast + # release, which builds the same observer image). RAM 37-39 %, flash 41-58 %. OBS_ENVS: >- Xiao_nrf52_repeater SenseCap_Solar_repeater RAK_4631_repeater t1000e_repeater Heltec_t114_repeater ENVS: >- @@ -113,6 +97,7 @@ jobs: id: build run: | set -euo pipefail + source .github/fw-flags.sh sha=$(git rev-parse --short=8 HEAD) dist="$GITHUB_WORKSPACE/dist" mkdir -p "$dist" diff --git a/variants/sensecap_solar/platformio.ini b/variants/sensecap_solar/platformio.ini index 0b99bf93..af9b22e2 100644 --- a/variants/sensecap_solar/platformio.ini +++ b/variants/sensecap_solar/platformio.ini @@ -38,24 +38,10 @@ lib_deps = [env:SenseCap_Solar_repeater] extends = SenseCap_Solar -build_flags = - ${SenseCap_Solar.build_flags} - -D ADVERT_NAME='"SenseCap_Solar Repeater"' - -D ADVERT_LAT=0.0 - -D ADVERT_LON=0.0 - -D ADMIN_PASSWORD='"password"' - -D MAX_NEIGHBOURS=50 -; dimmed white-LED heartbeat + OTA steady-on (repeater builds only) - -D SENSECAP_SOLAR_WHITE_LED=1 -; -D MESH_PACKET_LOGGING=1 -; -D MESH_DEBUG=1 -build_src_filter = ${SenseCap_Solar.build_src_filter} - +<../examples/simple_repeater/*.cpp> - -; CUSTOM (TeTeHacko): repeater + BLE UART console (wireless querying, no USB). -; The s140 SoftDevice is already linked by the SenseCap_Solar base, so the BLE stack is available. -[env:SenseCap_Solar_repeater_ble] -extends = SenseCap_Solar +; CUSTOM (TeTeHacko): the exact dependency set (sensecap_pinned below) and the +; ldscript that keeps 16 B of RAM for the hardfault record (`get boot`). +platform = ${sensecap_pinned.platform} +lib_deps = ${sensecap_pinned.lib_deps} board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld board_upload.maximum_size = 708608 build_flags = @@ -65,52 +51,19 @@ build_flags = -D ADVERT_LON=0.0 -D ADMIN_PASSWORD='"password"' -D MAX_NEIGHBOURS=50 - ; Real BLE PIN lives ONLY in the git-ignored platformio.local.ini ([secrets] ble_pin). - ; The committed default (123456) is a non-secret placeholder. - -D BLE_PIN_CODE=${secrets.ble_pin} - ; BLE CONNECTION tx power from the first boot (SoftDevice default 0 dBm). - ; The bridge on bridge-host reaches mast-three through a closed window and drops the - ; link at 0 dBm. Advertising is already +8 (simple_repeater/main.cpp); - ; runtime: `blepwr `, saved in /ble_pwr. - -D RPT_BLE_CONN_TX_POWER=8 - ; `radiostat` / `radiokick` (admin CLI): came up deaf after a BLE OTA on - ; 2. 11. 2026 (recv 0, tx_timeout 4, 17 min); catch the state next time. - -D RADIO_DIAG=1 - ; INA226 defaults to 0x44 in EnvironmentSensorManager = collision with SHT41 - ; (false detection, garbage in telemetry). 0x40 is the real INA226 HW default. + ; CUSTOM (TeTeHacko): INA226 defaults to 0x44 = collision with the SHT41 + ; (false detection, garbage telemetry); 0x40 is the INA226 hardware default. -D TELEM_INA226_ADDRESS=0x40 - ; GPS detection (1 s window for NMEA after power-on) is a race and randomly - ; fails. When it loses, the gps setting is not exposed and the persisted - ; _prefs.gps_enabled cannot be applied at boot -> GPS (and RTC sync!) stays - ; dead until the next lucky boot. The P1-Pro always has GPS -> skip detection. - ; GPS on/off itself persists via the `gps on|off` CLI command (NodePrefs). - ; Note: the L76K draws ~25-35 mA — plan for the extra power on a solar node. + ; GPS detection is a 1 s NMEA race that randomly loses, and then the gps + ; setting is not exposed at all (no clock sync). Skip it: the board powers + ; its GPS like any other. -D ENV_SKIP_GPS_DETECT=1 - ; Passive mesh analyzer (TeTeHacko): expose heard repeaters/room servers and a - ; frame firehose over the text console for a BLE bridge/map. RAM-only, ~15 KB. - ; nodes [offset] -> heard repeater/room registry (identity, geo, SNR, path) - ; rxlog [cursor] -> circular log of every frame heard (type, path, SNR/RSSI) - ; Sized from channel physics, not last week's traffic (so we stop re-raising): - ; RXLOG_SIZE 512 (~32 B/rec, 16 KB): ~2 min of a fully saturated SF8/62.5k - ; channel (~2-4 frames/s) or ~35 min of typical traffic -- covers BLE - ; outages; the fast big-page drain (~40+ rec/s) outruns the radio itself. - ; MAX_HEARD_NODES 128 (~68 B/entry, 8.7 KB): the 48-slot registry filled in - ; <2 h and churn evicted real neighbours (Kladno, ABC_10W_MKT) into the - ; poorer `neighbors`-table fallback; 128 > distinct nodes heard per - ; neighbour advert period even on inversion evenings. - -D MAX_HEARD_NODES=128 - -D RXLOG_SIZE=512 - ; PKTFEED_SIZE 64 (~268 B/rec, 17 KB): observer feed ring -- like rxlog but - ; with full raw frame bytes (`pktlog` cmd) for the meshcoretomqtt-compatible - ; community analyzer feed. The bridge now polls in a connect->drain->disconnect - ; duty cycle (BLE connections disturb LoRa TX, see MESH_TX_RETRIES), so drains - ; are ~3-4 min apart: 64 records ≈ 10+ min of typical traffic buys margin for - ; busy evenings; drop detection via the E-trailer catches any overflow. - -D PKTFEED_SIZE=64 - ; Antispam deny list on the community channels (ChannelFilter.h); the keys in - ; [channel_filter] are public by construction. Runtime: `filter add `. - ${channel_filter.build_flags} + ; `radiostat` / `radiokick` (admin CLI): the receiver state when it goes deaf. + -D RADIO_DIAG=1 +; dimmed white-LED heartbeat + OTA steady-on (repeater builds only) + -D SENSECAP_SOLAR_WHITE_LED=1 ; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 build_src_filter = ${SenseCap_Solar.build_src_filter} +<../examples/simple_repeater/*.cpp> @@ -169,3 +122,52 @@ lib_deps = extends = SenseCap_Solar build_src_filter = ${SenseCap_Solar.build_src_filter} +<../examples/kiss_modem/> + +; CUSTOM (TeTeHacko): EXACT dependency set of the SenseCap Solar repeater -- +; PlatformIO has no lockfile, and upstream inherits ranges (`^2.1.5`) and an +; unpinned `platform = nordicnrf52`, so every build resolves whatever is newest +; that day: on 23. 10. 2026 one commit built 271 kB differently from the image +; that had run in the field for a week (platform 11.0.0 instead of 10.12.0, +; Adafruit GFX / INA260 / MLX90614 a patch or minor newer). These are the +; versions proven in the field; the public release builds them too. +; +; RadioLib, CustomLFS and the framework are git pins upstream and copied as is. +; ORDER MATTERS: it is the link order -- same as upstream's inheritance +; (arduino_base, nrf52_base, sensor_base), or the layout of the image changes. +; Moving to a newer upstream: if its platformio.ini changed lib_deps or the +; platform, refresh this list from a clean `pio run` (`.pio/libdeps/`) and +; check the result on the bench before releasing it. +[sensecap_pinned] +platform = nordicnrf52@10.12.0 +lib_deps = + SPI + Wire + https://github.com/jgromes/RadioLib.git#6d8934836678d8894e3d556550475b37dce3e2b6 + rweather/Crypto @ 0.4.0 + adafruit/RTClib @ 2.1.4 + melopero/Melopero RV3028 @ 1.2.0 + electroniccats/CayenneLPP @ 1.6.1 + https://github.com/oltaco/CustomLFS#0.2.3 + adafruit/Adafruit INA3221 Library @ 1.0.1 + adafruit/Adafruit INA219 @ 1.2.3 + robtillaart/INA226 @ 0.6.6 + adafruit/Adafruit INA260 Library @ 1.5.3 + adafruit/Adafruit AHTX0 @ 2.0.6 + adafruit/Adafruit BME280 Library @ 2.3.0 + adafruit/Adafruit BMP280 Library @ 2.6.8 + adafruit/Adafruit SHTC3 Library @ 1.0.2 + sensirion/Sensirion I2C SHT4x @ 1.1.2 + arduino-libraries/Arduino_LPS22HB @ 1.0.3 + adafruit/Adafruit MLX90614 Library @ 2.1.6 + adafruit/Adafruit_VL53L0X @ 1.2.5 + stevemarple/MicroNMEA @ 2.0.6 + adafruit/Adafruit BME680 Library @ 2.0.6 + adafruit/Adafruit BMP085 Library @ 1.2.4 + ; transitive (pulled in by the sensor libraries), pinned so they cannot float + adafruit/Adafruit BusIO @ 1.17.4 + adafruit/Adafruit Unified Sensor @ 1.1.15 + adafruit/Adafruit GFX Library @ 1.12.6 + adafruit/Adafruit SSD1306 @ 2.5.17 + adafruit/Adafruit SH110X @ 2.1.15 + adafruit/Adafruit NeoPixel @ 1.15.5 + sensirion/Sensirion Core @ 0.7.3