Compare commits

..
Author SHA1 Message Date
tth c097b08b62 Merge upstream/dev (9 commits) [upstream-sync]
tth-docs / site (push) Successful in 20s
pub-release / release (push) Successful in 30m29s
2026-12-02 00:55:34 +01:00
tthandClaude Opus 5.5 c935ddf930 docs: the fork's documentation as a website, tth-pub.pages.rfa.cz/meshcore-tth
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 00:54:10 +01:00
tthandClaude Opus 5.5 713b2f8815 docs: console commands written one way -- <value> required, [value] optional, one command per line
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 00:49:51 +01:00
tth 5f31fc8e50 tests: cover CLI prefix stripping, set-pin gate, paged reply bounds, and ACL write failures
Changelog: -
2026-12-02 00:36:05 +01:00
tthandClaude Opus 5.5 0dcc9c6e06 docs: tth-commands no longer links to a doc the public tree does not have
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 00:23:55 +01:00
tth 5a83c230cd Repeater, room server, sensor: fix CLI reply buffer overflow, OTA bounds checks, and ACL slot rotation 2026-12-02 00:12:33 +01:00
tth e9501d0437 Companion: block leading-space and prefix bypasses of "set pin" over USB and locked CLI rescue 2026-12-02 00:12:26 +01:00
fdlamotte 7dafdf239a Merge pull request #3972 from MarkRose/fix/gps-date-range-checks
GpsGuard: range-check the GPS date and time for both NMEA and RAK12500 🤖🤖
2026-12-01 11:17:12 -04:00
fdlamotte c36ac45865 Merge pull request #3966 from cryptomaxsun/feat/ui-compact-clock-date
Companion UI: add compact 128x64 clock/date layout, RTC guard, and e-ink minute refresh
2026-12-01 11:11:24 -04:00
tthandClaude Opus 5.5 108245e55b CI: release notes come out finished -- Czech line, one item per change, computed dependency line
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 12:48:20 +01:00
Liam Cottle 976038717f Merge pull request #3925 from venamartin/meshtrax-allocation
Add MeshTrax allocation for GroupData
2026-12-01 21:27:16 +13:00
upstream-sync-bot a8ec3710ac Merge upstream/dev (2 commits) [upstream-sync]
pub-release / release (push) Successful in 29m35s
2026-12-01 05:06:43 +00:00
venamartin 36ffbe86f2 MeshTrax: a single data type, 0170 2026-11-30 20:22:27 -08:00
Liam Cottle 4891a799bb Merge pull request #4005 from Blake-Latchford/docs/room-post
Document the room server room.post command
2026-12-01 16:02:40 +13:00
lock-refresh-bot ddc5ab4bd7 All nodes: 5 libraries updated (platformio.lock)
Adafruit GFX Library 1.12.6, 2.0.0 -> 1.13.0, 2.0.0
Adafruit INA260 Library 1.5.3, 1.5.4 -> 1.5.4
Adafruit MLX90614 Library 2.1.6, 2.1.7 -> 2.1.7
Adafruit NeoPixel 1.15.5, 1.15.6 -> 1.15.6
Adafruit SSD1306 2.5.17, 2.5.18 -> 2.5.18

Docs: - platformio.lock is generated (tools/pio_lock.py, tth-lock-refresh)
2026-11-30 21:29:12 +00:00
tthandClaude Opus 5.5 0eef523201 CI: lock refresh resolves in the project's .pio/libdeps; PR checks no longer cancelled by pushes
Changelog: -
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 22:13:54 +01:00
tthandClaude Opus 5.5 b6c251d406 All nRF52 images: platform nordicnrf52 11.1.0 (latest) instead of 10.12.0
Changelog: All nRF52 images build on platform nordicnrf52 11.1.0; the masts move to it from 10.12.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 21:38:15 +01:00
tthandClaude Opus 5.5 5ad3c606cc CI: latest platform without waiting; one growing PlatformIO store as the cache
Changelog: -
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 21:23:48 +01:00
tthandClaude Opus 5.5 03d17d8863 All nRF52 images: platform 10.12.0, toolchain and every library pinned
Changelog: All nRF52 images build on a pinned platform (nordicnrf52 10.12.0, as the masts and the bench) and exact library versions from platformio.lock, so a build no longer depends on the day it ran
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 21:19:24 +01:00
tthandClaude Opus 5.5 77f4af1bbb CI: public release fetches each env's libraries inside its first build
Changelog: -
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 20:08:30 +01:00
tthandClaude Opus 5.5 de9c860081 CI: firmware builds run on the image's python3, not setup-python
Changelog: -
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 19:54:58 +01:00
tthandClaude Opus 5.5 ca4c8e6206 CI: public release installs shared platforms once, libraries in parallel
Changelog: -
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 19:43:36 +01:00
tthandClaude Opus 5.5 e5e56f4372 CI: public release builds its 33 images six at a time
Changelog: -
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 19:15:04 +01:00
tthandClaude Opus 5.5 c32ba219dd CI: release notes link direct upstream commits to their real GitHub id
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 19:09:43 +01:00
Blake LatchfordandClaude Opus 5.5 7b2135412a Document the room server room.post command
room.post was added to the room server CLI in #2688 but not to
docs/cli_commands.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 08:40:24 -05:00
cryptomaxsun 39fa6597c6 ui: drop redundant e-ink refresh special case (handled by display CRC) 2026-11-29 19:57:34 +02:00
Mark RoseandClaude Opus 5.5 16a68f218a RAK12500 GPS: range-check the module's date, wait for the first NAV-PVT
getTimestamp() called the SparkFun library's getUnixEpoch(), which
indexes its day tables with the module's year and month unchecked. Use
GpsGuard::epochFromFields() instead, which returns 0 (already treated as
"no time" by RakLocationProvider) for an implausible date.

hasFix() returned the library's fix flag before any NAV-PVT had
arrived. The library doesn't clear that record, so until the first
reply the flag, position and date were whatever was on the heap. Wait
for the first NAV-PVT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 16:12:35 -06:00
Mark RoseandClaude Opus 5.5 96db79dbc0 GpsGuard: convert the receiver's date and time with range checks
MicroNMEA turns any two characters of a checksum-valid GGA/RMC time or
date field into a number, so month, day, hour, minute and second can
each be 0..255. getTimestamp() passed them to RTClib's DateTime, whose
date2days() walks its 11-entry days-per-month table up to the given
month: a read of up to 243 bytes past it. The result was then written
to the RTC. GpsGuard only sees the epoch afterwards, and only when
GPS_GUARD is enabled.

Add GpsGuard::epochFromFields(), which returns 0 for a date or time out
of range (year 2020..2099, the day checked against the month). It is
static and available with or without GPS_GUARD. The NMEA provider uses
it for its timestamp, and doesn't sync the clock, report a clock offset
or apply GPS time when the fields are out of range.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 16:12:35 -06:00
cryptomaxsun 39da9ce46e ui: add compact 128x64 clock/date layout, RTC sync guard, and e-ink minute refresh 2026-11-26 21:45:47 +02:00
venamartin 5a86072ec6 Add MeshTrax allocation for GroupData 2026-11-26 07:59:40 -08:00
34 changed files with 1836 additions and 337 deletions

No files matched your search

@@ -11,25 +11,20 @@ runs:
~/.platformio/.cache
key: ${{ runner.os }}-pio
# CUSTOM (TeTeHacko): no actions/setup-python (upstream: '3.13'). Its
# Python for Ubuntu 26.04, the runner image, is built for x86-64-v3 and
# grg-runner (Xeon E5-2630L v2) has only v2: "CPU ISA level is lower than
# required" on every run. The image's own python3 runs anywhere and the
# build needs no particular 3.x, so the build runs in a venv of it.
- name: Install Python
id: python
continue-on-error: true
uses: actions/setup-python@v6
with:
python-version: '3.13'
# CUSTOM (TeTeHacko): setup-python's build for the runner OS can need a
# newer CPU than the runner host has ("CPU ISA level is lower than
# required"); fall back to the image's own python3 in a venv
- name: Python fallback
if: steps.python.outcome == 'failure'
shell: bash
run: |
set -euo pipefail
SUDO="$(command -v sudo || true)"
venv="$RUNNER_TEMP/pyenv"
if ! python3 -m venv "$venv"; then
apt-get update -qq
apt-get install -y -qq python3 python3-venv
$SUDO apt-get update -qq
$SUDO apt-get install -y -qq python3 python3-venv
python3 -m venv --clear "$venv"
fi
# The image's python is often newer than the wheels on PyPI (detools
@@ -37,8 +32,8 @@ runs:
# headers, which the image does not ship.
inc="$("$venv/bin/python" -c 'import sysconfig; print(sysconfig.get_paths()["include"])')"
if [ ! -e "$inc/Python.h" ]; then
apt-get update -qq
apt-get install -y -qq python3-dev
$SUDO apt-get update -qq
$SUDO apt-get install -y -qq python3-dev
fi
echo "$venv/bin" >>"$GITHUB_PATH"
"$venv/bin/python" --version
+63
View File
@@ -0,0 +1,63 @@
#!/usr/bin/env bash
# The docs website of this fork (https://tth-pub.pages.rfa.cz/meshcore-tth/):
# mkdocs (theme mkdocs-terminal) over docs/, in English: the English half of
# the fork's README is the home page, the Czech half one page (cs.md); the
# fork's own docs first, upstream's below.
#
# Usage: .github/docs-site.sh <out dir> (run from the repo root)
# Needs mkdocs-terminal and markdown-callouts, e.g.
# uvx --with mkdocs-terminal --with markdown-callouts mkdocs --version
# The script stages a copy of docs/ (README split into index.md / cs.md,
# links that leave docs/ pointed at the repo) and builds it with
# mkdocs.tth.yml. Upstream's mkdocs.yml (Material) stays as it is (no
# conflicts in upstream-sync merges).
# Build only from the PUBLIC tree (tth-pub): the export leaves our operations
# docs out, a build of the private repo would publish them.
set -euo pipefail
case "${1:-}" in -h | --help | "")
sed -n '2,/^[^#]/{/^#/s/^# \{0,1\}//p}' "$0"
[ -n "${1:-}" ] || exit 2
exit 0
;;
esac
out=$(realpath -m "$1")
repo=https://git.rfa.cz/tth-pub/meshcore-tth
src="$repo/src/branch/main"
stage=$(mktemp -d)
trap 'rm -rf "$stage"' EXIT
cp -r docs "$stage/docs"
# upstream's own introduction gets a page of its own; ours is the home page
mv "$stage/docs/index.md" "$stage/docs/meshcore.md"
rm -f "$stage/docs/docs.md" # how to build upstream's site, not for readers
# README of the fork: "## O tomto forku" .. "## About this fork" = Czech,
# from there to "## About MeshCore" = English. One heading level up, links
# into docs/ made site-relative, any other repo path absolute.
readme_part() {
sed -n "/^## $1/,/^## $2/p" README.md | sed '$d' |
sed -E 's/^#(#+) /\1 /' |
sed -E 's#\]\((\./)?docs/([^)]+)\)#](\2)#g' |
sed -E "s#\\]\\((\\./)?([a-zA-Z][^):]*)\\)#](${src//#/\\#}/\\2)#g"
}
readme_part 'About this fork' 'About MeshCore' >"$stage/docs/index.md"
readme_part 'O tomto forku' 'About this fork' >"$stage/docs/cs.md"
if ! grep -q . "$stage/docs/index.md" || ! grep -q . "$stage/docs/cs.md"; then
echo "docs-site: README sections not found (headings changed?)" >&2
exit 1
fi
# the two languages link to each other by anchor, and "above"/"below"
# is a separate page here
sed -i -E 's#Česká verze \[výše\]#[Česká verze]#' "$stage/docs/index.md"
sed -i -E 's#English version \[below\]#[English version]#' "$stage/docs/cs.md"
sed -i -E 's#\]\(\#about-this-fork[^)]*\)#](index.md)#g' "$stage/docs/cs.md"
sed -i -E 's#\]\(\#o-tomto-forku[^)]*\)#](cs.md)#g' "$stage/docs/index.md"
# GFM (Gitea) needs `\|` for a pipe in code inside a table cell; Python-
# Markdown keeps the backslash and does not split cells on a pipe in code
perl -0pi -e 's/(`[^`\n]*`)/ (my $c = $1) =~ s#\\\|#|#g; $c /ge' "$stage"/docs/*.md
# our docs link back to ../README.md
sed -i -E 's#\]\(\.\./README\.md#](index.md#g' "$stage"/docs/*.md
cp mkdocs.tth.yml "$stage/"
cd "$stage"
mkdocs build --strict -f mkdocs.tth.yml -d "$out"
+155
View File
@@ -0,0 +1,155 @@
#!/usr/bin/env bash
# The changes part of a public release's notes (pub-release.yml): our commits
# since BASE, one computed line for the build dependencies that moved, and
# upstream's merged PRs. Prints Markdown to stdout.
#
# Usage: .github/release-notes.sh <base> <sha> <web url of this repo>
# Preview: in a clone of tth-pub/meshcore-tth checked out at <sha> (the
# library line compares platformio.lock in the working tree with <base>).
#
# What a commit puts into the notes (body lines, AGENTS.md "Commit = řádek
# veřejného changelogu"; .tth/tools/git-hooks/commit-msg enforces them):
# Changelog: <English line> replaces the subject; "Changelog: -" = left out
# Changelog-cs: <Czech line> the notes show "<cs> · *<en>*"
# Changelog-topic: <slug> commits with the same topic in one release are
# ONE item: the newest one's text, all links --
# a fix of a fix, a pin moved twice, a
# superseded step no longer show up as two items
# Commits that touch the firmware (paths in $fwre) come first, the rest is
# folded. Build dependencies are not taken from commit messages but diffed:
# the nRF52 platform and toolchain pins in platformio.ini and every library in
# platformio.lock (tools/pio_lock.py moved), so the daily lock refresh and
# Renovate commits carry "Changelog: -" and a release still says what moved.
set -euo pipefail
case "${1:-}" in -h | --help)
sed -n '2,/^[^#]/{/^#/s/^# \{0,1\}//p}' "$0"
exit 0
;;
esac
[ $# -eq 3 ] || {
echo "usage: $0 <base> <sha> <web url>" >&2
exit 2
}
base=$1 sha=$2 web=$3
gh=https://github.com/meshcore-dev/MeshCore
max=60
fwre='^(src|examples|variants|lib|boards|arch)/|^platformio\.(ini|lock)$'
trailer() { git log -1 --format=%b "$1" | sed -n "s/^$2: *//p" | head -1; }
# ours: commits on our main itself (first parent); a merge of one of our own
# branches (feat/...) is unfolded into the branch's commits, an upstream merge
# is left to the upstream list below
ourc=()
for c in $(git log --first-parent --format=%H "$base..$sha"); do
if git rev-parse -q --verify "$c^2" >/dev/null; then
git log -1 --format=%s "$c" | grep -q '^Merge upstream' && continue
# ^base: a merge of main into a branch carries what is released already
mapfile -t -O "${#ourc[@]}" ourc < <(git log --no-merges --format=%H "$c^1..$c^2" "^$base")
else
ourc+=("$c")
fi
done
# items, newest first; a topic seen before only adds its link
declare -A text=() links=() isfw=()
keys=()
for c in "${ourc[@]}"; do
en=$(trailer "$c" Changelog)
[ "$en" = "-" ] && continue
[ -n "$en" ] || en=$(git log -1 --format=%s "$c")
cs=$(trailer "$c" Changelog-cs)
key=$(trailer "$c" Changelog-topic)
key=${key:-$c}
link="[${c:0:8}]($web/commit/$c)"
if [ -z "${text[$key]+x}" ]; then
keys+=("$key")
if [ -n "$cs" ]; then text[$key]="$cs · *$en*"; else text[$key]=$en; fi
links[$key]=$link
else
links[$key]+=", $link"
fi
git diff-tree --no-commit-id --name-only -r "$c" | grep -qE "$fwre" && isfw[$key]=1
done
# build dependencies that moved between base and sha
deps=()
pin() { git show "$1:platformio.ini" 2>/dev/null | grep -m1 -oE "$2@[0-9][^[:space:]]*" | cut -d@ -f2 || true; }
for p in nordicnrf52 toolchain-gccarmnoneeabi; do
o=$(pin "$base" "platformio/$p") n=$(pin "$sha" "platformio/$p")
[ "$o" = "$n" ] || deps+=("$p ${o:-unpinned} → ${n:-unpinned}")
done
if git cat-file -e "$base:platformio.lock" 2>/dev/null && [ -f platformio.lock ]; then
if [ "$(git rev-parse HEAD)" = "$(git rev-parse "$sha^{commit}")" ]; then
while IFS= read -r l; do
[ -n "$l" ] && deps+=("${l/ -> / → }")
done < <(python3 tools/pio_lock.py moved --base "$base")
else
echo "release-notes: checkout is not $sha, libraries left out" >&2
fi
fi
fw="" other="" nother=0
for k in "${keys[@]}"; do
line="- ${text[$k]} (${links[$k]})"
if [ -n "${isfw[$k]:-}" ]; then
fw+="$line"$'\n'
else
other+="$line"$'\n'
nother=$((nother + 1))
fi
done
if [ "${#deps[@]}" -gt 0 ]; then
d=$(printf '%s, ' "${deps[@]}")
fw+="- Závislosti buildu · *build dependencies*: ${d%, }"$'\n'
fi
fw=${fw%$'\n'} other=${other%$'\n'}
# upstream: the first-parent line of each merged upstream branch, PR merges as
# their title, direct commits as their subject. A direct upstream commit (no
# PR) links to GitHub by its ORIGINAL id: the public export (filter-repo)
# gives every upstream commit a new one, which GitHub does not know
# (30. 11. 2026: "* sec patch" linked to a 404). Author email + author time
# survive the rewrite.
declare -A seen=() upid=()
if git fetch -q --no-tags "$gh.git" '+refs/heads/main:refs/upstream/main' '+refs/heads/dev:refs/upstream/dev'; then
while read -r h k; do upid[$k]=$h; done < <(git log --format='%H %ae/%at' refs/upstream/main refs/upstream/dev)
fi
ups=()
for m in $(git log --first-parent --merges --grep='^Merge upstream' --format=%H "$base..$sha"); do
for c in $(git log --first-parent --format=%H "$m^1..$m^2"); do
s=$(git log -1 --format=%s "$c")
if [[ $s =~ ^Merge\ pull\ request\ \#([0-9]+)\ from\ ([^/]+)/(.*)$ ]]; then
pr=${BASH_REMATCH[1]}
[ -z "${seen[$pr]:-}" ] || continue
seen[$pr]=1
t=$(git log -1 --format=%b "$c" | sed -n '/./{p;q}')
ups+=("- ${t:-${BASH_REMATCH[3]}} ([#$pr]($gh/pull/$pr), ${BASH_REMATCH[2]})")
elif [[ $s != Merge* ]]; then
[ -z "${seen[$c]:-}" ] || continue
seen[$c]=1
u=${upid[$(git log -1 --format='%ae/%at' "$c")]:-}
if [ -n "$u" ]; then
ups+=("- $s ([${u:0:7}]($gh/commit/$u))")
else
ups+=("- $s ([${c:0:7}]($web/commit/$c))")
fi
fi
done
done
n=${#ups[@]}
echo "### Změny firmwaru · firmware changes"
echo "${fw:-- žádné · none}"
echo
if [ "$nother" -gt 0 ]; then
echo "<details><summary>Dokumentace, nástroje, CI · docs, tools, CI ($nother)</summary>"
echo
echo "$other"
echo
echo "</details>"
echo
fi
echo "### Z upstreamu MeshCore · from upstream ($n)"
if [ "$n" -gt 0 ]; then printf '%s\n' "${ups[@]:0:$max}"; else echo "- žádné · none"; fi
[ "$n" -le "$max" ] || echo "- … a dalších $((n - max)) · and $((n - max)) more"
+3
View File
@@ -11,6 +11,9 @@ permissions:
jobs:
github-pages:
# CUSTOM (TeTeHacko): upstream's site only; this fork publishes its own
# (tth-docs.yml), and here the job only filled an unread gh-pages branch
if: github.repository == 'meshcore-dev/MeshCore'
runs-on: ubuntu-latest
steps:
+163 -93
View File
@@ -21,7 +21,9 @@
# the newest KEEP releases stay, older ones are deleted. The body is a
# changelog since the previous release: our own firmware commits, our docs /
# tools / CI commits folded, then the upstream PRs the upstream merges brought
# in. A "Changelog: <text>" line in a commit body replaces its subject there.
# in, generated by .github/release-notes.sh (preview it locally; its header
# lists the commit trailers: Changelog, Changelog-cs, Changelog-topic) with
# one computed line for the build dependencies that moved.
# nRF52: .uf2 (drag onto the bootloader drive) and .zip (DFU over BLE or
# serial); ESP32: -merged.bin (fresh install at 0x0) and .bin (update).
#
@@ -36,10 +38,29 @@
#
# dry_run: the same build anywhere (the private repo too), no release -- the
# result goes up as a workflow artifact. Delta bases always come from the
# public repo's releases.
# public repo's releases. A pull request that changes a dependency pin
# (platformio.ini, platformio.lock -- Renovate's) runs as a dry run too, and is
# what Renovate waits for before it merges.
#
# Libraries come from platformio.lock (tools/pio_lock.py): installed before
# each env's first build, and the build fails when anything else resolved.
# Platform and toolchain are pinned in platformio.ini. ~/.platformio keeps
# every version it ever installed side by side (platforms/<name>@<version>,
# packages likewise) and a build takes the pinned one, so the cache is one
# growing store: the newest is restored, new versions are added and saved
# under a new key only when a pin changed. Libraries are not cached: small,
# and an old version in .pio/libdeps/<env> would fail the lock check.
name: pub-release
"on":
pull_request:
branches: [main]
paths:
- "platformio.ini"
- "platformio.lock"
- "variants/**/platformio.ini"
- ".github/workflows/pub-release.yml"
- ".github/fw-flags.sh"
push:
branches: [main]
paths-ignore:
@@ -70,8 +91,14 @@ name: pub-release
required: false
default: ""
# Releases queue one after another (tag numbering); a pull request's check
# and a dry run each in their own group: Gitea keeps ONE pending run per
# group, so a push to main (twice a day) would cancel a waiting PR check and
# Renovate's automerge would never come.
concurrency:
group: pub-release
group: >-
pub-release-${{ github.event_name == 'pull_request' && github.ref
|| (github.event.inputs.dry_run == 'true' && 'dry' || 'release') }}
cancel-in-progress: false
env:
@@ -86,6 +113,9 @@ env:
Xiao_nrf52_repeater Xiao_nrf52_room_server Xiao_nrf52_sensor SenseCap_Solar_repeater
RAK_4631_repeater RAK_4631_room_server t1000e_repeater Heltec_t114_repeater
PUB_REPO: tth-pub/meshcore-tth # where delta bases come from, dry run or not
# grg-runner: 24 cores, up to 8 jobs of its own; 6 builds x 6 compilers
PARALLEL: 6
PIO_JOBS: 6
ENVS: >-
Xiao_nrf52_repeater Xiao_nrf52_companion_radio_ble Xiao_nrf52_room_server Xiao_nrf52_sensor
SenseCap_Solar_repeater SenseCap_Solar_companion_radio_ble
@@ -96,8 +126,12 @@ env:
jobs:
release:
if: github.repository == 'tth-pub/meshcore-tth' || github.event.inputs.dry_run == 'true'
if: >-
github.repository == 'tth-pub/meshcore-tth' || github.event.inputs.dry_run == 'true'
|| github.event_name == 'pull_request'
runs-on: ubuntu-latest
env:
DRY: ${{ github.event.inputs.dry_run == 'true' || github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v4
with:
@@ -109,7 +143,6 @@ jobs:
env:
TOKEN: ${{ secrets.GITEA_TOKEN || github.token }}
REPLACE: ${{ github.event.inputs.replace }}
DRY: ${{ github.event.inputs.dry_run }}
run: |
set -euo pipefail
git fetch -q --tags
@@ -157,6 +190,16 @@ jobs:
echo "title=$title"
} >>"$GITHUB_OUTPUT"
# one store of every platform/toolchain version (see the header)
- name: PlatformIO platforms and packages
uses: actions/cache@v5
with:
path: |
~/.platformio/platforms
~/.platformio/packages
key: pio-store-${{ hashFiles('platformio.ini', 'variants/**/platformio.ini') }}
restore-keys: pio-store-
- name: Setup Build Environment
uses: ./.github/actions/setup-build-environment
@@ -166,7 +209,6 @@ jobs:
TAG: ${{ steps.src.outputs.tag }}
OTA_SIGNING_KEY: ${{ secrets.OTA_SIGNING_KEY }}
TOKEN: ${{ secrets.GITEA_TOKEN || github.token }}
DRY: ${{ github.event.inputs.dry_run }}
BASES_REPO: ${{ github.event.inputs.bases_repo }}
ONLY: ${{ github.event.inputs.only }}
run: |
@@ -224,14 +266,107 @@ jobs:
fi
done <"$bases/releases.jsonl"
}
# build <env> <extra flags> <name suffix> [ota variant]; PlatformIO
# appends PLATFORMIO_BUILD_FLAGS after each env's flags: last -D wins
build() {
local env=$1 suffix=$3 variant=${4:-} b v
if [ -n "$ONLY" ] && [[ " $ONLY " != *" $env$suffix "* ]]; then return 0; fi
echo "::group::$env$suffix"
FW_OTA_VARIANT=$variant PLATFORMIO_BUILD_FLAGS="$PUB_FLAGS $2" pio run -e "$env"
b=".pio/build/$env"
# The artifacts: <env>|<extra flags>|<name suffix>|<ota variant>.
# PlatformIO appends PLATFORMIO_BUILD_FLAGS after each env's flags:
# last -D wins.
arts=()
declare -A spec=()
add() {
if [ -n "$ONLY" ] && [[ " $ONLY " != *" $1$3 "* ]]; then return 0; fi
arts+=("$1$3")
spec[$1$3]="$1|$2|$3|${4:-}"
}
for env in $ENVS; do add "$env" "" ""; done
for env in $OBS_ENVS; do add "$env" "$OBS_FLAGS" "-observer"; done
for env in $OTA_ENVS; do add "$env" "-D FW_OTA=1" "-ota" ota; done
for env in $OBS_ENVS; do add "$env" "$OBS_FLAGS -D FW_OTA=1" "-observer-ota" observer-ota; done
# Builds run PARALLEL at a time: one by one they took 38 of the run's
# 40 minutes on a 24-core runner that sat mostly idle.
bdir="$RUNNER_TEMP/build" logs="$RUNNER_TEMP/logs"
mkdir -p "$bdir" "$logs"
# par <function> <name>...: `<function> <name>` PARALLEL at a time,
# output to $logs/<name>.log, exit code to $logs/<name>.rc
par() {
local fn=$1 n running=0
shift
for n in "$@"; do
if [ "$running" -ge "$PARALLEL" ]; then wait -n || :; running=$((running - 1)); fi
(set +e; "$fn" "$n"; echo $? >"$logs/$n.rc") >"$logs/$n.log" 2>&1 &
running=$((running + 1))
done
wait
}
# report <title> <name>...: each log as a group, in this order; fails
# the step, with the tails of the failed ones, if any failed
report() {
local title=$1 n rc failed=()
shift
for n in "$@"; do
rc=$(cat "$logs/$n.rc" 2>/dev/null || echo "?")
echo "::group::$n (rc $rc)"
cat "$logs/$n.log"
echo "::endgroup::"
[ "$rc" = 0 ] || failed+=("$n")
done
[ ${#failed[@]} -eq 0 ] && return 0
for n in "${failed[@]}"; do echo "== $n"; tail -n 30 "$logs/$n.log"; done
echo "::error::$title failed: ${failed[*]}"
exit 1
}
# 1) install the platforms. Nothing is cached here (reproducible),
# so each run downloads platforms, toolchains and libraries: 8 min
# env by env up front. One env per distinct platform (+
# platform_packages) installs those first, one at a time -- they
# are shared in ~/.platformio, concurrent installs would race.
envs=$(printf '%s\n' "${arts[@]}" | while read -r a; do echo "${spec[$a]%%|*}"; done | sort -u)
mapfile -t first < <(pio project config --json-output | python3 -c '
import json, sys
want, seen = set(sys.argv[1].split()), set()
for name, opts in json.load(sys.stdin):
o = dict(opts)
key = (o.get("platform"), str(o.get("platform_packages")))
if name[4:] in want and name.startswith("env:") and key not in seen:
seen.add(key)
print(name[4:])' "$envs")
# deps <env>: the locked libraries first, then whatever lib_deps still
# miss (platform, toolchain, git/file pins), then the lock check --
# once per env: the flock keeps its other flag sets waiting
locks="$RUNNER_TEMP/locks"
mkdir -p "$locks"
deps() {
flock "$locks/$1" sh -c "python3 tools/pio_lock.py install -e '$1' && pio pkg install -e '$1' -s &&
python3 tools/pio_lock.py check -e '$1'"
}
install() { deps "${1#install-}"; }
t0=$SECONDS
for env in "${first[@]}"; do par install "install-$env"; done
report "install" "${first[@]/#/install-}"
echo "installed ${#first[@]} platforms in $((SECONDS - t0)) s"
# 2) compile, each artifact into its own build dir (one env comes in
# up to four flag sets). An env's libraries come with its first
# build (deps), into its own .pio/libdeps/<env>, while other envs
# compile; the check fails the build when anything is not exactly
# platformio.lock.
compile() {
local env flags suffix variant
IFS='|' read -r env flags suffix variant <<<"${spec[$1]}"
deps "$env" || return 1
export FW_OTA_VARIANT=$variant PLATFORMIO_BUILD_DIR="$bdir/$1" PLATFORMIO_BUILD_FLAGS="$PUB_FLAGS $flags"
pio run -j "$PIO_JOBS" -e "$env" || return 1
[ -f "$bdir/$1/$env/firmware.zip" ] || pio run -j "$PIO_JOBS" -t mergebin -e "$env" # ESP32
}
t1=$SECONDS
par compile "${arts[@]}"
echo "compiled ${#arts[@]} artifacts in $((SECONDS - t1)) s ($PARALLEL at a time)"
report "build" "${arts[@]}"
# 3) package in order: manifest.json, deltas and the version are
# written one artifact at a time. The OTA tools read .pio/build/<env>,
# so that points at the artifact being packaged.
mkdir -p .pio/build
for a in "${arts[@]}"; do
IFS='|' read -r env flags suffix variant <<<"${spec[$a]}"
b="$bdir/$a/$env"
echo "::group::package $env$suffix"
if [ -f "$b/firmware.zip" ]; then # nRF52
python3 bin/uf2conv/uf2conv.py "$b/firmware.hex" -c -o "$b/firmware.uf2" -f 0xADA52840
cp "$b/firmware.uf2" "$dist/$env$suffix-$TAG.uf2"
@@ -239,18 +374,19 @@ jobs:
v=$(grep -m1 -aoE 'v[0-9]+\.[0-9]+\.[0-9]+-tth[0-9a-f]+\+?' "$b/firmware.elf" || true)
case "$v" in *+) echo "::error::$env is dirty ($v)"; exit 1 ;; esac
[ -n "$version" ] || version="$v"
[ -z "$variant" ] || { unzip -p "$b/firmware.zip" firmware.bin >"$b/firmware.bin"; ota_package "$env" "$env$suffix"; }
if [ -n "$variant" ]; then
rm -rf ".pio/build/$env"
ln -s "$b" ".pio/build/$env"
unzip -p "$b/firmware.zip" firmware.bin >"$b/firmware.bin"
ota_package "$env" "$env$suffix"
fi
else # ESP32
PLATFORMIO_BUILD_FLAGS="$PUB_FLAGS $2" pio run -t mergebin -e "$env"
cp "$b/firmware.bin" "$dist/$env$suffix-$TAG.bin"
cp "$b/firmware-merged.bin" "$dist/$env$suffix-$TAG-merged.bin"
fi
echo "::endgroup::"
}
for env in $ENVS; do build "$env" "" ""; done
for env in $OBS_ENVS; do build "$env" "$OBS_FLAGS" "-observer"; done
for env in $OTA_ENVS; do build "$env" "-D FW_OTA=1" "-ota" ota; done
for env in $OBS_ENVS; do build "$env" "$OBS_FLAGS -D FW_OTA=1" "-observer-ota" observer-ota; done
done
echo "installed, built and packaged in $((SECONDS - t0)) s"
jq --arg c "$(git rev-parse HEAD)" --arg t "$TAG" '.commit = $c | .tag = $t' \
"$dist/manifest.json" >"$dist/m.tmp" && mv "$dist/m.tmp" "$dist/manifest.json"
cd "$dist"
@@ -262,14 +398,14 @@ jobs:
echo "version=${version:-tth-$sha}" >>"$GITHUB_OUTPUT"
- name: Dry run artifact
if: github.event.inputs.dry_run == 'true'
if: env.DRY == 'true'
uses: actions/upload-artifact@v4
with:
name: pub-release-dry-run
path: dist/
- name: Release
if: github.event.inputs.dry_run != 'true'
if: env.DRY != 'true'
env:
TOKEN: ${{ secrets.GITEA_TOKEN || github.token }}
SHA: ${{ steps.src.outputs.sha }}
@@ -317,8 +453,6 @@ jobs:
EOF
)
web="$GITEA/$GITHUB_REPOSITORY"
gh=https://github.com/meshcore-dev/MeshCore
max=60
# changelog against the newest older release that HEAD descends from
prev="" base=""
while read -r t c; do
@@ -336,60 +470,9 @@ jobs:
| sort_by(.created_at) | reverse | .[] | "\(.tag_name) \(.target_commitish)"')
# no older release: the last 20 commits of our own line
[ -n "$base" ] || base=$(git rev-list --first-parent --max-count=21 "$SHA" | tail -1)
# ours: commits on our main itself (first parent); a merge of one of
# our own branches (feat/...) is unfolded into the branch's commits,
# an upstream merge is left to the upstream list below
ourc=()
for c in $(git log --first-parent --format=%H "$base..$SHA"); do
if git rev-parse -q --verify "$c^2" >/dev/null; then
git log -1 --format=%s "$c" | grep -q '^Merge upstream' && continue
# ^base: a merge of main into a branch carries what is released already
mapfile -t -O "${#ourc[@]}" ourc < <(git log --no-merges --format=%H "$c^1..$c^2" "^$base")
else
ourc+=("$c")
fi
done
# Firmware changes first; docs, CI, tools and tests folded away. Sorted
# by the files a commit touches, so it holds even for a poor subject.
# A "Changelog: <text>" line in the body replaces the subject in the
# notes ("Changelog: -" leaves the commit out), so the subject can stay
# technical while the notes say what changes for the node.
fw="" other="" nother=0
for c in "${ourc[@]}"; do
line=$(git log -1 --format=%b "$c" | sed -n 's/^Changelog: *//p' | head -1)
[ "$line" = "-" ] && continue
[ -n "$line" ] || line=$(git log -1 --format=%s "$c")
line="- $line ([${c:0:8}]($web/commit/$c))"
if git diff-tree --no-commit-id --name-only -r "$c" |
grep -qE '^(src|examples|variants|lib|boards|arch)/|^platformio\.ini$'; then
fw+="$line"$'\n'
else
other+="$line"$'\n'
nother=$((nother + 1))
fi
done
fw=${fw%$'\n'} other=${other%$'\n'}
# upstream: the first-parent line of each merged upstream branch,
# PR merges as their title, direct commits as their subject
declare -A seen=()
ups=()
for m in $(git log --first-parent --merges --grep='^Merge upstream' --format=%H "$base..$SHA"); do
for c in $(git log --first-parent --format=%H "$m^1..$m^2"); do
s=$(git log -1 --format=%s "$c")
if [[ $s =~ ^Merge\ pull\ request\ \#([0-9]+)\ from\ ([^/]+)/(.*)$ ]]; then
pr=${BASH_REMATCH[1]}
[ -z "${seen[$pr]:-}" ] || continue
seen[$pr]=1
t=$(git log -1 --format=%b "$c" | sed -n '/./{p;q}')
ups+=("- ${t:-${BASH_REMATCH[3]}} ([#$pr]($gh/pull/$pr), ${BASH_REMATCH[2]})")
elif [[ $s != Merge* ]]; then
[ -z "${seen[$c]:-}" ] || continue
seen[$c]=1
ups+=("- $s ([${c:0:7}]($gh/commit/$c))")
fi
done
done
n=${#ups[@]}
# our commits, moved build dependencies, upstream PRs -- the
# generator is a script so the notes can be previewed locally
changes=$(bash .github/release-notes.sh "$base" "$SHA" "$web")
body=$(
echo "$TITLE"
echo
@@ -399,20 +482,7 @@ jobs:
echo "Od předchozího vydání · since [$prev]($web/releases/tag/$(jq -rn --arg s "$prev" '$s|@uri'))"
echo
fi
echo "### Změny firmwaru · firmware changes"
echo "${fw:-- žádné · none}"
echo
if [ "$nother" -gt 0 ]; then
echo "<details><summary>Dokumentace, nástroje, CI · docs, tools, CI ($nother)</summary>"
echo
echo "$other"
echo
echo "</details>"
echo
fi
echo "### Z upstreamu MeshCore · from upstream ($n)"
[ "$n" -gt 0 ] && printf '%s\n' "${ups[@]:0:$max}" || echo "- žádné · none"
[ "$n" -le "$max" ] || echo "- … a dalších $((n - max)) · and $((n - max)) more"
echo "$changes"
echo
echo "### Po flashi · after flashing"
echo
+82
View File
@@ -0,0 +1,82 @@
# Docs website of this fork: https://tth-pub.pages.rfa.cz/meshcore-tth/
#
# Runs only in the published repo (tth-pub/meshcore-tth), after a push to main
# that touches the docs: .github/docs-site.sh builds the site (mkdocs, theme
# mkdocs-terminal, mkdocs.tth.yml) from the public tree -- the export leaves
# our operations docs out, so nothing private can end up on it -- and the
# result is force-pushed as the only commit of the branch `pages`. A webhook
# of the repo (push, branch filter `pages`) tells git-pages on pages.rfa.cz,
# which clones the branch anonymously: no token outside this repo's own.
# git-pages: roles/git_pages in the proxmox.rfa.cz repo.
name: tth-docs
"on":
push:
branches: [main]
paths:
- "docs/**"
- "README.md"
- "mkdocs.tth.yml"
- ".github/docs-site.sh"
- ".github/workflows/tth-docs.yml"
workflow_dispatch:
concurrency:
group: tth-docs
cancel-in-progress: true
permissions:
contents: write
env:
MKDOCS_VERSION: "1.6.1"
MKDOCS_TERMINAL_VERSION: "4.8.0"
MARKDOWN_CALLOUTS_VERSION: "0.4.0"
PYMDOWN_EXTENSIONS_VERSION: "13.1.2"
jobs:
site:
if: github.repository == 'tth-pub/meshcore-tth'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# No actions/setup-python: its builds need x86-64-v3, the runner has v2
# (see tth-tools-lint.yml). mkdocs goes into a venv of the image's python3.
- name: Install mkdocs
run: |
set -euo pipefail
SUDO="$(command -v sudo || true)"
if ! python3 -m venv "$RUNNER_TEMP/docs"; then
$SUDO apt-get update -qq
$SUDO apt-get install -y -qq python3 python3-venv
python3 -m venv --clear "$RUNNER_TEMP/docs"
fi
"$RUNNER_TEMP/docs/bin/pip" install --quiet \
"mkdocs==$MKDOCS_VERSION" "mkdocs-terminal==$MKDOCS_TERMINAL_VERSION" \
"markdown-callouts==$MARKDOWN_CALLOUTS_VERSION" \
"pymdown-extensions==$PYMDOWN_EXTENSIONS_VERSION"
echo "$RUNNER_TEMP/docs/bin" >>"$GITHUB_PATH"
- name: Build
env:
NO_MKDOCS_2_WARNING: "1"
run: bash .github/docs-site.sh "$RUNNER_TEMP/site"
# A worktree shares the checkout's credentials (github.token); the
# branch keeps one commit, the site of the newest main.
- name: Publish to the pages branch
run: |
set -euo pipefail
git config --global user.name "tth-docs"
git config --global user.email "tth-docs@localhost"
wt="$RUNNER_TEMP/pages"
git worktree add -q --detach "$wt"
cd "$wt"
git checkout -q --orphan pages-build
git rm -rqf .
cp -r "$RUNNER_TEMP/site/." .
git add -A
git commit -q -m "docs site from main ${GITHUB_SHA:0:8}"
git push -q -f origin HEAD:refs/heads/pages
echo "published ${GITHUB_SHA:0:8} to pages"
+34 -27
View File
@@ -18,6 +18,9 @@ meshi (869,432 MHz). Upstreamové větve `main` a `dev` se slučují automaticky
dvakrát denně; všechno níže je navíc nad nimi. Náš kód je ve zdrojácích
označený `CUSTOM (TeTeHacko)`. Nic z toho nemění protokol na rádiu.
Dokumentace forku i upstreamu jako web (anglicky, tahle část česky):
https://tth-pub.pages.rfa.cz/meshcore-tth/
### Repeater: antispam (všechno vypínatelné, nic z toho není v upstreamu)
**Po nahrání je zapnutý jen FairnessLimiter**, s limity se zhruba
@@ -32,22 +35,22 @@ vypnuté, dokud je nezapnete.
hash odesílatele, původce advertu). Port návrhu Beanowa
[#1502](https://github.com/meshcore-dev/MeshCore/pull/1502), limity
přepočítané z 30 dní skutečného provozu CZ meshe.
`fairness [on|off|grid|cap|refill]`; přímo směrovaný provoz se neomezuje nikdy.
`fairness <on|off>`, `fairness cap`, `fairness refill`, `fairness grid`; přímo směrovaný provoz se neomezuje nikdy.
* **Okno na adverty podle původce** – flood advert každého uzlu se přepošle
nejvýš jednou za N hodin (`fairness advert <h>|clear`), převzato
nejvýš jednou za N hodin (`fairness advert <hours>`, `fairness advert clear`), převzato
z AdvertLimiteru [DutchMeshCore](https://github.com/Dutch-MeshCore/MeshCore).
Míří na uzly, které advertují každou minutu.
* **Dry-run** – `fairness dryrun on` započítá každý verdikt, ale přepošle
i tak; `fairness air` ukáže ušetřený (nebo ušetřitelný) airtime podle důvodu.
* **Filtr kanálů** – na kanálech, jejichž klíč repeater zná (Public
a `#hashtag` kanály), přestane přeposílat zprávy uvedených jmen odesílatelů
(`filter add|del|list`). Jméno se dá podvrhnout: je to brzda na utrženého
(`filter add <name>`, `filter del <name>`, `filter list`). Jméno se dá podvrhnout: je to brzda na utrženého
bota, ne bezpečnost.
* **Blokace přeposílání podle hashe kanálu** – `filter hash add <hex> [s]`:
* **Blokace přeposílání podle hashe kanálu** – `filter hash add <hex> [secs]`:
bez klíče, takže funguje i na soukromých kanálech; příjem se nemění, jen
přeposílání. S `s` se kanál neodřízne, ale přiškrtí (jeden paket za `s`
sekund).
* **Limit stáří zprávy** – `filter age <min>|off` (volitelné, 1–10080 min):
* **Limit stáří zprávy** – `filter age <minutes>` / `filter age off` (volitelné, 1–10080 min):
nepřeposílá skupinové zprávy na dešifrovaných kanálech, jejichž čas od
odesílatele je starší; bez nastavených hodin repeateru neplatí. Posuzuje
hodiny odesílatele, takže zahodí i companiony bez synchronizace času –
@@ -86,7 +89,7 @@ Repeater navíc:
(vysílací výkon do restartu, s verdiktem RadioLibu), čítače chyb vysílání
ve stavové odpovědi.
* Jen observer varianty (`*-observer`): textová konzole přes BLE vedle USB,
`ble on|off` uložené přes reboot (`RPT_BLE_DEFAULT_OFF`: startuje vypnuté),
`ble <on|off>` uložené přes reboot (`RPT_BLE_DEFAULT_OFF`: startuje vypnuté),
vlastní BLE PIN (`ble pin`), uložený vysílací výkon spojení (`blepwr`),
`bleconn`, neblokující BLE vysílání a parametry spojení, které vydrží i na
slabém linku.
@@ -99,7 +102,7 @@ Repeater navíc:
`!noise`, `!ping`, `!help`, výběr přes `BOT_COMMANDS`, cooldown na
odesílatele, ignore list) – odpovídá, aniž by přeposílal;
* `RADIO_DIAG`: `radiostat` (stav přijímače SX1262 bez zásahu) a
`radiokick rx|clrirq|standby|agc` (jeden krok obnovy, od nejjemnějšího –
`radiokick <rx|clrirq|standby|agc>` (jeden krok obnovy, od nejjemnějšího –
první, který pomůže, ukáže rozbitou vrstvu);
* `PIN_DIAG`: `dio1` (stav přerušení v čipu proti úrovni na pinu – který
konec mrtvé linky DIO1 je přerušený);
@@ -144,10 +147,10 @@ Repeater navíc:
a záznam o hardfaultu přežijí teplý reset (`.noinit`); `clkreboot`.
* Na solárních uzlech žádná blikající LED a pomalejší BLE advertising.
* Stav baterie jako ikona na konci advertovaného jména: `set batt.icon on`,
prahy `set batt.icon.lo|hi <mV>` (výchozí vypnuté; dlouhé jméno ikonu
prahy `set batt.icon.lo <mV>` a `set batt.icon.hi <mV>` (výchozí vypnuté; dlouhé jméno ikonu
nepojme a příkaz na to upozorní).
* Volitelný RX duty cycle (`set radio.rxps off|on|balanced|max`, jemněji
`level <1-10>`; port PowerSaving z EasySkyMesh): SX1262 mezi krátkými okny
* Volitelný RX duty cycle (`set radio.rxps <off|on|balanced|max>`, jemněji
`set radio.rxps level <level>` 1–10; port PowerSaving z EasySkyMesh): SX1262 mezi krátkými okny
poslechu spí. Ve veřejných buildech je zabudovaný a **vypnutý**; `max` na
lavici ušetřil ~2,3 mA bez ztráty paketů ([docs/power.md](docs/power.md)),
na ostrém meshi ale jeden náš stožár ztratil 16 % příjmu – zapínat s rozmyslem. Jen
@@ -161,8 +164,8 @@ Repeater navíc:
([#2088](https://github.com/meshcore-dev/MeshCore/pull/2088)). Výjimkou je
`SenseCap_Solar_repeater` (Li-ion, naše stožáry): pojistka je zapnutá
a oba prahy jdou nastavit za běhu, i přes mesh jako admin –
`set pwr.bootlock <mV>|off` (výchozí 3300, pod ním uzel nenaběhne a spí,
dokud se článek nezotaví) a `set pwr.cutoff <mV>|off` (výchozí vypnuto,
`set pwr.bootlock <mV>` nebo `off` (výchozí 3300, pod ním uzel nenaběhne a spí,
dokud se článek nezotaví) a `set pwr.cutoff <mV>` nebo `off` (výchozí vypnuto,
pod ním se běžící uzel vypne); `get pwr` ([docs/power.md](docs/power.md)).
### Senzory a companiony
@@ -172,8 +175,8 @@ Repeater navíc:
* Senzory, které jinak měří nepřetržitě (INA219, INA226, INA260, INA3221,
BMP280), mezi čteními telemetrie spí a měří jen na vyžádání (nápad a první
patch pro INA219: Alkel Brostl). Čipy INA se rozlišují podle ID, takže
INA226 už se nedetekuje jako INA219. Odpor bočníku se nastavuje za běhu
a ukládá se: `sensor set ina.shunt <mΩ>`.
INA226 už se nedetekuje jako INA219. Odpor bočníku (INA219, INA226, INA3221; INA260 ho má uvnitř) se
nastavuje za běhu a ukládá se: `sensor set ina.shunt <mOhm>`.
* Companion: `gps duty` přežije reboot, kopie data sestavení má hlídanou
délku. Export privátního klíče, čtení BLE PINu a jeho změna (i přes CLI
`set pin`) jdou jen přes spárované BLE, ne přes USB, UART ani WiFi/TCP,
@@ -343,6 +346,9 @@ the CZ mesh (869.432 MHz). Upstream `main` and `dev` are merged automatically
twice a day; everything below is on top of that. Our code is marked
`CUSTOM (TeTeHacko)` in the source. Nothing here changes the wire protocol.
The fork's and upstream's docs as a website:
https://tth-pub.pages.rfa.cz/meshcore-tth/
### Repeater: antispam (all of it off-switchable, none of it upstream)
**After flashing only the FairnessLimiter is on**, with limits about twice
@@ -356,21 +362,21 @@ off until you turn them on.
ids already in the clear (channel hash, sender hash, advert origin). Port of
Beanow's proposal [#1502](https://github.com/meshcore-dev/MeshCore/pull/1502),
limits re-sized from 30 days of real CZ traffic.
`fairness [on|off|grid|cap|refill]`; direct-routed traffic is never limited.
`fairness <on|off>`, `fairness cap`, `fairness refill`, `fairness grid`; direct-routed traffic is never limited.
* **Per-origin advert window** -- each node's flood advert forwarded at most
once per N hours (`fairness advert <h>|clear`), ported from
once per N hours (`fairness advert <hours>`, `fairness advert clear`), ported from
[DutchMeshCore](https://github.com/Dutch-MeshCore/MeshCore)'s AdvertLimiter.
Aimed at nodes that re-advertise every minute.
* **Dry-run** -- `fairness dryrun on` counts every verdict but forwards anyway;
`fairness air` reports the airtime shed (or that would be) per reason.
* **Channel filter** -- on channels whose key the repeater knows (Public and
`#hashtag` channels), stop forwarding messages of listed sender names
(`filter add|del|list`). Names are spoofable: it contains a runaway bot,
(`filter add <name>`, `filter del <name>`, `filter list`). Names are spoofable: it contains a runaway bot,
it is not security.
* **Channel-hash deny-forward** -- `filter hash add <hex> [secs]`: keyless,
works on private channels too; reception is unaffected, only forwarding.
With `secs` the channel is throttled (one packet per `secs`) instead of cut.
* **Message age limit** -- `filter age <min>|off` (opt-in, 1-10080 min): do not
* **Message age limit** -- `filter age <minutes>` / `filter age off` (opt-in, 1-10080 min): do not
forward group texts on the decrypted channels whose sender timestamp is
older; inactive while the repeater clock is unset. It judges the sender's
clock, so companions without a time sync are dropped too -- keep it in days.
@@ -409,7 +415,7 @@ The repeater also has:
`txpwr` (TX power until reboot, with RadioLib's verdict), TX-failure
counters in the status reply.
* Observer variants only (`*-observer`): text console over BLE next to USB,
`ble on|off` saved across reboots (`RPT_BLE_DEFAULT_OFF`: starts off), own
`ble <on|off>` saved across reboots (`RPT_BLE_DEFAULT_OFF`: starts off), own
BLE PIN (`ble pin`), persisted connection TX power (`blepwr`), `bleconn`, a
non-blocking BLE TX pump and connection parameters that hold on a weak
link.
@@ -422,7 +428,7 @@ The repeater also has:
`!noise`, `!ping`, `!help`, narrowed by `BOT_COMMANDS`, per-sender
cooldown, ignore list) -- answers without repeating;
* `RADIO_DIAG`: `radiostat` (SX1262 receiver state, hands off) and
`radiokick rx|clrirq|standby|agc` (one recovery step at a time, gentlest
`radiokick <rx|clrirq|standby|agc>` (one recovery step at a time, gentlest
first -- the first that helps names the broken layer);
* `PIN_DIAG`: `dio1` (the chip's IRQ status against the level on the pin --
which end of a dead DIO1 line is broken);
@@ -467,10 +473,10 @@ The repeater also has:
hardfault record survive a warm reset (`.noinit`); `clkreboot`.
* No blinking LED and slower BLE advertising on solar nodes.
* Battery level as an icon at the end of the advertised name: `set batt.icon
on`, thresholds `set batt.icon.lo|hi <mV>` (off by default; a long name has
on`, thresholds `set batt.icon.lo <mV>` and `set batt.icon.hi <mV>` (off by default; a long name has
no room for it and the command says so).
* Optional RX duty cycle (`set radio.rxps off|on|balanced|max`, finer
`level <1-10>`; ported from EasySkyMesh PowerSaving): the SX1262 sleeps
* Optional RX duty cycle (`set radio.rxps <off|on|balanced|max>`, finer
`set radio.rxps level <level>` 1-10; ported from EasySkyMesh PowerSaving): the SX1262 sleeps
between short listening windows. Built into the public releases and
**off**; `max` saved ~2.3 mA on the bench with no packet loss
([docs/power.md](docs/power.md)), but on the live mesh one of our masts lost
@@ -485,8 +491,8 @@ The repeater also has:
for upstream ([#2088](https://github.com/meshcore-dev/MeshCore/pull/2088)). The exception
is `SenseCap_Solar_repeater` (Li-ion, our masts): the lock is on and both
thresholds are settable at runtime, also as an admin over the mesh --
`set pwr.bootlock <mV>|off` (default 3300; below it the node does not start
and sleeps until the cell recovers) and `set pwr.cutoff <mV>|off` (default
`set pwr.bootlock <mV>` or `off` (default 3300; below it the node does not start
and sleeps until the cell recovers) and `set pwr.cutoff <mV>` or `off` (default
off; below it a running node switches off); `get pwr`
([docs/power.md](docs/power.md)).
@@ -497,8 +503,9 @@ The repeater also has:
* Sensors that would otherwise convert continuously (INA219, INA226, INA260,
INA3221, BMP280) sleep between telemetry reads and measure on demand (idea
and first INA219 patch: Alkel Brostl). INA chips are told apart by their ID,
so an INA226 is no longer taken for an INA219. The shunt is set at runtime
and saved: `sensor set ina.shunt <mOhm>`.
so an INA226 is no longer taken for an INA219. The shunt (INA219, INA226,
INA3221; the INA260 has it inside) is set at runtime and saved:
`sensor set ina.shunt <mOhm>`.
* Companion: `gps duty` persists, bounded build-date copy. Private key
export, reading the BLE PIN and changing it (CLI `set pin` included) work
only over paired BLE, never over USB, a UART or WiFi/TCP, and the reply that
+36
View File
@@ -0,0 +1,36 @@
/* Docs site of the meshcore-tth fork (mkdocs.tth.yml, theme mkdocs-terminal,
palette "dark"): only what the palette lacks. Green instead of its blue,
and the GitHub callouts (> [!WARNING]) the theme does not style. */
:root {
--primary-color: #5fd38d;
--progress-bar-fill: #5fd38d;
/* plain black; the palette's 60em column was a thin noodle on a wide
screen (user, 2. 12. 2026) */
--background-color: #000;
--invert-font-color: #000;
--code-bg-color: #161616;
--page-width: min(110em, 94vw);
}
.admonition {
border: 1px solid var(--secondary-color);
padding: 0.2em 1em;
margin: var(--global-line-height) 0;
}
.admonition-title {
font-weight: bold;
margin: 0.4em 0 0;
}
.admonition.warning, .admonition.caution, .admonition.danger {
border-color: #e5a50a;
}
.admonition.warning > .admonition-title,
.admonition.caution > .admonition-title,
.admonition.danger > .admonition-title {
color: #e5a50a;
}
.admonition.note > .admonition-title,
.admonition.tip > .admonition-title,
.admonition.important > .admonition-title {
color: var(--primary-color);
}
+1 -1
View File
@@ -198,7 +198,7 @@ know whether a change like `f6e9aeca` (widening the requested interval to
from the last one; before any client has ever connected it answers
`nothing seen yet`.
### `blepwr [dBm]` — connection TX power, saved
### `blepwr [dBm|default]` — connection TX power, saved
```
blepwr # report: BLE conn tx: 0 dBm, adv tx: 8 dBm
+41 -9
View File
@@ -6,6 +6,7 @@ This document provides an overview of CLI commands that can be sent to MeshCore
- [Operational](#operational)
- [Neighbors](#neighbors-repeater-only)
- [Posts](#posts-room-server-only)
- [Statistics](#statistics)
- [Logging](#logging)
- [Information](#info)
@@ -43,6 +44,8 @@ This document provides an overview of CLI commands that can be sent to MeshCore
---
### Reset the clock and reboot
*meshcore-tth addition.*
**Usage:**
- `clkreboot`
@@ -73,7 +76,7 @@ locally.
**Reply:** `HH:MM - D/M/YYYY UTC (epoch <seconds>)`
The epoch is a TeTeHacko addition. The human part is minutes only, so a host
The epoch is a meshcore-tth addition. The human part is minutes only, so a host
comparing clocks cannot see a difference smaller than a minute and has to leave
a deadband of over 59 s; the epoch makes the comparison exact. It is appended,
so anything that only prints the reply is unaffected.
@@ -164,6 +167,19 @@ in order of preference:
---
## Posts (Room Server Only)
### Post a message as the room server
**Usage:**
- `room.post <message>`
**Parameters:**
- `message`: The text of the post
**Note:** The post is stored and pushed to logged-in clients like a client's post, with the room server as its author.
---
## Statistics
### Clear Stats
@@ -384,13 +400,13 @@ Refer to the node's manual for the correct settings to use.
#### Show battery state as an icon on the advertised name
*(TeTeHacko fork)* Appends a solar marker and a charge level to the name
*meshcore-tth addition.* Appends a solar marker and a charge level to the name
carried in adverts, so anyone who hears the node can see its state without
logging in for telemetry. Off by default.
**Usage:**
- `get batt.icon`
- `set batt.icon on|off`
- `set batt.icon <on|off>`
**Default:** `off`
@@ -417,6 +433,8 @@ changes roughly once a week.
---
#### Battery scale for the name icon
*meshcore-tth addition.*
**Usage:**
- `get batt.icon.lo` / `set batt.icon.lo <millivolts>`
- `get batt.icon.hi` / `set batt.icon.hi <millivolts>`
@@ -567,12 +585,16 @@ so the icon and the Grafana percentage tell one story.
---
#### View or change the RX duty cycle (rxps) -- CUSTOM (TeTeHacko)
#### View or change the RX duty cycle (rxps)
*meshcore-tth addition.*
**Usage:**
- `get radio.rxps`
- `set radio.rxps off|on|balanced|max`
- `set radio.rxps level <1-10> [preamble <16|32>]`
- `set radio.rxps max preamble <16|32>`
- `set radio.rxps <off|on|balanced|max|overdrive|riskyWorkingMax>`
- `set radio.rxps <max|overdrive|riskyWorkingMax> preamble <16|32>`
- `set radio.rxps level <level> [preamble <16|32>]`
- `set radio.rxps <level>`
- `set radio.rxps <rx_us> <sleep_us>`
The SX1262 sleeps between short listening windows (`SetRxDutyCycle`) instead
of listening all the time, and stays awake through a packet once it hears a
@@ -586,7 +608,7 @@ off until you set it; the setting is saved.
higher the level, the longer the sleep. The named presets assume senders
with a 16-symbol preamble (the MeshCore default), so they are safe on a
mixed mesh.
- `level <n>`: the same scale by number; without `preamble` it follows the SF.
- `level`: the same scale by number, 1..10; without `preamble` it follows the SF.
9 (`overdrive`) and 10 (`riskyWorkingMax`) are past the datasheet's timing
condition -- 10 is known to lose packets.
- `<rx_us> <sleep_us>`: raw window lengths.
@@ -783,6 +805,8 @@ also runs in continuous RX.
---
#### Radio silence watchdog (repeater, sensor, room server)
*meshcore-tth addition.*
**Usage:**
- `get radio.silence`
- `set radio.silence <minutes>`
@@ -800,6 +824,8 @@ To keep a quiet site out of a reboot loop, each such reboot doubles the threshol
---
#### TX stall watchdog (repeater)
*meshcore-tth addition.*
**Usage:**
- `get radio.txstall`
- `set radio.txstall <minutes>`
@@ -814,6 +840,8 @@ To keep a quiet site out of a reboot loop, each such reboot doubles the threshol
---
#### Reboot into the bootloader (repeater, sensor, room server; nRF52, local console only)
*meshcore-tth addition.*
**Usage:**
- `dfu [uf2|serial|ota]`
@@ -822,6 +850,8 @@ To keep a quiet site out of a reboot loop, each such reboot doubles the threshol
---
#### Why the board last reset (repeater, sensor, room server)
*meshcore-tth addition.*
**Usage:**
- `get boot`
@@ -1213,7 +1243,7 @@ region save
**Note:** In duty-cycle mode `gps` answers `duty, {awake|asleep}, {fix|no fix}, {sat count} sats`.
`gps duty` powers the receiver only around a clock sync and cuts it in between.
*meshcore-tth addition:* `gps duty` powers the receiver only around a clock sync and cuts it in between.
It is meant for a node that runs GPS purely to keep its (volatile) RTC set — a
mast or solar repeater — where a receiver drawing tens of mA continuously
dwarfs the rest of the power budget. Unlike `gps period`, every attempt is
@@ -1364,6 +1394,8 @@ Covers serial NMEA receivers (`MicroNMEALocationProvider`).
---
#### Set the INA current sensor's shunt resistor
*meshcore-tth addition.*
**Usage:**
- `sensor get ina.shunt`
- `sensor set ina.shunt <mOhm>`
+1
View File
@@ -22,6 +22,7 @@ Once you have a working app/project, you need to be able to demonstrate it exist
| 0140 | Nelos | support@nelos.app — https://nelos.app |
| 0150 | Road Events | juraj@bednar.io — https://github.com/jooray/roadbeacon/blob/main/nips/road-events.md |
| 0160 | Knit | jeff@getknit.app — https://getknit.app |
| 0170 | MeshTrax | venahamtrack@gmail.com — https://github.com/venamartin/meshtrax |
| FF00 - FFFF | -reserved for testing/dev- | |
(add rows, inside the range 0100 - FEFF for custom apps)
+3 -3
View File
@@ -212,10 +212,10 @@ wired in `variants/sensecap_solar`) and `PWRMGT_RUNTIME` (ours), which gives
two thresholds, both saved on the node and settable from the console or as an
admin over the mesh:
| | default | |
| command | default | what |
|---|---|---|
| `set pwr.bootlock <mV>\|off` | 3300 mV (`variant.h`) | at boot, below it the node goes to SYSTEMOFF and the LPCOMP wakes it when the battery recovers |
| `set pwr.cutoff <mV>\|off` | off | while running, three readings in a row (one a minute) below it switch the node off into the same SYSTEMOFF |
| `set pwr.bootlock <mV>` | 3300 mV (`variant.h`) | 3000..4200 or `off`; at boot, below it the node goes to SYSTEMOFF and the LPCOMP wakes it when the battery recovers |
| `set pwr.cutoff <mV>` | off | 3000..4200 or `off`; while running, three readings in a row (one a minute) below it switch the node off into the same SYSTEMOFF |
| `get pwr` | | both, the battery now and at boot, USB, the reason of the last switch-off |
The cutoff must stay below the bootlock -- a node switched off at the cutoff
+80 -50
View File
@@ -9,6 +9,10 @@ Everything this fork adds to the text console of a node, on top of upstream's
(the watchdogs, `rxps`, `batt.icon`, `gps duty`, `dfu`, `get boot`), this page
gives the short form and points to it.
**How commands are written** (as in cli_commands.md): `<value>` is required,
`[value]` optional, `<on|off>` one of the listed words. One command per line;
ranges, units and defaults are in the description.
**Where a command exists** depends on the role and on build flags:
| mark | builds |
@@ -33,18 +37,19 @@ Token buckets on forwarded floods, keyed on the 1-byte ids already in the
clear: channel hash, sender hash, advert origin. Buckets collide (the hash is
masked), and every key is chosen by the sender: it contains runaway floods,
it is not security. Direct-routed traffic is never limited.
**On after flashing** (`FAIRNESS_ENABLED_DEFAULT`).
| command | |
| command | what |
|---|---|
| `fairness` | state, denials per category, caps and refill intervals |
| `fairness on\|off` | the buckets on/off |
| `fairness cap <group> <sender> <advert>` | burst caps 0..255, `0` = build default (100 / 150 / 30) |
| `fairness refill <group_s> <sender_s> <advert_s>` | one token per interval, seconds, `0` = default (30 / 10 / 600) |
| `fairness <on\|off>` | the buckets on or off. Default: on (`FAIRNESS_ENABLED_DEFAULT`) |
| `fairness cap <group> <sender> <advert>` | burst caps, 0..255 each; `0` = build default (100 / 150 / 30) |
| `fairness refill <group> <sender> <advert>` | one token per interval, seconds, 0..65535 each; `0` = build default (30 / 10 / 600) |
| `fairness grid` | the busiest denied buckets per category -- what is being shed |
| `fairness air` | estimated airtime shed per reason |
| `fairness advert [<hours>\|clear]` | per-origin advert window: one flood advert per origin per `<hours>` (0..720, `0` = off, default off); `clear` forgets the origins seen |
| `fairness dryrun [on\|off]` | count every verdict but forward anyway (default off) |
| `fairness advert` | the per-origin advert window: hours, held adverts, cache |
| `fairness advert <hours>` | one flood advert per origin per `hours`, 0..720; `0` = off. Default: off |
| `fairness advert clear` | forget the origins seen |
| `fairness dryrun [on\|off]` | count every verdict but forward anyway; without an argument shows the state. Default: off |
The defaults keep about twice the headroom over 30 days of CZ mesh traffic
(the zero-loss frontier was 60 s / cap 60 per channel, 10 s / 60 per sender,
@@ -57,11 +62,12 @@ know Public, `#meshcore` and `#test`) the node decrypts each group text and
refuses to forward listed senders. The sender name is plain text in the
message: anyone can rename around it.
| command | |
| command | what |
|---|---|
| `filter` / `filter list` | channels known, drops, the deny list |
| `filter add <name>` / `filter del <name>` | exact, case-insensitive; spaces allowed, commas not |
| `filter clear` | empty the list |
| `filter [list]` | channels known, drops, the deny list |
| `filter add <name>` | deny a sender name: exact, case-insensitive; spaces allowed, commas not |
| `filter del <name>` | remove a name from the deny list |
| `filter clear` | empty the deny list |
### Channel-hash deny-forward -- `filter hash` (every repeater)
@@ -70,41 +76,48 @@ so this works on private channels too. One byte is coarse -- every other
channel whose key hashes to the same byte is hit as well; check what else
lives on it before adding one.
| command | |
| command | what |
|---|---|
| `filter hash` | drops, passes by a throttle, the list (`43` blocked, `43/60` throttled) |
| `filter hash add <hex> [secs]` | block the byte, or let one packet through per `secs` (1..65535); re-adding changes the interval |
| `filter hash del <hex>` / `filter hash clear` | |
| `filter hash [list]` | drops, passes by a throttle, the list (`43` blocked, `43/60` throttled) |
| `filter hash add <hex> [secs]` | block the byte, or with `secs` (1..65535) let one packet through per `secs`; re-adding changes the interval |
| `filter hash del <hex>` | remove one byte |
| `filter hash clear` | empty the list |
A throttle's window lives in RAM: the first match after a boot passes.
### Message age -- `filter age` (repeater with channel keys)
`filter age <min>|off` (1..10080, default off): do not forward a group text
on a decrypted channel whose sender timestamp is older than `<min>` by this
node's clock. It judges the sender's clock, so a companion that never got a
time sync (it stamps 2024) is dropped too -- keep it in days. Inactive while
the node's own clock reads before 2026; a clock running ahead makes
everything look old.
| command | what |
|---|---|
| `filter age` | the limit and how many were dropped |
| `filter age <minutes>` | do not forward a group text on a decrypted channel whose sender timestamp is older than `minutes` (1..10080) by this node's clock |
| `filter age off` | no age limit. Default: off |
### `filter dryrun [on|off]`
It judges the sender's clock, so a companion that never got a time sync (it
stamps 2024) is dropped too -- keep it in days. Inactive while the node's own
clock reads before 2026; a clock running ahead makes everything look old.
Count every `filter` verdict (sender, hash, age) but forward anyway -- try a
rule on a live node before it bites. Default off.
### Dry run -- `filter dryrun`
| command | what |
|---|---|
| `filter dryrun [on\|off]` | count every `filter` verdict (sender, hash, age) but forward anyway -- try a rule on a live node before it bites; without an argument shows the state. Default: off |
## Radio watchdogs and board upkeep (all)
Details: [cli_commands.md](cli_commands.md), "Radio silence watchdog", "TX
stall watchdog", "Reboot into the bootloader" and "Why the board last reset".
| command | |
| command | what |
|---|---|
| `set radio.silence <min>\|off` / `get radio.silence` | deaf receiver: re-arm RX, then reboot after `<min>` without a received frame (CRC errors count as heard); each such reboot doubles the threshold for the next boot (up to 16x), the first frame clears it. 1..1440, persisted, **default off** |
| `set radio.txstall <min>\|off` / `get radio.txstall` | repeater only: packets queued and nothing sent for `<min>` -> re-arm, then reboot. An empty queue never counts. **On, 15 min** (`RADIO_TXSTALL_MIN`); a change holds until reboot |
| `get radio.silence` | threshold, current multiplier, quiet time, stage |
| `set radio.silence <minutes>` | deaf receiver: re-arm RX, then reboot after `minutes` (1..1440) without a received frame (CRC errors count as heard); each such reboot doubles the threshold for the next boot (up to 16x), the first frame clears it. `0` or `off` = off. Saved. Default: off |
| `get radio.txstall` | threshold, queue, time without TX, stage |
| `set radio.txstall <minutes>` | repeater only: packets queued and nothing sent for `minutes` (1..1440) -> re-arm, then reboot. An empty queue never counts. `0` or `off` = off. Not saved: a reboot returns to the build value. Default: 15 (`RADIO_TXSTALL_MIN`) |
| `get radio.reboots` | reboots done by the watchdogs, survives power loss |
| `get boot` | reset reason and the hardfault record (also printed at boot) |
| `dfu [uf2\|serial\|ota]` | *local only*: reboot into the bootloader -- UF2 drive (default), CDC port for `adafruit-nrfutil`, or BLE DFU |
| `fw ...` | `-ota` images only: admin-pushed firmware update, see [ota.md](ota.md) |
| `dfu [uf2\|serial\|ota]` | *local only*, nRF52: reboot into the bootloader -- UF2 drive (default), CDC port for `adafruit-nrfutil`, or BLE DFU |
| `fw <subcommand>` | `-ota` images only: admin-pushed firmware update, see [ota.md](ota.md) |
## Number arguments of `set` (all, and the companion's serial CLI)
@@ -123,15 +136,17 @@ tz.offset`. No exponent (`1e3`), no `nan`/`inf`.
## Diagnostics
| command | where | |
| command | where | what |
|---|---|---|
| `blink [n]` / `blink on\|off` | repeater | flash a spare LED (not the BLE or TX one) `n` times (default 6, max 999), or until `blink off` (gives up after 10 min); finds a board on a bench or a node on a mast |
| `txpwr [dBm]` | repeater | LoRa output power until reboot, with RadioLib's status; takes -9..30 |
| `blink [count]` | repeater | flash a spare LED (not the BLE or TX one) `count` times (1..999, default 6); finds a board on a bench or a node on a mast |
| `blink <on\|off>` | repeater | blink until `blink off` (gives up after 10 min) |
| `txpwr` | repeater | the last requested LoRa output power and RadioLib's status |
| `txpwr <dBm>` | repeater | LoRa output power until reboot, -9..30 (SX1262 takes -9..22), with RadioLib's status |
| `i2c` | all | scan the I2C bus |
| `get chip` | nRF52 (repeater, room server, sensor) | the silicon (`nRF52840 AAD0`; variant `xxF0` and later = rev3) and `UICR.APPROTECT`: `open` means SWD can read the whole flash, keys included ([locked-bootloader.md](locked-bootloader.md)) |
| `get chip` | nRF52 (repeater, room server, sensor) | the silicon (`nRF52840 AAD0`; variant `xxF0` and later = rev3) and `UICR.APPROTECT`: `open` means SWD can read the whole flash, keys included |
| `dio1` | own build: `PIN_DIAG` | has the SX1262 raise TX_DONE and compares its IRQ register with the level on the DIO1 pin -- which end of a dead IRQ line is broken |
| `radiostat` | own build: `RADIO_DIAG` | receiver state, interrupt and RX counters, without touching the radio |
| `radiokick rx\|clrirq\|standby\|agc` | own build: `RADIO_DIAG` | one recovery step, gentlest first: re-arm RX, clear latched IRQs, standby + RX, AGC reset; the first that brings `recv` back names the broken layer |
| `radiokick <rx\|clrirq\|standby\|agc>` | own build: `RADIO_DIAG` | one recovery step, gentlest first: re-arm RX, clear latched IRQs, standby + RX, AGC reset; the first that brings `recv` back names the broken layer |
A board with a dead DIO1 line still runs with `LORA_POLL_IRQ` (own build):
the IRQ status is polled over SPI.
@@ -142,12 +157,15 @@ The text console over BLE (Nordic UART), next to USB. No login of its own:
the BLE PIN is the only lock, and the release PIN is the public placeholder
`123456`. These commands also work as admin over the mesh.
| command | |
| command | what |
|---|---|
| `ble` | on/off, PIN `own` or `build default` -- never the PIN itself |
| `ble pin <6 digits>` | set your own PIN (saved, survives a reflash; drops every bond, so paired devices pair again) |
| `ble on\|off` | persisted; **off after flashing** (`RPT_BLE_DEFAULT_OFF`), and `ble on` is refused while the PIN is the placeholder |
| `blepwr [dBm\|default]` | TX power of the connection (-40, -20, -16, -12, -8, -4, 0, 2..8), applied to live connections and saved; `default` returns to the build value (0 dBm) |
| `ble` | on or off, PIN `own` or `build default`, connected or not -- never the PIN itself |
| `ble <on\|off>` | the BLE console on or off, saved. Default: off (`RPT_BLE_DEFAULT_OFF`); `ble on` is refused while the PIN is the placeholder |
| `ble pin` | whether the PIN is your own or the build default |
| `ble pin <pin>` | set your own PIN, 6 digits (saved, survives a reflash; drops every bond, so paired devices pair again) |
| `blepwr` | TX power of the connection and of advertising |
| `blepwr <dBm>` | TX power of the connection: -40, -20, -16, -12, -8, -4, 0, 2..8; applied to live connections and saved |
| `blepwr default` | back to the build value (0 dBm) |
| `bleconn` | what the central actually agreed to: interval (and what was requested), latency, supervision timeout |
A connected central stops the node advertising: if the BLE console cannot be
@@ -155,9 +173,9 @@ found, look for who is connected (`ble` shows it).
## Passive analyzer (observer)
| command | |
| command | what |
|---|---|
| `nodes [offset]` | heard repeaters and room servers with a key to join several paths, paged |
| `nodes [offset]` | heard repeaters and room servers with a key to join several paths, paged from `offset` |
| `rxlog [cursor]` | every frame heard: type, path, SNR, RSSI; `cursor` from the previous page (`0` = all) |
| `pktlog [cursor]` | raw frames heard, for an observer feed ([meshcore-repeater-observer](https://git.rfa.cz/tth-pub/meshcore-repeater-observer)) |
@@ -173,27 +191,39 @@ console shows its state.
## Power and clock
| command | where | |
| command | where | what |
|---|---|---|
| `set radio.rxps off\|on\|balanced\|max`, `level <1-10> [preamble 16\|32]` / `get radio.rxps` | all, SX1262 only (`WITH_RX_POWERSAVING`, in the releases) | RX duty cycle: the radio sleeps between short listening windows. **Off by default.** `max` saved ~2.3 mA on the bench, but a mast on the live mesh lost 16 % of its reception -- see cli_commands.md and [power.md](power.md) |
| `set batt.icon on\|off`, `set batt.icon.lo\|hi <mV>` | all | battery level as an icon at the end of the advertised name (off by default; with a name too long for it the icon is left out, and the reply says so) |
| `gps duty ...` | GPS boards | the receiver runs only around a clock sync; see cli_commands.md |
| `get pwr`, `set pwr.bootlock <mV>\|off`, `set pwr.cutoff <mV>\|off` | SenseCAP Solar repeater (`PWRMGT_RUNTIME`) | battery thresholds: don't start below the bootlock, switch a running node off below the cutoff (cutoff < bootlock, none above the battery right now); saved on the node, see [power.md](power.md) |
| `get radio.rxps` | all, SX1262 only (`WITH_RX_POWERSAVING`, in the releases) | requested and effective RX duty cycle, window lengths, error counters |
| `set radio.rxps <off\|on\|balanced\|max>` | same | RX duty cycle: the radio sleeps between short listening windows. Presets: `on` = level 3, `balanced` = 6, `max` = 8. Saved. Default: off |
| `set radio.rxps level <level> [preamble <16\|32>]` | same | the same by number, 1..10 (9 and 10 are past the datasheet's timing condition, 10 is known to lose packets) |
| `set radio.rxps <rx_us> <sleep_us>` | same | raw window lengths |
| `get batt.icon` | all | whether the icon is on, and whether the name leaves room for it |
| `set batt.icon <on\|off>` | all | battery level as an icon at the end of the advertised name; with a name too long for it the icon is left out, and the reply says so. Default: off |
| `set batt.icon.lo <mV>` | all | the empty end of the icon's scale, 2500..4500; `0` = build default (3300) |
| `set batt.icon.hi <mV>` | all | the full end, 2500..4500; `0` = build default (4200) |
| `gps duty` | GPS boards | the receiver runs only around a clock sync; `gps on` / `gps off` leave it. See cli_commands.md |
| `get pwr` | SenseCAP Solar repeater (`PWRMGT_RUNTIME`) | both thresholds, the battery now and at boot, why the node last switched off |
| `set pwr.bootlock <mV>` | same | do not start below this voltage, 3000..4200 or `off`; saved on the node, see [power.md](power.md) |
| `set pwr.cutoff <mV>` | same | switch a running node off below this voltage, 3000..4200 or `off`. Must stay under the bootlock; neither may be above the battery right now |
| `clkreboot` | all | reset the clock to the build epoch and reboot -- the only way to move a clock backwards (`time` and `clock sync` refuse to) |
RX duty cycle: `max` saved ~2.3 mA on the bench, but a mast on the live mesh
lost 16 % of its reception -- see cli_commands.md and [power.md](power.md).
## Sensors
| command | |
| command | what |
|---|---|
| `sensor read` | the live telemetry decoded into one line (`sensor list` shows only settings) |
| `sensor set ina.shunt <mOhm>` | shunt resistance of an INA219/226/260/3221, saved across reboots |
| `sensor get ina.shunt` | the shunt the current is computed with |
| `sensor set ina.shunt <mOhm>` | shunt resistance of an INA219, INA226 or INA3221 module (`10` for `R010`), saved; `0` = build default (100). The INA260 has its shunt inside and no setting |
## Build flags
The ones that change what a node does; set in `platformio.ini` /
`platformio.local.ini` (`-D NAME=value`, the last `-D` wins).
| flag | default | |
| flag | default | what |
|---|---|---|
| `FAIRNESS_ENABLED_DEFAULT` | `1` | FairnessLimiter on for a node without prefs |
| `RADIO_SILENCE_MIN_DEFAULT` | `0` | deaf-receiver watchdog for a node without prefs |
@@ -206,7 +236,7 @@ The ones that change what a node does; set in `platformio.ini` /
| `FW_OTA` | `-ota` images | admin-pushed firmware update |
| `PATH_HASH_MODE_DEFAULT` | `1` (2 B per hop) | path hash width for a node without prefs |
| `ACL_TS_MAX_AHEAD` | `86400` (s) | a client timestamp further ahead of the node's clock is not stored as the replay floor |
| `LOCKED_NODE` | unset | a node that keeps its secrets from whoever holds it: `get prv.key`, `get guest.password` and `get bridge.secret` answer `Error: locked build` to everyone (USB and BLE console, an admin over the mesh); a companion serves only paired BLE (USB, UART and WiFi get the device info and nothing else) and its rescue CLI refuses `set pin`. Only half of it: [locked-bootloader.md](locked-bootloader.md) |
| `LOCKED_NODE` | unset | a node that keeps its secrets from whoever holds it: `get prv.key`, `get guest.password` and `get bridge.secret` answer `Error: locked build` to everyone (USB and BLE console, an admin over the mesh); a companion serves only paired BLE (USB, UART and WiFi get the device info and nothing else) and its rescue CLI refuses `set pin`. Only half of it: whoever can rewrite the flash (SWD with `APPROTECT` open, an unsigned DFU) still gets the keys -- the other half is a locked bootloader (SWD closed, signed images only), which these builds do not have |
| `LOGIN_FAIL_MAX`, `LOGIN_FAIL_SECS` | `4`, `180` (s) | after that many wrong passwords in the window no password is checked until it ends (an admin already in the ACL always gets in) |
| `NRF52_POWER_MANAGEMENT`, `PWRMGT_RUNTIME` | upstream: off; on in `SenseCap_Solar_repeater` (the masts) | boot protection, and with `PWRMGT_RUNTIME` the runtime `pwr.bootlock` / `pwr.cutoff` above |
| `PWRMGT_BOOTLOCK_DEFAULT`, `PWRMGT_CUTOFF_DEFAULT` | `PWRMGT_VOLTAGE_BOOTLOCK` (SenseCAP 3300), `0` (mV) | thresholds for a node without `/pwr_guard` |
+13 -18
View File
@@ -1146,11 +1146,7 @@ void MyMesh::handleCmdFrame(size_t len) {
text[tlen] = 0; // ensure null
reply_buf[0] = 0;
if (memcmp(text, "set pin ", 8) == 0 && !_serial->isConnectionSecure()) {
// CUSTOM (TeTeHacko): the same gate as CMD_SET_DEVICE_PIN -- through the
// CLI, USB set the PIN it may not set directly, then paired over BLE
strcpy(reply_buf, "Error: set pin only over paired BLE");
} else if (!handleCommand(text, 0, reply_buf)) {
if (!handleCommand(text, 0, reply_buf)) {
strcat(reply_buf, "Unknown command"); // reply_buf may have cmd prefix from 'text'
}
out_frame[0] = RESP_CODE_CLI_REPLY;
@@ -2130,14 +2126,7 @@ void MyMesh::enterCLIRescue() {
extern "C" void retainedClockInvalidate() __attribute__((weak)); // NRF52Board.cpp
bool MyMesh::handleCommand(const char* command, uint32_t sender_timestamp, char* reply) {
while (*command == ' ') command++; // skip leading spaces
if (strlen(command) > 4 && command[2] == '|') { // optional prefix (for companion radio CLI)
memcpy(reply, command, 3); // reflect the prefix back
reply += 3;
*reply = 0;
command += 3;
}
cli_args::stripPrefix(command, reply);
if (_prefs.getRadioPrefs()->handleCommand(command, sender_timestamp, reply)) { // is radio CLI command?
if (_prefs.getRadioPrefs()->isDirty()) { savePrefs(); }
@@ -2211,6 +2200,17 @@ bool MyMesh::handleCommand(const char* command, uint32_t sender_timestamp, char*
#endif
if (memcmp(command, "set pin ", 8) == 0) {
const char* err = nullptr;
#ifdef LOCKED_NODE
const bool locked = true;
#else
const bool locked = false;
#endif
if (!cli_args::canSetPin(sender_timestamp, _cli_rescue, locked,
_serial && _serial->isConnectionSecure(), &err)) {
strcpy(reply, err);
return true;
}
long pin; // atoi(): "abc" was PIN 0, i.e. a random one
if (!cli_args::parseInt(&command[8], 0, 999999, &pin)) {
strcpy(reply, "Error, PIN must be 0-999999");
@@ -2495,11 +2495,6 @@ void MyMesh::checkCLIRescueCmd() {
cli_command[len - 1] = 0; // replace newline with C string null terminator
reply_buf[0] = 0;
#ifdef LOCKED_NODE
if (memcmp(cli_command, "set pin ", 8) == 0) { // CUSTOM (TeTeHacko): a known PIN = pair and read it all
Serial.println(" Error: locked build");
} else
#endif
if (handleCommand(cli_command, 0, reply_buf)) {
// command was handled, print reply output
Serial.print(" "); Serial.print(reply_buf); Serial.println();
+6 -11
View File
@@ -1,5 +1,6 @@
#include "MyMesh.h"
#include <algorithm>
#include <helpers/CliArgs.h>
#include <helpers/sensors/LPPDataHelpers.h>
#include <helpers/UTF8Helpers.h>
@@ -219,9 +220,7 @@ void MyMesh::formatNodesReply(char* reply, int max_len, uint16_t offset) {
prefix, (unsigned)n->type, (long)n->lat, (long)n->lon,
(int)n->snr, (int)n->rssi, (unsigned long)(now - n->heard_timestamp),
(unsigned long)n->pkt_hash, pathhex, n->name);
int ll = strlen(line);
if (i > offset && (dp - reply) + ll + 24 > max_len) break; // room for trailer; always emit >=1
memcpy(dp, line, ll); dp += ll;
if (!cli_args::appendLine(dp, reply, max_len, 24, line)) break; // room for trailer; never overflow reply
}
dp += sprintf(dp, "E,%d,%d", i, total);
*dp = 0;
@@ -276,9 +275,7 @@ void MyMesh::formatRxLogReply(char* reply, int max_len, uint32_t cursor) {
(unsigned long)r->seq, (unsigned long)r->when,
(unsigned long)r->pkt_hash, (unsigned)r->header,
(int)r->snr, (int)r->rssi, pathhex);
int ll = strlen(line);
if (i > 0 && (dp - reply) + ll + 40 > max_len) break; // room for trailer; always emit >=1
memcpy(dp, line, ll); dp += ll;
if (!cli_args::appendLine(dp, reply, max_len, 40, line)) break; // room for trailer; never overflow reply
last = r->seq;
}
dp += sprintf(dp, "E,%lu,%lu,%lu", (unsigned long)last, (unsigned long)oldest, (unsigned long)newest);
@@ -1931,11 +1928,9 @@ void MyMesh::handleCommand(uint32_t sender_timestamp, char *command, char *reply
}
#endif
if (strlen(command) > 4 && command[2] == '|') { // optional prefix (for companion radio CLI)
memcpy(reply, command, 3); // reflect the prefix back
reply += 3;
command += 3;
}
const char* cmd = command;
cli_args::stripPrefix(cmd, reply, &reply_max);
command = const_cast<char*>(cmd);
// handle ACL related commands
if (memcmp(command, "setperm ", 8) == 0) { // format: setperm {pubkey-hex} {permissions-int8}
+61
View File
@@ -0,0 +1,61 @@
# Docs website of this fork (https://tth-pub.pages.rfa.cz/meshcore-tth/),
# built by .github/docs-site.sh. Its own file, not an INHERIT of upstream's
# mkdocs.yml (that one is Material: logo, features, palette): theme
# mkdocs-terminal, palette "dark" with docs/_stylesheets/tth.css on top.
site_name: MeshCore TTH
site_url: https://tth-pub.pages.rfa.cz/meshcore-tth/
site_description: MeshCore fork meshcore-tth -- repeater antispam, diagnostics, OTA, Czech mesh defaults
repo_name: tth-pub/meshcore-tth
repo_url: https://git.rfa.cz/tth-pub/meshcore-tth
edit_uri: src/branch/main/docs/
theme:
name: terminal
palette: dark
features:
# no blinking cursor after the site name (user, 2. 12. 2026)
- navigation.top.cursor_animation.hide
- navigation.side.indexes
extra_css:
- _stylesheets/tth.css
plugins:
- search
markdown_extensions:
- admonition
- github-callouts
- attr_list
- tables
- toc
- pymdownx.details
- pymdownx.superfences
# One language for the site: English (every doc in docs/ is English); the
# Czech half of the README is one page, "Česky", in the top bar. Titles in
# both languages side by side were confusing (user, 2. 12. 2026).
nav:
- About the fork: index.md
- Česky: cs.md
- Fork meshcore-tth:
- Console commands: tth-commands.md
- Firmware update by the admin (OTA): ota.md
- Power saving: power.md
- Budka as a sensor: budka-sensor.md
- BLE/LoRa coexistence: ble-lora-coexistence.md
- MeshCore (upstream):
- Introduction: meshcore.md
- FAQ: faq.md
- CLI commands: cli_commands.md
- Companion CLI: companion_cli.md
- Companion protocol: companion_protocol.md
- Terminal chat CLI: terminal_chat_cli.md
- KISS modem protocol: kiss_modem_protocol.md
- Packet format: packet_format.md
- Payloads: payloads.md
- Stats binary frames: stats_binary_frames.md
- Number allocations: number_allocations.md
- QR codes: qr_codes.md
- Radio presets: radio_presets.md
- nRF52 power management: nrf52_power_management.md
+8 -2
View File
@@ -124,10 +124,16 @@ pkg = https://github.com/meshcore-dev/Adafruit_nRF52_Arduino#d541301665b40959682
[nrf52_base]
extends = arduino_base
platform = nordicnrf52
; CUSTOM (TeTeHacko): exact platform and toolchain (upstream: `nordicnrf52`,
; `^1.140201.0`). Unpinned, every build took the newest: on 30. 11. 2026 the
; public release went to platform 11.1.0, released that same day, while the
; bench and the masts built on 10.12.0. Latest, but by a commit: Renovate
; moves these two (.github/renovate.json), its PR builds every public image.
; Libraries: platformio.lock (tools/pio_lock.py, moved by tth-lock-refresh).
platform = platformio/nordicnrf52@11.1.0
platform_packages =
framework-arduinoadafruitnrf52 @ ${nrf52_fw.pkg}
platformio/toolchain-gccarmnoneeabi@^1.140201.0
platformio/toolchain-gccarmnoneeabi@1.140201.0
; Stamping verze pro KAŽDÝ nRF52 env, ne po jednom: 19. 8. 2026 se ukázalo, že
; z 585 envů v repu stampovaly DVA, takže `ver` na lavičních deskách hlásil
; literál z upstream headeru a z uzlu nešlo poznat, který build na něm je.
+448
View File
@@ -0,0 +1,448 @@
; Library lock for PlatformIO (tools/pio_lock.py; PlatformIO has no lockfile).
; Per env, every library in .pio/libdeps/<env>, transitive ones included:
; `owner/name@version` from the registry, `<remote>#<commit>` of a git library
; (pinned in platformio.ini, only checked here) or a file: URI.
; CI installs these before building and fails when a build resolved anything
; else. Renovate bumps the registry lines; tools/pio_lock.py freeze rewrites
; an env from what it resolved.
[Heltec_t114_companion_radio_ble]
adafruit/Adafruit AHTX0@2.0.6
adafruit/Adafruit BME280 Library@2.3.0
adafruit/Adafruit BME680 Library@2.0.6
adafruit/Adafruit BMP085 Library@1.2.4
adafruit/Adafruit BMP280 Library@2.6.8
adafruit/Adafruit BusIO@1.17.4
adafruit/Adafruit GFX Library@2.0.0
adafruit/Adafruit INA219@1.2.3
adafruit/Adafruit INA260 Library@1.5.4
adafruit/Adafruit INA3221 Library@1.0.1
adafruit/Adafruit MLX90614 Library@2.1.7
adafruit/Adafruit NeoPixel@1.15.6
adafruit/Adafruit SH110X@2.1.15
adafruit/Adafruit SHTC3 Library@1.0.2
adafruit/Adafruit SSD1306@2.5.18
adafruit/Adafruit Unified Sensor@1.1.15
adafruit/Adafruit_VL53L0X@1.2.5
adafruit/RTClib@2.1.4
arduino-libraries/Arduino_LPS22HB@1.0.3
bblanchon/ArduinoJson@7.4.3
densaugeo/base64@1.4.0
electroniccats/CayenneLPP@1.6.1
https://github.com/oltaco/CustomLFS#b3928ea2d0f46c2533e901c43f471a081c503a3c
jgromes/RadioLib@7.8.1
melopero/Melopero RV3028@1.2.0
robtillaart/INA226@0.6.6
rweather/Crypto@0.4.0
sensirion/Sensirion Core@0.7.3
sensirion/Sensirion I2C SHT4x@1.1.2
stevemarple/MicroNMEA@2.0.6
[Heltec_t114_repeater]
adafruit/Adafruit AHTX0@2.0.6
adafruit/Adafruit BME280 Library@2.3.0
adafruit/Adafruit BME680 Library@2.0.6
adafruit/Adafruit BMP085 Library@1.2.4
adafruit/Adafruit BMP280 Library@2.6.8
adafruit/Adafruit BusIO@1.17.4
adafruit/Adafruit GFX Library@2.0.0
adafruit/Adafruit INA219@1.2.3
adafruit/Adafruit INA260 Library@1.5.4
adafruit/Adafruit INA3221 Library@1.0.1
adafruit/Adafruit MLX90614 Library@2.1.7
adafruit/Adafruit NeoPixel@1.15.6
adafruit/Adafruit SH110X@2.1.15
adafruit/Adafruit SHTC3 Library@1.0.2
adafruit/Adafruit SSD1306@2.5.18
adafruit/Adafruit Unified Sensor@1.1.15
adafruit/Adafruit_VL53L0X@1.2.5
adafruit/RTClib@2.1.4
arduino-libraries/Arduino_LPS22HB@1.0.3
bblanchon/ArduinoJson@7.4.3
electroniccats/CayenneLPP@1.6.1
https://github.com/oltaco/CustomLFS#b3928ea2d0f46c2533e901c43f471a081c503a3c
jgromes/RadioLib@7.8.1
melopero/Melopero RV3028@1.2.0
robtillaart/INA226@0.6.6
rweather/Crypto@0.4.0
sensirion/Sensirion Core@0.7.3
sensirion/Sensirion I2C SHT4x@1.1.2
stevemarple/MicroNMEA@2.0.6
[Heltec_v3_companion_radio_ble]
adafruit/Adafruit AHTX0@2.0.6
adafruit/Adafruit BME280 Library@2.3.0
adafruit/Adafruit BME680 Library@2.0.6
adafruit/Adafruit BMP085 Library@1.2.4
adafruit/Adafruit BMP280 Library@2.6.8
adafruit/Adafruit BusIO@1.17.4
adafruit/Adafruit GFX Library@2.0.0
adafruit/Adafruit INA219@1.2.3
adafruit/Adafruit INA260 Library@1.5.4
adafruit/Adafruit INA3221 Library@1.0.1
adafruit/Adafruit MLX90614 Library@2.1.7
adafruit/Adafruit NeoPixel@1.15.6
adafruit/Adafruit SH110X@2.1.15
adafruit/Adafruit SHTC3 Library@1.0.2
adafruit/Adafruit SSD1306@2.5.18
adafruit/Adafruit Unified Sensor@1.1.15
adafruit/Adafruit_VL53L0X@1.2.5
adafruit/RTClib@2.1.4
arduino-libraries/Arduino_LPS22HB@1.0.3
bblanchon/ArduinoJson@7.4.3
densaugeo/base64@1.4.0
electroniccats/CayenneLPP@1.6.1
jgromes/RadioLib@7.8.1
melopero/Melopero RV3028@1.2.0
robtillaart/INA226@0.6.6
rweather/Crypto@0.4.0
sensirion/Sensirion Core@0.7.3
sensirion/Sensirion I2C SHT4x@1.1.2
stevemarple/MicroNMEA@2.0.6
[Heltec_v3_repeater]
adafruit/Adafruit AHTX0@2.0.6
adafruit/Adafruit BME280 Library@2.3.0
adafruit/Adafruit BME680 Library@2.0.6
adafruit/Adafruit BMP085 Library@1.2.4
adafruit/Adafruit BMP280 Library@2.6.8
adafruit/Adafruit BusIO@1.17.4
adafruit/Adafruit GFX Library@2.0.0
adafruit/Adafruit INA219@1.2.3
adafruit/Adafruit INA260 Library@1.5.4
adafruit/Adafruit INA3221 Library@1.0.1
adafruit/Adafruit MLX90614 Library@2.1.7
adafruit/Adafruit NeoPixel@1.15.6
adafruit/Adafruit SH110X@2.1.15
adafruit/Adafruit SHTC3 Library@1.0.2
adafruit/Adafruit SSD1306@2.5.18
adafruit/Adafruit Unified Sensor@1.1.15
adafruit/Adafruit_VL53L0X@1.2.5
adafruit/RTClib@2.1.4
arduino-libraries/Arduino_LPS22HB@1.0.3
bakercp/CRC32@2.0.1
bblanchon/ArduinoJson@7.4.3
electroniccats/CayenneLPP@1.6.1
esp32async/AsyncTCP@3.6.1
esp32async/ESPAsyncWebServer@3.10.3
file://arch/esp32/AsyncElegantOTA
jgromes/RadioLib@7.8.1
melopero/Melopero RV3028@1.2.0
robtillaart/INA226@0.6.6
rweather/Crypto@0.4.0
sensirion/Sensirion Core@0.7.3
sensirion/Sensirion I2C SHT4x@1.1.2
stevemarple/MicroNMEA@2.0.6
[RAK_4631_companion_radio_ble]
adafruit/Adafruit AHTX0@2.0.6
adafruit/Adafruit BME280 Library@2.3.0
adafruit/Adafruit BME680 Library@2.0.6
adafruit/Adafruit BMP085 Library@1.2.4
adafruit/Adafruit BMP280 Library@2.6.8
adafruit/Adafruit BusIO@1.17.4
adafruit/Adafruit GFX Library@2.0.0
adafruit/Adafruit INA219@1.2.3
adafruit/Adafruit INA260 Library@1.5.4
adafruit/Adafruit INA3221 Library@1.0.1
adafruit/Adafruit MLX90614 Library@2.1.7
adafruit/Adafruit NeoPixel@1.15.6
adafruit/Adafruit SH110X@2.1.15
adafruit/Adafruit SHTC3 Library@1.0.2
adafruit/Adafruit SSD1306@2.5.18
adafruit/Adafruit Unified Sensor@1.1.15
adafruit/Adafruit_VL53L0X@1.2.5
adafruit/RTClib@2.1.4
arduino-libraries/Arduino_LPS22HB@1.0.3
bblanchon/ArduinoJson@7.4.3
boschsensortec/BSEC Software Library@1.8.1492
densaugeo/base64@1.4.0
electroniccats/CayenneLPP@1.6.1
https://github.com/oltaco/CustomLFS#b3928ea2d0f46c2533e901c43f471a081c503a3c
jgromes/RadioLib@7.8.1
melopero/Melopero RV3028@1.2.0
robtillaart/INA226@0.6.6
rweather/Crypto@0.4.0
sensirion/Sensirion Core@0.7.3
sensirion/Sensirion I2C SHT4x@1.1.2
sparkfun/SparkFun u-blox GNSS Arduino Library@2.2.29
stevemarple/MicroNMEA@2.0.6
[RAK_4631_repeater]
adafruit/Adafruit AHTX0@2.0.6
adafruit/Adafruit BME280 Library@2.3.0
adafruit/Adafruit BME680 Library@2.0.6
adafruit/Adafruit BMP085 Library@1.2.4
adafruit/Adafruit BMP280 Library@2.6.8
adafruit/Adafruit BusIO@1.17.4
adafruit/Adafruit GFX Library@2.0.0
adafruit/Adafruit INA219@1.2.3
adafruit/Adafruit INA260 Library@1.5.4
adafruit/Adafruit INA3221 Library@1.0.1
adafruit/Adafruit MLX90614 Library@2.1.7
adafruit/Adafruit NeoPixel@1.15.6
adafruit/Adafruit SH110X@2.1.15
adafruit/Adafruit SHTC3 Library@1.0.2
adafruit/Adafruit SSD1306@2.5.18
adafruit/Adafruit Unified Sensor@1.1.15
adafruit/Adafruit_VL53L0X@1.2.5
adafruit/RTClib@2.1.4
arduino-libraries/Arduino_LPS22HB@1.0.3
bblanchon/ArduinoJson@7.4.3
boschsensortec/BSEC Software Library@1.8.1492
electroniccats/CayenneLPP@1.6.1
https://github.com/oltaco/CustomLFS#b3928ea2d0f46c2533e901c43f471a081c503a3c
jgromes/RadioLib@7.8.1
melopero/Melopero RV3028@1.2.0
robtillaart/INA226@0.6.6
rweather/Crypto@0.4.0
sensirion/Sensirion Core@0.7.3
sensirion/Sensirion I2C SHT4x@1.1.2
sparkfun/SparkFun u-blox GNSS Arduino Library@2.2.29
stevemarple/MicroNMEA@2.0.6
[RAK_4631_room_server]
adafruit/Adafruit AHTX0@2.0.6
adafruit/Adafruit BME280 Library@2.3.0
adafruit/Adafruit BME680 Library@2.0.6
adafruit/Adafruit BMP085 Library@1.2.4
adafruit/Adafruit BMP280 Library@2.6.8
adafruit/Adafruit BusIO@1.17.4
adafruit/Adafruit GFX Library@2.0.0
adafruit/Adafruit INA219@1.2.3
adafruit/Adafruit INA260 Library@1.5.4
adafruit/Adafruit INA3221 Library@1.0.1
adafruit/Adafruit MLX90614 Library@2.1.7
adafruit/Adafruit NeoPixel@1.15.6
adafruit/Adafruit SH110X@2.1.15
adafruit/Adafruit SHTC3 Library@1.0.2
adafruit/Adafruit SSD1306@2.5.18
adafruit/Adafruit Unified Sensor@1.1.15
adafruit/Adafruit_VL53L0X@1.2.5
adafruit/RTClib@2.1.4
arduino-libraries/Arduino_LPS22HB@1.0.3
bblanchon/ArduinoJson@7.4.3
boschsensortec/BSEC Software Library@1.8.1492
electroniccats/CayenneLPP@1.6.1
https://github.com/oltaco/CustomLFS#b3928ea2d0f46c2533e901c43f471a081c503a3c
jgromes/RadioLib@7.8.1
melopero/Melopero RV3028@1.2.0
robtillaart/INA226@0.6.6
rweather/Crypto@0.4.0
sensirion/Sensirion Core@0.7.3
sensirion/Sensirion I2C SHT4x@1.1.2
sparkfun/SparkFun u-blox GNSS Arduino Library@2.2.29
stevemarple/MicroNMEA@2.0.6
[SenseCap_Solar_companion_radio_ble]
adafruit/Adafruit AHTX0@2.0.6
adafruit/Adafruit BME280 Library@2.3.0
adafruit/Adafruit BME680 Library@2.0.6
adafruit/Adafruit BMP085 Library@1.2.4
adafruit/Adafruit BMP280 Library@2.6.8
adafruit/Adafruit BusIO@1.17.4
adafruit/Adafruit GFX Library@2.0.0
adafruit/Adafruit INA219@1.2.3
adafruit/Adafruit INA260 Library@1.5.4
adafruit/Adafruit INA3221 Library@1.0.1
adafruit/Adafruit MLX90614 Library@2.1.7
adafruit/Adafruit NeoPixel@1.15.6
adafruit/Adafruit SH110X@2.1.15
adafruit/Adafruit SHTC3 Library@1.0.2
adafruit/Adafruit SSD1306@2.5.18
adafruit/Adafruit Unified Sensor@1.1.15
adafruit/Adafruit_VL53L0X@1.2.5
adafruit/RTClib@2.1.4
arduino-libraries/Arduino_LPS22HB@1.0.3
bblanchon/ArduinoJson@7.4.3
densaugeo/base64@1.4.0
electroniccats/CayenneLPP@1.6.1
https://github.com/oltaco/CustomLFS#b3928ea2d0f46c2533e901c43f471a081c503a3c
jgromes/RadioLib@7.8.1
melopero/Melopero RV3028@1.2.0
robtillaart/INA226@0.6.6
rweather/Crypto@0.4.0
sensirion/Sensirion Core@0.7.3
sensirion/Sensirion I2C SHT4x@1.1.2
stevemarple/MicroNMEA@2.0.6
[SenseCap_Solar_repeater]
adafruit/Adafruit AHTX0@2.0.6
adafruit/Adafruit BME280 Library@2.3.0
adafruit/Adafruit BME680 Library@2.0.6
adafruit/Adafruit BMP085 Library@1.2.4
adafruit/Adafruit BMP280 Library@2.6.8
adafruit/Adafruit BusIO@1.17.4
adafruit/Adafruit GFX Library@1.13.0
adafruit/Adafruit GFX Library@2.0.0
adafruit/Adafruit INA219@1.2.3
adafruit/Adafruit INA260 Library@1.5.4
adafruit/Adafruit INA3221 Library@1.0.1
adafruit/Adafruit MLX90614 Library@2.1.7
adafruit/Adafruit NeoPixel@1.15.6
adafruit/Adafruit SH110X@2.1.15
adafruit/Adafruit SHTC3 Library@1.0.2
adafruit/Adafruit SSD1306@2.5.18
adafruit/Adafruit Unified Sensor@1.1.15
adafruit/Adafruit_VL53L0X@1.2.5
adafruit/RTClib@2.1.4
arduino-libraries/Arduino_LPS22HB@1.0.3
bblanchon/ArduinoJson@7.4.3
electroniccats/CayenneLPP@1.6.1
https://github.com/jgromes/RadioLib.git#6d8934836678d8894e3d556550475b37dce3e2b6
https://github.com/oltaco/CustomLFS#b3928ea2d0f46c2533e901c43f471a081c503a3c
melopero/Melopero RV3028@1.2.0
robtillaart/INA226@0.6.6
rweather/Crypto@0.4.0
sensirion/Sensirion Core@0.7.3
sensirion/Sensirion I2C SHT4x@1.1.2
stevemarple/MicroNMEA@2.0.6
[Xiao_nrf52_companion_radio_ble]
adafruit/Adafruit AHTX0@2.0.6
adafruit/Adafruit BME280 Library@2.3.0
adafruit/Adafruit BME680 Library@2.0.6
adafruit/Adafruit BMP085 Library@1.2.4
adafruit/Adafruit BMP280 Library@2.6.8
adafruit/Adafruit BusIO@1.17.4
adafruit/Adafruit GFX Library@2.0.0
adafruit/Adafruit INA219@1.2.3
adafruit/Adafruit INA260 Library@1.5.4
adafruit/Adafruit INA3221 Library@1.0.1
adafruit/Adafruit MLX90614 Library@2.1.7
adafruit/Adafruit NeoPixel@1.15.6
adafruit/Adafruit SH110X@2.1.15
adafruit/Adafruit SHTC3 Library@1.0.2
adafruit/Adafruit SSD1306@2.5.18
adafruit/Adafruit Unified Sensor@1.1.15
adafruit/Adafruit_VL53L0X@1.2.5
adafruit/RTClib@2.1.4
arduino-libraries/Arduino_LPS22HB@1.0.3
bblanchon/ArduinoJson@7.4.3
densaugeo/base64@1.4.0
electroniccats/CayenneLPP@1.6.1
https://github.com/oltaco/CustomLFS#b3928ea2d0f46c2533e901c43f471a081c503a3c
jgromes/RadioLib@7.8.1
melopero/Melopero RV3028@1.2.0
robtillaart/INA226@0.6.6
rweather/Crypto@0.4.0
sensirion/Sensirion Core@0.7.3
sensirion/Sensirion I2C SHT4x@1.1.2
stevemarple/MicroNMEA@2.0.6
[Xiao_nrf52_repeater]
adafruit/Adafruit AHTX0@2.0.6
adafruit/Adafruit BME280 Library@2.3.0
adafruit/Adafruit BME680 Library@2.0.6
adafruit/Adafruit BMP085 Library@1.2.4
adafruit/Adafruit BMP280 Library@2.6.8
adafruit/Adafruit BusIO@1.17.4
adafruit/Adafruit GFX Library@2.0.0
adafruit/Adafruit INA219@1.2.3
adafruit/Adafruit INA260 Library@1.5.4
adafruit/Adafruit INA3221 Library@1.0.1
adafruit/Adafruit MLX90614 Library@2.1.7
adafruit/Adafruit NeoPixel@1.15.6
adafruit/Adafruit SH110X@2.1.15
adafruit/Adafruit SHTC3 Library@1.0.2
adafruit/Adafruit SSD1306@2.5.18
adafruit/Adafruit Unified Sensor@1.1.15
adafruit/Adafruit_VL53L0X@1.2.5
adafruit/RTClib@2.1.4
arduino-libraries/Arduino_LPS22HB@1.0.3
bblanchon/ArduinoJson@7.4.3
electroniccats/CayenneLPP@1.6.1
https://github.com/oltaco/CustomLFS#b3928ea2d0f46c2533e901c43f471a081c503a3c
jgromes/RadioLib@7.8.1
melopero/Melopero RV3028@1.2.0
robtillaart/INA226@0.6.6
rweather/Crypto@0.4.0
sensirion/Sensirion Core@0.7.3
sensirion/Sensirion I2C SHT4x@1.1.2
stevemarple/MicroNMEA@2.0.6
[Xiao_nrf52_room_server]
adafruit/Adafruit AHTX0@2.0.6
adafruit/Adafruit BME280 Library@2.3.0
adafruit/Adafruit BME680 Library@2.0.6
adafruit/Adafruit BMP085 Library@1.2.4
adafruit/Adafruit BMP280 Library@2.6.8
adafruit/Adafruit BusIO@1.17.4
adafruit/Adafruit GFX Library@2.0.0
adafruit/Adafruit INA219@1.2.3
adafruit/Adafruit INA260 Library@1.5.4
adafruit/Adafruit INA3221 Library@1.0.1
adafruit/Adafruit MLX90614 Library@2.1.7
adafruit/Adafruit NeoPixel@1.15.6
adafruit/Adafruit SH110X@2.1.15
adafruit/Adafruit SHTC3 Library@1.0.2
adafruit/Adafruit SSD1306@2.5.18
adafruit/Adafruit Unified Sensor@1.1.15
adafruit/Adafruit_VL53L0X@1.2.5
adafruit/RTClib@2.1.4
arduino-libraries/Arduino_LPS22HB@1.0.3
bblanchon/ArduinoJson@7.4.3
electroniccats/CayenneLPP@1.6.1
https://github.com/oltaco/CustomLFS#b3928ea2d0f46c2533e901c43f471a081c503a3c
jgromes/RadioLib@7.8.1
melopero/Melopero RV3028@1.2.0
robtillaart/INA226@0.6.6
rweather/Crypto@0.4.0
sensirion/Sensirion Core@0.7.3
sensirion/Sensirion I2C SHT4x@1.1.2
stevemarple/MicroNMEA@2.0.6
[Xiao_nrf52_sensor]
adafruit/Adafruit AHTX0@2.0.6
adafruit/Adafruit BME280 Library@2.3.0
adafruit/Adafruit BME680 Library@2.0.6
adafruit/Adafruit BMP085 Library@1.2.4
adafruit/Adafruit BMP280 Library@2.6.8
adafruit/Adafruit BusIO@1.17.4
adafruit/Adafruit GFX Library@2.0.0
adafruit/Adafruit INA219@1.2.3
adafruit/Adafruit INA260 Library@1.5.4
adafruit/Adafruit INA3221 Library@1.0.1
adafruit/Adafruit MLX90614 Library@2.1.7
adafruit/Adafruit NeoPixel@1.15.6
adafruit/Adafruit SH110X@2.1.15
adafruit/Adafruit SHTC3 Library@1.0.2
adafruit/Adafruit SSD1306@2.5.18
adafruit/Adafruit Unified Sensor@1.1.15
adafruit/Adafruit_VL53L0X@1.2.5
adafruit/RTClib@2.1.4
arduino-libraries/Arduino_LPS22HB@1.0.3
bblanchon/ArduinoJson@7.4.3
electroniccats/CayenneLPP@1.6.1
https://github.com/oltaco/CustomLFS#b3928ea2d0f46c2533e901c43f471a081c503a3c
jgromes/RadioLib@7.8.1
melopero/Melopero RV3028@1.2.0
robtillaart/INA226@0.6.6
rweather/Crypto@0.4.0
sensirion/Sensirion Core@0.7.3
sensirion/Sensirion I2C SHT4x@1.1.2
stevemarple/MicroNMEA@2.0.6
[t1000e_companion_radio_ble]
adafruit/Adafruit BusIO@1.17.4
adafruit/RTClib@2.1.4
bblanchon/ArduinoJson@7.4.3
densaugeo/base64@1.4.0
electroniccats/CayenneLPP@1.6.1
end2endzone/NonBlockingRTTTL@1.4.0
https://github.com/oltaco/CustomLFS#b3928ea2d0f46c2533e901c43f471a081c503a3c
jgromes/RadioLib@7.8.1
melopero/Melopero RV3028@1.2.0
rweather/Crypto@0.4.0
stevemarple/MicroNMEA@2.0.6
[t1000e_repeater]
adafruit/Adafruit BusIO@1.17.4
adafruit/RTClib@2.1.4
bblanchon/ArduinoJson@7.4.3
electroniccats/CayenneLPP@1.6.1
https://github.com/oltaco/CustomLFS#b3928ea2d0f46c2533e901c43f471a081c503a3c
jgromes/RadioLib@7.8.1
melopero/Melopero RV3028@1.2.0
rweather/Crypto@0.4.0
stevemarple/MicroNMEA@2.0.6
+43
View File
@@ -11,7 +11,9 @@
// float a '.' and fraction. No exponent, no hex, no trailing text.
#include <ctype.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
namespace cli_args {
@@ -53,4 +55,45 @@ inline bool parseFloat(const char* s, float lo, float hi, float* out) {
return true;
}
// Strips leading spaces and an optional 3-byte "XX|" prefix (reflected into
// `reply`, deducting 3 from `*reply_max` when provided).
inline void stripPrefix(const char*& command, char*& reply, int* reply_max = nullptr) {
while (*command == ' ') command++;
if (strlen(command) > 4 && command[2] == '|') {
if (!reply_max || *reply_max >= 3) {
memcpy(reply, command, 3);
reply += 3;
*reply = 0;
if (reply_max) *reply_max -= 3;
}
command += 3;
while (*command == ' ') command++;
}
}
// Security gate for companion `set pin`: blocked in locked CLI rescue and over
// unencrypted local transports (USB), allowed over paired BLE or remote ACL.
inline bool canSetPin(uint32_t sender_timestamp, bool cli_rescue, bool locked_node,
bool serial_secure, const char** err_out = nullptr) {
if (locked_node && cli_rescue) {
if (err_out) *err_out = "Error: locked build";
return false;
}
if (sender_timestamp == 0 && !cli_rescue && !serial_secure) {
if (err_out) *err_out = "Error: set pin only over paired BLE";
return false;
}
return true;
}
// Appends `line` to a paged CLI reply only if it fits with `trailer_reserve`
// bytes left for the end marker; returns false when the page is full.
inline bool appendLine(char*& dp, const char* reply, int max_len, int trailer_reserve, const char* line) {
int ll = (int)strlen(line);
if ((dp - reply) + ll + trailer_reserve > max_len) return false;
memcpy(dp, line, ll);
dp += ll;
return true;
}
} // namespace cli_args
+6 -5
View File
@@ -63,9 +63,10 @@ void ClientACL::load(FILESYSTEM* fs, const mesh::LocalIdentity& self_id) {
#define ACL_TS_RECORD (ACL_TS_PREFIX + 4)
static const char* tsFilename(uint8_t slot) { return slot ? "/s_acl_ts1" : "/s_acl_ts0"; }
static uint8_t s_ts_buf[2 * MAX_CLIENTS * ACL_TS_RECORD + 8];
void ClientACL::loadTimestamps() {
static uint8_t buf[2 * MAX_CLIENTS * ACL_TS_RECORD + 8];
uint8_t* buf = s_ts_buf;
_num_ts_orphans = 0;
_ts_seq = 0;
_ts_slot = 0;
@@ -78,7 +79,7 @@ void ClientACL::loadTimestamps() {
File file = _fs->open(tsFilename(slot));
#endif
if (!file) continue;
int len = file.read(buf, sizeof(buf));
int len = file.read(buf, sizeof(s_ts_buf));
file.close();
if (len < 8 || (len - 8) % ACL_TS_RECORD != 0) continue;
@@ -121,7 +122,7 @@ void ClientACL::loadTimestamps() {
void ClientACL::saveTimestamps() {
if (!_fs) return;
static uint8_t buf[2 * MAX_CLIENTS * ACL_TS_RECORD + 8];
uint8_t* buf = s_ts_buf;
int len = 0;
for (int i = 0; i < num_clients; i++) {
if (clients[i].saved_timestamp == 0) continue;
@@ -142,10 +143,10 @@ void ClientACL::saveTimestamps() {
File file = openWrite(_fs, tsFilename(_ts_slot));
if (file) {
file.write(buf, len);
size_t written = file.write(buf, len);
file.close();
if (written == (size_t)len) _ts_slot ^= 1;
}
_ts_slot ^= 1;
}
void ClientACL::orphanTimestamp(const ClientInfo* c) {
+2 -2
View File
@@ -62,7 +62,7 @@ static int in_shift_phase(void) {
static int cb_read(void *arg, void *dst, uintptr_t src, size_t size) {
fwp_job *j = (fwp_job *)arg;
uint8_t *d = (uint8_t *)dst;
if (src + size > j->mem_size) return j->err = FWP_ERR_ARGS;
if (src > j->mem_size || size > j->mem_size - src) return j->err = FWP_ERR_ARGS;
if (!in_shift_phase() && src < j->written_end) return j->err = FWP_ERR_OVERREAD;
while (size > 0) {
uintptr_t a = src;
@@ -106,7 +106,7 @@ static int cb_erase(void *arg, uintptr_t addr, size_t size) {
static int cb_write(void *arg, uintptr_t dst, void *src, size_t size) {
fwp_job *j = (fwp_job *)arg;
if (j->page_addr == NO_PAGE || dst < j->page_addr || dst + size > j->page_addr + FWP_PAGE)
if (j->page_addr == NO_PAGE || dst < j->page_addr || size > FWP_PAGE - (dst - j->page_addr))
return j->err = FWP_ERR_ORDER;
fwp_copy(&g_page[dst - j->page_addr], (const uint8_t *)src, (uint32_t)size);
if (j->dry && !in_shift_phase()) j->sink(j->sink_ctx, (const uint8_t *)src, (uint32_t)size);
+3 -2
View File
@@ -743,9 +743,9 @@ void FwUpdate::cmdBegin(uint32_t sender_timestamp, const char *arg, char *reply)
strcpy(reply, "ERR: fw begin <bytes>");
return;
}
if (stage + total > FW_OTA_STAGE_END) {
if (stage >= FW_OTA_STAGE_END || total > FW_OTA_STAGE_END - stage) {
sprintf(reply, "ERR: %lu B does not fit, %lu free", (unsigned long)total,
(unsigned long)(FW_OTA_STAGE_END - stage));
(unsigned long)(stage < FW_OTA_STAGE_END ? FW_OTA_STAGE_END - stage : 0));
return;
}
_stage = stage;
@@ -975,6 +975,7 @@ void FwUpdate::cmdApply(uint32_t sender_timestamp, const char *arg, char *reply)
_apply_force = force;
_apply_err[0] = 0;
_apply_at = millis() + 2000; // let the reply go out first
if (_apply_at == 0) _apply_at = 1;
sprintf(reply, "OK applying %s in 2 s (batt %umV%s), back in ~20 s", _version, mv,
_board.isExternalPowered() ? ", USB" : "");
}
+1
View File
@@ -323,6 +323,7 @@ bool NodeMaintenance::dfuCommand(uint32_t sender_timestamp, const char* command,
return true;
}
_dfu_at = millis() + 700;
if (_dfu_at == 0) _dfu_at = 1;
_dfu_mode = (strcmp(arg, "serial") == 0) ? 1 : (strcmp(arg, "ota") == 0 ? 2 : 0);
#else
strcpy(reply, "ERR: not an nRF52 board");
+17
View File
@@ -11,6 +11,9 @@
// first accepted sync), so a spoofer cannot walk the clock away.
// A trusted fix that keeps disagreeing with the clock by the same offset raises an alert;
// the operator can then accept that GPS time (acceptAlertedTime()).
//
// epochFromFields() is always available, with or without GPS_GUARD: the location providers use it
// to turn the receiver's date and time into an epoch.
#include <Arduino.h>
#include <MeshCore.h>
@@ -106,6 +109,20 @@ class GpsGuard {
}
public:
// UTC date and time fields as reported by a receiver -> Unix epoch, or 0 if any field is out of
// range. Receivers (and their libraries) hand these over unchecked: MicroNMEA turns any two
// characters into a value 0..255, and both RTClib's DateTime and SparkFun's getUnixEpoch() index
// their days-per-month tables with the month without a range check.
static uint32_t epochFromFields(uint16_t year, uint8_t month, uint8_t day,
uint8_t hour, uint8_t minute, uint8_t second) {
static const uint8_t days_in_month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
if (year < 2020 || year > 2099 || month < 1 || month > 12) return 0;
uint8_t mdays = days_in_month[month - 1];
if (month == 2 && year % 4 == 0) mdays = 29; // 2020..2099: every fourth year is a leap year
if (day < 1 || day > mdays || hour > 23 || minute > 59 || second > 60) return 0; // 60: leap second
return DateTime(year, month, day, hour, minute, second).unixtime();
}
// Plausible GPS time window: not before this firmware was built, at most 10 years after.
static uint32_t minEpoch() {
static const uint32_t min_epoch = DateTime(__DATE__, __TIME__).unixtime() - 86400;
@@ -5,9 +5,7 @@
#include <MicroNMEA.h>
#include <RTClib.h>
#include <string.h>
#ifdef GPS_GUARD
#include "GpsGuard.h"
#endif
#include "GpsGuard.h" // epochFromFields(); the guard itself only with GPS_GUARD
#ifndef GPS_PERIODIC_ACQUISITION_TIMEOUT_MS
#define GPS_PERIODIC_ACQUISITION_TIMEOUT_MS 300000UL
@@ -161,7 +159,7 @@ class MicroNMEALocationProvider : public LocationProvider {
(millis() - _last_time_sync) > TIME_SYNC_INTERVAL) {
_time_sync_needed = true;
}
if (_time_sync_needed && time_valid > 2 && _clock != nullptr && timeSyncAllowed()) {
if (_time_sync_needed && time_valid > 2 && _clock != nullptr && currentEpoch() != 0 && timeSyncAllowed()) {
_clock->setCurrentTime(getTimestamp());
_time_sync_needed = false;
_last_time_sync = millis();
@@ -175,6 +173,12 @@ class MicroNMEALocationProvider : public LocationProvider {
return _clock == nullptr || !_time_sync_needed || time_valid > 3;
}
// the receiver's current date and time, or 0 if a field is out of range
uint32_t currentEpoch() {
return GpsGuard::epochFromFields(nmea.getYear(), nmea.getMonth(), nmea.getDay(),
nmea.getHour(), nmea.getMinute(), nmea.getSecond());
}
bool timeSyncAllowed() {
#ifdef GPS_GUARD
return _guard.acceptTime(getTimestamp(), _clock->getCurrentTime());
@@ -299,14 +303,14 @@ public:
// GPS time minus clock time, from a current fix with a settled time
bool getClockOffset(long& offset) override {
if (_clock == nullptr || !isValid() || time_valid < 3) return false;
if (_clock == nullptr || !isValid() || time_valid < 3 || currentEpoch() == 0) return false;
offset = (long)getTimestamp() - (long)_clock->getCurrentTime();
return true;
}
// write the current GPS time to the clock now (caller has done its own checks)
bool applyTimeNow() override {
if (_clock == nullptr || !isValid() || time_valid < 3) return false;
if (_clock == nullptr || !isValid() || time_valid < 3 || currentEpoch() == 0) return false;
_clock->setCurrentTime(getTimestamp());
_time_sync_needed = false;
_last_time_sync = millis();
@@ -319,9 +323,8 @@ public:
long getTimestamp() override {
if (!nmea.isValid()) return _lastFix.timestamp;
DateTime dt(nmea.getYear(), nmea.getMonth(), nmea.getDay(),
nmea.getHour(), nmea.getMinute(), nmea.getSecond());
return dt.unixtime();
uint32_t t = currentEpoch();
return t != 0 ? t : _lastFix.timestamp;
}
void drain() override { _driver->drain(); }
+18 -2
View File
@@ -3,6 +3,7 @@
#include "GpsDriver.h"
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
#include "GpsGuard.h" // epochFromFields()
// Driver for the RAK12500 (u-blox, I2C). Serial NMEA modules are handled by NmeaGpsDriver.
class RakI2cGpsDriver : public GpsDriver {
@@ -11,6 +12,7 @@ class RakI2cGpsDriver : public GpsDriver {
uint8_t _powerPin = 0;
bool _detected = false;
bool _started = false;
bool _pvtSeen = false; // a NAV-PVT has been received since boot
bool probeRak12500(uint8_t powerPin) {
#if defined(ETHERNET_ENABLED) && defined(RAK_BOARD)
@@ -95,10 +97,24 @@ public:
bool isDetected() const { return _detected; }
bool hasFix() { return _started && _gnss.getGnssFixOk(8); }
bool hasFix() {
if (!_started) return false;
// The library allocates its NAV-PVT record without clearing it: until the first reply has
// arrived, the fix flag and every other field are whatever was on the heap.
if (!_pvtSeen) {
if (!_gnss.getPVT(8)) return false;
_pvtSeen = true;
}
return _gnss.getGnssFixOk(8);
}
long getLatitude() { return _gnss.getLatitude(2) / 10; }
long getLongitude() { return _gnss.getLongitude(2) / 10; }
long getAltitude() { return _gnss.getAltitude(2); }
long getSatellites() { return _gnss.getSIV(2); }
long getTimestamp() { return _gnss.getUnixEpoch(2); }
// Not getUnixEpoch(): it indexes its day tables with the module's year and month unchecked.
// 0 (no time; RakLocationProvider then leaves the clock alone) for a date or time out of range.
long getTimestamp() {
return GpsGuard::epochFromFields(_gnss.getYear(2), _gnss.getMonth(2), _gnss.getDay(2),
_gnss.getHour(2), _gnss.getMinute(2), _gnss.getSecond(2));
}
};
+93 -42
View File
@@ -340,53 +340,104 @@ public:
}
if (_page == HomePage::FIRST) {
display.setColor(UIColor::primary_txt);
#ifdef ENABLE_WIFI_INTERFACE
// smaller unread message ui for wifi variants
display.setTextSize(1);
sprintf(tmp, "Unread Msg: %d", _task->getMsgCount());
display.drawTextCentered(display.width() / 2, 22, tmp);
#else
// larger unread message ui for non wifi variants
display.setTextSize(2);
sprintf(tmp, "MSG: %d", _task->getMsgCount());
display.drawTextCentered(display.width() / 2, 22, tmp);
#endif
static constexpr uint32_t MIN_VALID_RTC_EPOCH = 1735689600UL; // 2025-01-01 00:00:00 UTC
uint32_t raw_now = _rtc->getCurrentTime();
bool rtc_valid = (raw_now >= MIN_VALID_RTC_EPOCH);
const bool compact_screen = (display.height() < 120);
char time_str[8] = "--:--";
char date_str[12] = "";
if (_node_prefs->ui_show_clock) {
display.setTextSize(3);
uint32_t now = _rtc->getCurrentTime();
now += (int32_t)(_node_prefs->tz_offset * 3600);
DateTime dt (now);
sprintf(tmp, "%02d:%02d", dt.hour(), dt.minute());
display.drawTextCentered(display.width() / 2, 60, tmp);
display.setTextSize(1);
sprintf(tmp, "%02d/%02d/%d", dt.day(), dt.month(), dt.year());
display.drawTextCentered(display.width() / 2, 80, tmp);
if (rtc_valid) {
uint32_t local_now = (uint32_t)((int64_t)raw_now + (int64_t)(_node_prefs->tz_offset * 3600.0f));
DateTime dt (local_now);
snprintf(time_str, sizeof(time_str), "%02d:%02d", dt.hour(), dt.minute());
if (compact_screen) {
snprintf(date_str, sizeof(date_str), "%02d/%02d/%02d", dt.day(), dt.month(), dt.year() % 100);
} else {
snprintf(date_str, sizeof(date_str), "%02d/%02d/%d", dt.day(), dt.month(), dt.year());
}
} else {
strcpy(date_str, compact_screen ? "--/--/--" : "--/--/----");
}
}
#ifdef ENABLE_WIFI_INTERFACE
if (_node_prefs->ui_show_clock && compact_screen) {
display.setColor(UIColor::primary_txt);
display.setTextSize(1);
snprintf(tmp, sizeof(tmp), "MSG:%d", _task->getMsgCount());
display.drawTextLeftAlign(0, 19, tmp);
display.setColor(UIColor::secondary_txt);
display.drawTextRightAlign(display.width() - 1, 19, date_str);
display.setColor(UIColor::primary_txt);
#ifdef ENABLE_WIFI_INTERFACE
display.setTextSize(1);
display.drawTextCentered(display.width() / 2, 29, time_str);
IPAddress ip = WiFi.localIP();
snprintf(tmp, sizeof(tmp), "IP: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
display.setTextSize(1);
display.drawTextCentered(display.width() / 2, 32, tmp);
#endif
if (_task->hasConnection()) {
display.setColor(UIColor::warning_txt);
display.setTextSize(1);
if (_node_prefs->ui_show_clock)
display.drawTextCentered(display.width() / 2, 110, "< Connected >");
else
display.drawTextCentered(display.width() / 2, 43, "< Connected >");
// CUSTOM (TeTeHacko): jen kdyz BT opravdu bezi -- jinak displej nabizi PIN
// k parovani, ktere neni jak navazat.
} else if (_task->getBLEPin() != 0 && _task->isBluetoothEnabled()) { // BT pin
display.setColor(UIColor::warning_txt);
sprintf(tmp, "Pin:%d", _task->getBLEPin());
if (_node_prefs->ui_show_clock) {
display.drawTextCentered(display.width() / 2, 40, tmp);
#else
display.setTextSize(2);
display.drawTextCentered(display.width() / 2, 30, time_str);
#endif
if (_task->hasConnection()) {
display.setColor(UIColor::warning_txt);
display.setTextSize(1);
display.drawTextCentered(display.width() / 2, 110, tmp);
} else {
display.setTextSize(2);
display.drawTextCentered(display.width() / 2, 43, tmp);
display.drawTextCentered(display.width() / 2, 51, "< Connected >");
// CUSTOM (TeTeHacko): jen kdyz BT opravdu bezi -- jinak displej nabizi PIN
// k parovani, ktere neni jak navazat.
} else if (_task->getBLEPin() != 0 && _task->isBluetoothEnabled()) { // BT pin
display.setColor(UIColor::warning_txt);
display.setTextSize(1);
snprintf(tmp, sizeof(tmp), "Pin:%lu", (unsigned long)_task->getBLEPin());
display.drawTextCentered(display.width() / 2, 51, tmp);
}
} else {
display.setColor(UIColor::primary_txt);
#ifdef ENABLE_WIFI_INTERFACE
// smaller unread message ui for wifi variants
display.setTextSize(1);
sprintf(tmp, "Unread Msg: %d", _task->getMsgCount());
display.drawTextCentered(display.width() / 2, 22, tmp);
#else
// larger unread message ui for non wifi variants
display.setTextSize(2);
sprintf(tmp, "MSG: %d", _task->getMsgCount());
display.drawTextCentered(display.width() / 2, 22, tmp);
#endif
if (_node_prefs->ui_show_clock) {
display.setTextSize(3);
display.drawTextCentered(display.width() / 2, 60, time_str);
display.setTextSize(1);
display.drawTextCentered(display.width() / 2, 80, date_str);
}
#ifdef ENABLE_WIFI_INTERFACE
IPAddress ip = WiFi.localIP();
snprintf(tmp, sizeof(tmp), "IP: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
display.setTextSize(1);
display.drawTextCentered(display.width() / 2, 32, tmp);
#endif
if (_task->hasConnection()) {
display.setColor(UIColor::warning_txt);
display.setTextSize(1);
if (_node_prefs->ui_show_clock)
display.drawTextCentered(display.width() / 2, 110, "< Connected >");
else
display.drawTextCentered(display.width() / 2, 43, "< Connected >");
// CUSTOM (TeTeHacko): jen kdyz BT opravdu bezi -- jinak displej nabizi PIN
// k parovani, ktere neni jak navazat.
} else if (_task->getBLEPin() != 0 && _task->isBluetoothEnabled()) { // BT pin
display.setColor(UIColor::warning_txt);
sprintf(tmp, "Pin:%lu", (unsigned long)_task->getBLEPin());
if (_node_prefs->ui_show_clock) {
display.setTextSize(1);
display.drawTextCentered(display.width() / 2, 110, tmp);
} else {
display.setTextSize(2);
display.drawTextCentered(display.width() / 2, 43, tmp);
}
}
}
} else if (_page == HomePage::RECENT) {
+15 -5
View File
@@ -18,11 +18,12 @@ class File {
std::string _name;
size_t _pos = 0;
bool _write = false;
size_t _short_write = 0;
public:
File() = default;
File(std::map<std::string, std::string>* files, const std::string& name, bool write)
: _files(files), _name(name), _write(write) {
File(std::map<std::string, std::string>* files, const std::string& name, bool write, size_t short_write = 0)
: _files(files), _name(name), _write(write), _short_write(short_write) {
if (write) (*_files)[name] = "";
}
explicit operator bool() const { return _files != nullptr; }
@@ -34,8 +35,9 @@ public:
return (int)n;
}
size_t write(const uint8_t* buf, size_t len) {
(*_files)[_name].append((const char*)buf, len);
return len;
size_t n = (_short_write > 0 && _short_write < len) ? _short_write : len;
(*_files)[_name].append((const char*)buf, n);
return n;
}
void close() {}
};
@@ -46,14 +48,22 @@ class Adafruit_LittleFS {
public:
std::map<std::string, std::string> files;
int writes = 0;
bool fail_next_write_open = false;
size_t short_next_write = 0;
bool exists(const char* name) { return files.count(name) > 0; }
bool remove(const char* name) { return files.erase(name) > 0; }
bool mkdir(const char*) { return true; }
Adafruit_LittleFS_Namespace::File open(const char* name, uint8_t mode = FILE_O_READ) {
if (mode == FILE_O_WRITE) {
if (fail_next_write_open) {
fail_next_write_open = false;
return Adafruit_LittleFS_Namespace::File();
}
writes++;
return Adafruit_LittleFS_Namespace::File(&files, name, true);
size_t sw = short_next_write;
short_next_write = 0;
return Adafruit_LittleFS_Namespace::File(&files, name, true, sw);
}
if (!exists(name)) return Adafruit_LittleFS_Namespace::File();
return Adafruit_LittleFS_Namespace::File(&files, name, false);
@@ -187,6 +187,44 @@ TEST(AclReplayFloor, AlternatesSlotsAcrossReboots) {
}
}
TEST(AclReplayFloor, FailedOpenDoesNotRotateSlot) {
Node n;
ClientInfo* c = n.admin(1);
ASSERT_TRUE(n.accept(c, NOW - 30)); // slot 0 -> next slot 1
ASSERT_TRUE(n.accept(c, NOW - 20)); // slot 1 -> next slot 0 (oldest)
n.acl->save(&n.fs);
// Open fails on slot 0: must NOT advance to slot 1 (which holds NOW - 20).
n.fs.fail_next_write_open = true;
ASSERT_TRUE(n.accept(c, NOW - 15));
// Next write is torn; because slot stayed 0, slot 1 (NOW - 20) stays intact.
n.fs.short_next_write = 5;
ASSERT_TRUE(n.accept(c, NOW - 10));
n.boot();
c = n.acl->getClient(idFor(1).pub_key, PUB_KEY_SIZE);
EXPECT_EQ(c->last_timestamp, NOW - 20);
}
TEST(AclReplayFloor, ShortWriteDoesNotRotateSlot) {
Node n;
ClientInfo* c = n.admin(1);
ASSERT_TRUE(n.accept(c, NOW - 30)); // slot 0
ASSERT_TRUE(n.accept(c, NOW - 20)); // slot 1
n.acl->save(&n.fs);
// Two consecutive short writes must both target slot 0 and leave slot 1 intact.
n.fs.short_next_write = 4;
ASSERT_TRUE(n.accept(c, NOW - 15));
n.fs.short_next_write = 4;
ASSERT_TRUE(n.accept(c, NOW - 10));
n.boot();
c = n.acl->getClient(idFor(1).pub_key, PUB_KEY_SIZE);
EXPECT_EQ(c->last_timestamp, NOW - 20);
}
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
+82
View File
@@ -49,6 +49,88 @@ TEST(CliArgsFloat, RefusesNanInfExponentAndGarbage) {
EXPECT_FALSE(parseFloat("91", -90, 90, &f));
EXPECT_EQ(f, 1);
}
TEST(CliPrefix, StripsSpacesAndReflectsPrefixWithBudget) {
char buf[32] = {};
char* reply = buf;
int max_len = 150;
const char* cmd = " 01| set pin 123456";
cli_args::stripPrefix(cmd, reply, &max_len);
EXPECT_STREQ(cmd, "set pin 123456");
EXPECT_STREQ(buf, "01|");
EXPECT_EQ(reply, buf + 3);
EXPECT_EQ(max_len, 147);
}
TEST(CliPrefix, LeadingSpacesWithoutPrefix) {
char buf[16] = {};
char* reply = buf;
int max_len = 150;
const char* cmd = " set pin 123456";
cli_args::stripPrefix(cmd, reply, &max_len);
EXPECT_STREQ(cmd, "set pin 123456");
EXPECT_STREQ(buf, "");
EXPECT_EQ(reply, buf);
EXPECT_EQ(max_len, 150);
}
TEST(CliPrefix, TinyBudgetDoesNotOverflowOrGoNegative) {
char buf[4] = {'X', 'X', 'X', 0};
char* reply = buf;
int max_len = 2;
const char* cmd = "01|nodes";
cli_args::stripPrefix(cmd, reply, &max_len);
EXPECT_STREQ(cmd, "nodes");
EXPECT_EQ(reply, buf);
EXPECT_EQ(max_len, 2);
}
TEST(CliSetPinGate, EnforcesTransportAndLockedBuild) {
const char* err = nullptr;
// Local USB (unsecured, not rescue) -> blocked
EXPECT_FALSE(cli_args::canSetPin(0, false, false, false, &err));
EXPECT_STREQ(err, "Error: set pin only over paired BLE");
// Locked CLI rescue -> blocked
EXPECT_FALSE(cli_args::canSetPin(0, true, true, false, &err));
EXPECT_STREQ(err, "Error: locked build");
// Paired BLE -> allowed
EXPECT_TRUE(cli_args::canSetPin(0, false, true, true, &err));
// Unlocked CLI rescue -> allowed
EXPECT_TRUE(cli_args::canSetPin(0, true, false, false, &err));
// Remote ACL admin (sender_timestamp != 0) -> allowed
EXPECT_TRUE(cli_args::canSetPin(1763400000u, false, true, false, &err));
}
TEST(CliPagedReply, NeverOverflowsSmallMeshBufferWithPrefix) {
// Exact mesh CLI size: 150 B reply buffer, 3 B taken by "01|", leaving 147 B.
char buf[150] = {};
char* reply = buf;
int max_len = (int)sizeof(buf);
const char* cmd = "01|nodes";
cli_args::stripPrefix(cmd, reply, &max_len);
char* dp = reply;
std::string long_line(140, 'A');
long_line.push_back('\n');
// 141 B line + 24 B trailer reserve > 147 B -> must refuse even as first line
EXPECT_FALSE(cli_args::appendLine(dp, reply, max_len, 24, long_line.c_str()));
EXPECT_EQ(dp, reply);
std::string short_line(50, 'B');
short_line.push_back('\n');
EXPECT_TRUE(cli_args::appendLine(dp, reply, max_len, 24, short_line.c_str()));
EXPECT_TRUE(cli_args::appendLine(dp, reply, max_len, 24, short_line.c_str()));
EXPECT_FALSE(cli_args::appendLine(dp, reply, max_len, 24, short_line.c_str()));
dp += sprintf(dp, "E,2,3");
*dp = 0;
EXPECT_LT((size_t)(dp - buf), sizeof(buf));
}
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
+1
View File
@@ -44,6 +44,7 @@ a different board.
| `ble_flash_node.sh` | BLE OTA of a node out of reach of a cable, with the checks around it (silence, services, version) |
| `ble_dfu.py` | legacy Nordic DFU over BLE for the Adafruit nRF52 bootloader (buttonless, both phases) |
| `build_version.py` | PlatformIO pre-script: real version and build time for `ver` |
| `pio_lock.py` | library lock for PlatformIO (`platformio.lock`): `install` the locked versions before a build, `check` that nothing else resolved, `freeze` a resolution, `moved` against git |
| `bl_sign_pkg.py` | DFU zip for a board with the signed (`SIGNED_FW`) Adafruit bootloader: `adafruit-nrfutil dfu genpkg --key-file` with its two Python 3 bugs on that path fixed |
| `bl_verify_pkg.py` | checks a DFU zip the way the signed bootloader will (device type, ECDSA P-256 over the init packet, image length and hash) |
| `bl_allowed_key` | the public key the signed bootloader carries (`SIGNED_FW_QX`/`QY`) |
+259
View File
@@ -0,0 +1,259 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
"""Library lock file for PlatformIO, which has none (platformio.lock).
Upstream's lib_deps are ranges (`^2.1.3`) and every library pulls in its own
dependencies, so a build takes whatever is newest that day: the same commit
built twice can differ. platformio.lock records, per env, the exact version of
every library in .pio/libdeps/<env> (direct and transitive). The platform and
the toolchain are pinned in platformio.ini itself.
pio_lock.py install -e ENV [-e ENV ...]
install the locked registry versions into .pio/libdeps/<env> (no
dependencies, nothing saved to platformio.ini). Run it before `pio
run`: PlatformIO keeps an installed library that satisfies lib_deps.
git and file libraries are pinned in platformio.ini and only checked.
pio_lock.py check -e ENV [-e ENV ...]
exit 1 when .pio/libdeps/<env> is not exactly the lock: a library
missing, extra, or of another version (run it after the build).
pio_lock.py freeze -e ENV [-e ENV ...]
write what .pio/libdeps/<env> holds into the lock (replaces those
envs' sections). After `pio pkg install -e ENV` in a clean libdeps
dir this locks today's resolution.
pio_lock.py envs
the envs the lock has a section for, one per line.
pio_lock.py moved [--base REV]
what changed against the lock in git REV (default HEAD), one
`name old -> new` line per registry library (any env).
Lock format: `[env]` sections; one library per line, `owner/name@version`
from the registry, `<remote>#<commit>` of a git library, or a file: URI.
--lock FILE (default: platformio.lock next to platformio.ini);
PLATFORMIO_LIBDEPS_DIR is honoured as by PlatformIO.
"""
from __future__ import annotations
import argparse
import json
import os
import shutil
import subprocess
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
HEADER = """\
; Library lock for PlatformIO (tools/pio_lock.py; PlatformIO has no lockfile).
; Per env, every library in .pio/libdeps/<env>, transitive ones included:
; `owner/name@version` from the registry, `<remote>#<commit>` of a git library
; (pinned in platformio.ini, only checked here) or a file: URI.
; CI installs these before building and fails when a build resolved anything
; else. Renovate bumps the registry lines; tools/pio_lock.py freeze rewrites
; an env from what it resolved.
"""
# PlatformIO puts the test framework into an env's libdeps (`pio pkg install`
# in CI did, a local one did not); it is never linked into the firmware.
IGNORED = {"throwtheswitch/Unity"}
def libdeps_dir() -> Path:
d = os.environ.get("PLATFORMIO_LIBDEPS_DIR")
return Path(d) if d else REPO / ".pio" / "libdeps"
def read_lock(path: Path) -> dict[str, list[str]]:
envs: dict[str, list[str]] = {}
cur: list[str] | None = None
if not path.exists():
return envs
for raw in path.read_text().splitlines():
line = raw.strip()
if not line or line.startswith((";", "#")):
continue
if line.startswith("[") and line.endswith("]"):
cur = envs.setdefault(line[1:-1], [])
elif cur is None:
raise SystemExit(f"{path}: library line before any [env]: {line}")
else:
cur.append(line)
return envs
def write_lock(path: Path, envs: dict[str, list[str]]) -> None:
out = [HEADER]
for env in sorted(envs):
out.append(f"[{env}]")
out.extend(sorted(envs[env], key=str.lower))
out.append("")
path.write_text("\n".join(out))
def git_uri(lib: Path) -> str:
"""`<remote>#<commit>` of a library PlatformIO cloned (it leaves no .piopm)."""
def git(*args: str) -> str:
return subprocess.run(
["git", "-C", str(lib), *args], check=True, capture_output=True, text=True
).stdout.strip()
return f"{git('remote', 'get-url', 'origin')}#{git('rev-parse', 'HEAD')}"
def installed(env: str) -> list[str]:
"""Lock lines for what .pio/libdeps/<env> holds."""
d = libdeps_dir() / env
if not d.is_dir():
raise SystemExit(
f"{d}: no such libdeps dir (run `pio pkg install -e {env}` first)"
)
lines = []
for lib in sorted(p for p in d.iterdir() if p.is_dir()):
pm = lib / ".piopm"
if not pm.exists():
if (lib / ".git").exists():
lines.append(git_uri(lib))
continue
raise SystemExit(f"{lib}: neither .piopm nor .git")
meta = json.loads(pm.read_text())
if meta.get("type") != "library":
continue
spec = meta.get("spec") or {}
if spec.get("uri"):
lines.append(spec["uri"])
elif spec.get("owner"):
if f"{spec['owner']}/{spec['name']}" in IGNORED:
continue
lines.append(f"{spec['owner']}/{spec['name']}@{meta['version']}")
else:
raise SystemExit(f"{pm}: neither a registry owner nor a URI")
return lines
def pio() -> str:
exe = shutil.which("pio") or str(Path.home() / ".platformio/penv/bin/pio")
if not Path(exe).exists():
raise SystemExit("pio not found (PATH, ~/.platformio/penv/bin)")
return exe
def cmd_install(lock: dict[str, list[str]], envs: list[str]) -> int:
for env in envs:
if env not in lock:
print(f"{env}: not in the lock", file=sys.stderr)
return 1
# URI libraries (git, file) are pinned in platformio.ini itself and
# come from there; the lock only checks them
reg = [line for line in lock[env] if "://" not in line]
args = [
pio(),
"pkg",
"install",
"-d",
str(REPO),
"-e",
env,
"--no-save",
"--skip-dependencies",
"-s",
]
for line in reg:
args += ["-l", line]
print(f"{env}: installing {len(reg)} locked libraries", flush=True)
subprocess.run(args, check=True)
return 0
def cmd_check(lock: dict[str, list[str]], envs: list[str]) -> int:
bad = 0
for env in envs:
want, have = set(lock.get(env, [])), set(installed(env))
if env not in lock:
print(f"{env}: not in the lock", file=sys.stderr)
bad = 1
continue
if want == have:
print(f"{env}: {len(have)} libraries as locked")
continue
bad = 1
for line in sorted(want - have):
print(f"{env}: locked but not installed: {line}", file=sys.stderr)
for line in sorted(have - want):
print(f"{env}: installed but not locked: {line}", file=sys.stderr)
if bad:
print(
"fix: tools/pio_lock.py freeze -e <env> after a clean `pio pkg install -e <env>`",
file=sys.stderr,
)
return bad
def moved(base: dict[str, list[str]], lock: dict[str, list[str]]) -> list[str]:
def versions(envs: dict[str, list[str]]) -> dict[str, set[str]]:
out: dict[str, set[str]] = {}
for lines in envs.values():
for line in lines:
if "://" not in line:
name, _, ver = line.rpartition("@")
out.setdefault(name, set()).add(ver)
return out
old, new = versions(base), versions(lock)
res = []
for name in sorted(set(old) | set(new), key=str.lower):
o, n = sorted(old.get(name, set())), sorted(new.get(name, set()))
if o != n:
res.append(
f"{name.split('/', 1)[-1]} {', '.join(o) or '-'} -> {', '.join(n) or '-'}"
)
return res
def main() -> None:
ap = argparse.ArgumentParser(
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
)
ap.add_argument("command", choices=["install", "check", "freeze", "envs", "moved"])
ap.add_argument(
"-e", "--env", action="append", default=[], help="PlatformIO env (repeat)"
)
ap.add_argument("--lock", type=Path, default=REPO / "platformio.lock")
ap.add_argument(
"--base", default="HEAD", help="moved: git revision to compare with"
)
a = ap.parse_args()
lock = read_lock(a.lock)
if a.command == "envs":
print("\n".join(sorted(lock)))
return
if a.command == "moved":
rel = a.lock.resolve().relative_to(REPO)
old = subprocess.run(
["git", "-C", str(REPO), "show", f"{a.base}:{rel}"],
capture_output=True,
text=True,
check=False,
).stdout
tmp = Path(os.environ.get("TMPDIR", "/tmp")) / f"pio-lock-base-{os.getpid()}"
tmp.write_text(old)
try:
print("\n".join(moved(read_lock(tmp), lock)))
finally:
tmp.unlink()
return
if not a.env:
ap.error("at least one -e ENV")
if a.command == "install":
sys.exit(cmd_install(lock, a.env))
if a.command == "check":
sys.exit(cmd_check(lock, a.env))
for env in a.env:
lock[env] = installed(env)
print(f"{env}: {len(lock[env])} libraries locked")
write_lock(a.lock, lock)
if __name__ == "__main__":
main()
+2
View File
@@ -223,6 +223,7 @@ build_flags =
-D MAX_GROUP_CHANNELS=40
-D BLE_PIN_CODE=123456
-D ENV_INCLUDE_GPS=1 ; enable the GPS page in UI
-D UI_SHOW_CLOCK=1 ; show clock and date on home screen by default
; -D BLE_DEBUG_LOGGING=1
-D OFFLINE_QUEUE_SIZE=256
; -D MESH_PACKET_LOGGING=1
@@ -245,6 +246,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
-D UI_SHOW_CLOCK=1 ; show clock and date on home screen by default
; -D BLE_PIN_CODE=123456
; -D BLE_DEBUG_LOGGING=1
; -D MESH_PACKET_LOGGING=1
+36 -41
View File
@@ -137,50 +137,45 @@ 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/<env>`) and
; check the result on the bench before releasing it.
; The masts' dependency set, in upstream's inheritance order (arduino_base,
; nrf52_base, sensor_base) -- ORDER MATTERS, it is the link order -- with the
; transitive libraries listed too. 23. 10. 2026 one commit built 271 kB
; differently from the image in the field because everything floated; since
; 30. 11. 2026 the exact versions are platformio.lock's job (tools/pio_lock.py,
; checked by every CI build) and the daily lock refresh moves them, so the
; versions here are ranges from the ones proven in the field. RadioLib and
; CustomLFS stay git pins.
[sensecap_pinned]
platform = nordicnrf52@10.12.0
platform = ${nrf52_base.platform}
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
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
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), listed for the link order
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