Merge main into ota-admin: tools split, WITH_RX_POWERSAVING
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
81d7f600d8
53 files changed
+7121
-64
No files matched your search
@@ -12,10 +12,29 @@ runs:
|
||||
key: ${{ runner.os }}-pio
|
||||
|
||||
- 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
|
||||
venv="$RUNNER_TEMP/pyenv"
|
||||
if ! python3 -m venv "$venv"; then
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq python3 python3-venv
|
||||
python3 -m venv --clear "$venv"
|
||||
fi
|
||||
echo "$venv/bin" >>"$GITHUB_PATH"
|
||||
"$venv/bin/python" --version
|
||||
|
||||
- name: Install PlatformIO
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
+5
-2
@@ -5,12 +5,15 @@
|
||||
# PLATFORMIO_BUILD_FLAGS after each env's flags: last -D wins.
|
||||
#
|
||||
# 869.432/62.5/SF7/CR5; repeater + room server: zero-hop advert off, flood
|
||||
# advert 25 h, af 9 (= 10 % duty cycle); repeater: regions cz,cs next to *.
|
||||
# advert 25 h, AIRTIME_FACTOR 9 (= `dutycycle` 10 %); repeater: regions cz,cs next to *.
|
||||
# Path hash 2 B is this fork's default anyway. TX power stays the board's.
|
||||
# FILTER_CHANNEL_PSKS = [channel_filter] in platformio.ini (#meshcore, Public,
|
||||
# #test -- public keys): compiles the repeater's `filter` (deny-forward by
|
||||
# sender name); inert until an operator adds a name.
|
||||
PUB_FLAGS='-D LORA_FREQ=869.432 -D LORA_BW=62.5 -D LORA_SF=7 -D LORA_CR=5
|
||||
# WITH_RX_POWERSAVING compiles `set radio.rxps` (SX1262 RX duty cycle); off
|
||||
# until an operator sets it.
|
||||
PUB_FLAGS='-D WITH_RX_POWERSAVING
|
||||
-D LORA_FREQ=869.432 -D LORA_BW=62.5 -D LORA_SF=7 -D LORA_CR=5
|
||||
-D ADVERT_INTERVAL_DEFAULT=0 -D FLOOD_ADVERT_INTERVAL_DEFAULT=25
|
||||
-D AIRTIME_FACTOR_DEFAULT=9.0 -D DEFAULT_REGIONS=\"cz,cs\"
|
||||
-D FILTER_CHANNEL_PSKS=\"2fa78a5aef618e7c2a78f0ab5c8869b3,8b3387e9c5cdea6ac9e5edbaa115cd72,9cd8fcf22a47333b591d96a2b848b73f\"'
|
||||
|
||||
@@ -11,8 +11,13 @@
|
||||
#
|
||||
# Runs on every push to main -- the export pushes there only after an
|
||||
# upstream merge (private repo, tth-upstream-sync) -- and by hand.
|
||||
# Release tag tth-<sha8>, titled with the stamped version (v1.18.0-tth<sha>);
|
||||
# the newest KEEP releases stay, older ones are deleted.
|
||||
# Release tag v1.18.0+tth.<commit date>[.n] (the n-th release of that day),
|
||||
# titled "v1.18.0+tth · 12. 11. 2026"; assets carry the tag in their names, the
|
||||
# body the version the node reports (`ver`: v1.18.0-tth<sha>). Until 12. 11.
|
||||
# 2026 the tags were tth-<sha8>; pruning and the changelog know both;
|
||||
# the newest KEEP releases stay, older ones are deleted. The body is a
|
||||
# changelog since the previous release: our own commits, then the upstream
|
||||
# PRs the upstream merges brought in.
|
||||
# nRF52: .uf2 (drag onto the bootloader drive) and .zip (DFU over BLE or
|
||||
# serial); ESP32: -merged.bin (fresh install at 0x0) and .bin (update).
|
||||
name: pub-release
|
||||
@@ -62,39 +67,58 @@ jobs:
|
||||
|
||||
- name: Commit and tag
|
||||
id: src
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITEA_TOKEN || github.token }}
|
||||
REPLACE: ${{ github.event.inputs.replace }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git fetch -q --tags
|
||||
sha=$(git rev-parse HEAD)
|
||||
echo "sha=$sha" >>"$GITHUB_OUTPUT"
|
||||
echo "tag=tth-${sha:0:8}" >>"$GITHUB_OUTPUT"
|
||||
git describe --tags --abbrev=0 --match '*v[0-9]*' HEAD
|
||||
|
||||
- name: Release exists?
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITEA_TOKEN || github.token }}
|
||||
TAG: ${{ steps.src.outputs.tag }}
|
||||
REPLACE: ${{ github.event.inputs.replace }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# upstream base as tools/build_version.py finds it: "companion-v1.18.0" -> v1.18.0
|
||||
desc=$(git describe --tags --abbrev=0 --match '*v[0-9]*' --exclude '*+tth*' --exclude 'backup/*' HEAD)
|
||||
[[ $desc =~ v[0-9].* ]] && base=${BASH_REMATCH[0]} || base=$desc
|
||||
# the COMMIT's date (Prague), so a rebuild of the same commit keeps its tag
|
||||
day=$(TZ=Europe/Prague git show -s --format=%cd --date=format-local:%Y%m%d HEAD)
|
||||
human=$(TZ=Europe/Prague git show -s --format=%cd --date=format-local:'%-d. %-m. %Y' HEAD)
|
||||
api="$GITEA/api/v1/repos/$GITHUB_REPOSITORY"
|
||||
auth="header = \"Authorization: token $TOKEN\""
|
||||
id=$(curl -sS --config - "$api/releases/tags/$TAG" <<<"$auth" | jq -r '.id // empty')
|
||||
if [ -n "$id" ]; then
|
||||
if [ "$REPLACE" != "true" ]; then
|
||||
echo "::error::release $TAG already exists (id $id); set replace=true to rebuild it"
|
||||
exit 1
|
||||
enc() { jq -rn --arg s "$1" '$s|@uri'; }
|
||||
# v1.18.0+tth.20261112, a second release of the day .2, ...
|
||||
n=1
|
||||
while :; do
|
||||
tag="$base+tth.$day"
|
||||
[ "$n" -eq 1 ] || tag="$tag.$n"
|
||||
rel=$(curl -sS --config - "$api/releases/tags/$(enc "$tag")" <<<"$auth")
|
||||
id=$(jq -r '.id // empty' <<<"$rel")
|
||||
[ -n "$id" ] || break
|
||||
if [ "$(jq -r .target_commitish <<<"$rel")" = "$sha" ]; then
|
||||
if [ "$REPLACE" != "true" ]; then
|
||||
echo "::error::release $tag already exists (id $id); set replace=true to rebuild it"
|
||||
exit 1
|
||||
fi
|
||||
curl -sSf --config - -X DELETE "$api/releases/$id" <<<"$auth"
|
||||
curl -sSf --config - -X DELETE "$api/tags/$(enc "$tag")" <<<"$auth" || true
|
||||
echo "removed old $tag"
|
||||
break
|
||||
fi
|
||||
curl -sSf --config - -X DELETE "$api/releases/$id" <<<"$auth"
|
||||
curl -sSf --config - -X DELETE "$api/tags/$TAG" <<<"$auth" || true
|
||||
echo "removed old $TAG"
|
||||
fi
|
||||
n=$((n + 1))
|
||||
done
|
||||
title="$base+tth · $human"
|
||||
[ "$n" -eq 1 ] || title="$title ($n)"
|
||||
echo "release $tag: $title (commit $sha)"
|
||||
{
|
||||
echo "sha=$sha"
|
||||
echo "tag=$tag"
|
||||
echo "title=$title"
|
||||
} >>"$GITHUB_OUTPUT"
|
||||
|
||||
- name: Setup Build Environment
|
||||
uses: ./.github/actions/setup-build-environment
|
||||
|
||||
- name: Build and package
|
||||
id: build
|
||||
env:
|
||||
TAG: ${{ steps.src.outputs.tag }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
source .github/fw-flags.sh
|
||||
@@ -111,15 +135,15 @@ jobs:
|
||||
b=".pio/build/$env"
|
||||
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-$sha.uf2"
|
||||
cp "$b/firmware.zip" "$dist/$env$suffix-$sha.zip"
|
||||
cp "$b/firmware.uf2" "$dist/$env$suffix-$TAG.uf2"
|
||||
cp "$b/firmware.zip" "$dist/$env$suffix-$TAG.zip"
|
||||
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"
|
||||
else # ESP32
|
||||
PLATFORMIO_BUILD_FLAGS="$PUB_FLAGS $2" pio run -t mergebin -e "$env"
|
||||
cp "$b/firmware.bin" "$dist/$env$suffix-$sha.bin"
|
||||
cp "$b/firmware-merged.bin" "$dist/$env$suffix-$sha-merged.bin"
|
||||
cp "$b/firmware.bin" "$dist/$env$suffix-$TAG.bin"
|
||||
cp "$b/firmware-merged.bin" "$dist/$env$suffix-$TAG-merged.bin"
|
||||
fi
|
||||
echo "::endgroup::"
|
||||
}
|
||||
@@ -135,34 +159,128 @@ jobs:
|
||||
TOKEN: ${{ secrets.GITEA_TOKEN || github.token }}
|
||||
SHA: ${{ steps.src.outputs.sha }}
|
||||
TAG: ${{ steps.src.outputs.tag }}
|
||||
TITLE: ${{ steps.src.outputs.title }}
|
||||
VERSION: ${{ steps.build.outputs.version }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
api="$GITEA/api/v1/repos/$GITHUB_REPOSITORY"
|
||||
auth="header = \"Authorization: token $TOKEN\""
|
||||
note='BLE PIN 123456 and admin password "password" are placeholders: change them after flashing.
|
||||
*-observer: repeater with a BLE console (OFF after flashing: set a PIN, then send ble on) and the
|
||||
rxlog / pktlog rings for the repeater observer.
|
||||
Czech mesh defaults (meshcore.cz): 869.432 MHz / 62.5 kHz / SF7 / CR5; repeater: zero-hop advert off,
|
||||
flood advert 25 h, af 9 (10 % duty cycle), regions cz + cs. Apply to a fresh or erased node only.'
|
||||
body=$(printf '%s\n\ncommit %s, run %s\n\n%s\nWhat this fork changes against upstream: see README.md.\n' \
|
||||
"$VERSION" "$SHA" "$GITHUB_RUN_NUMBER" "$note")
|
||||
jq -n --arg t "$TAG" --arg c "$SHA" --arg n "$VERSION" --arg b "$body" \
|
||||
readme="$GITEA/$GITHUB_REPOSITORY#o-tomto-forku-meshcore-tth"
|
||||
note=$(cat <<EOF
|
||||
- **BLE PIN \`123456\` a admin heslo \`password\` jsou zástupné.** Po nahrání je změň: \`password <nové>\` (nejvýš 15
|
||||
znaků), \`ble pin <6 číslic>\`.
|
||||
- **Výchozí nastavení pro český mesh** ([meshcore.cz](https://meshcore.cz/)): 869,432 MHz / 62,5 kHz / SF7 / CR5;
|
||||
repeater a room server: zero-hop advert vypnutý, flood advert á 25 h, duty cycle 10 % (\`get dutycycle\`); repeater:
|
||||
regiony \`cz\` a \`cs\`. **Platí jen pro nový nebo smazaný uzel** – nové nahrání ponechá uložené nastavení.
|
||||
- **\`*-observer\`**: repeater s BLE konzolí a buffery \`rxlog\` / \`pktlog\` pro repeater observer. BLE je po nahrání
|
||||
vypnuté: nejdřív \`ble pin\`, pak \`ble on\`.
|
||||
- **RX duty cycle** (\`set radio.rxps\`, jen SX1262) je zabudovaný a vypnutý.
|
||||
- Ověření: \`ver\` ukáže verzi z řádku *Verze v uzlu* výše. Co fork mění proti upstreamu: [README]($readme).
|
||||
|
||||
<details><summary>English</summary>
|
||||
|
||||
- **BLE PIN \`123456\` and admin password \`password\` are placeholders.** Change them after flashing: \`password
|
||||
<new>\` (15 characters at most), \`ble pin <6 digits>\`.
|
||||
- **Czech mesh defaults** ([meshcore.cz](https://meshcore.cz/)): 869.432 MHz / 62.5 kHz / SF7 / CR5; repeater and room
|
||||
server: zero-hop advert off, flood advert every 25 h, 10 % duty cycle (\`get dutycycle\`); repeater: regions \`cz\`
|
||||
and \`cs\`. **A fresh or erased node only** – a reflash keeps the saved settings.
|
||||
- **\`*-observer\`**: repeater with a BLE console and the \`rxlog\` / \`pktlog\` rings for the repeater observer. BLE
|
||||
is off after flashing: \`ble pin\` first, then \`ble on\`.
|
||||
- **RX duty cycle** (\`set radio.rxps\`, SX1262 only) is built in and off.
|
||||
- Check: \`ver\` shows the version from the *Verze v uzlu* (node version) line above. What the fork changes against
|
||||
upstream: [README]($readme).
|
||||
|
||||
</details>
|
||||
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
|
||||
if [ "$c" != "$SHA" ] && git merge-base --is-ancestor "$c" "$SHA" 2>/dev/null; then
|
||||
prev=$t base=$c
|
||||
break
|
||||
fi
|
||||
done < <(curl -sSf --config - "$api/releases?limit=50" <<<"$auth" |
|
||||
jq -r --arg t "$TAG" 'map(select(.tag_name | startswith("tth-") or test("[+]tth[.]")) | select(.tag_name != $t))
|
||||
| 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
|
||||
fmt="- %s ([%h]($web/commit/%H))"
|
||||
ours=""
|
||||
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
|
||||
ours+=$(git log --no-merges --format="$fmt" "$c^1..$c^2")$'\n'
|
||||
else
|
||||
ours+=$(git log -1 --format="$fmt" "$c")$'\n'
|
||||
fi
|
||||
done
|
||||
ours=${ours%$'\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[@]}
|
||||
body=$(
|
||||
echo "$TITLE"
|
||||
echo
|
||||
echo "Verze v uzlu · \`ver\`: $VERSION"
|
||||
echo
|
||||
if [ -n "$prev" ]; then
|
||||
echo "Od předchozího vydání · since [$prev]($web/releases/tag/$(jq -rn --arg s "$prev" '$s|@uri'))"
|
||||
echo
|
||||
fi
|
||||
echo "### Změny forku · fork changes"
|
||||
echo "${ours:-- žádné · none}"
|
||||
echo
|
||||
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
|
||||
echo "### Po flashi · after flashing"
|
||||
echo
|
||||
echo "$note"
|
||||
echo
|
||||
echo "commit $SHA, run $GITHUB_RUN_NUMBER"
|
||||
)
|
||||
jq -n --arg t "$TAG" --arg c "$SHA" --arg n "$TITLE" --arg b "$body" \
|
||||
'{tag_name: $t, target_commitish: $c, name: $n, body: $b}' >"$RUNNER_TEMP/rel.json"
|
||||
id=$(curl -sSf --config - -X POST -H 'Content-Type: application/json' \
|
||||
--data-binary "@$RUNNER_TEMP/rel.json" "$api/releases" <<<"$auth" | jq -r .id)
|
||||
for f in dist/*; do
|
||||
curl -sSf --config - -X POST -F "attachment=@$f" \
|
||||
"$api/releases/$id/assets?name=$(basename "$f")" <<<"$auth" >/dev/null
|
||||
"$api/releases/$id/assets?name=$(jq -rn --arg s "${f##*/}" '$s|@uri')" <<<"$auth" >/dev/null
|
||||
echo "uploaded $(basename "$f")"
|
||||
done
|
||||
echo "released $TAG = $VERSION (id $id)"
|
||||
# keep the newest $KEEP, oldest go (with their tags)
|
||||
curl -sSf --config - "$api/releases?limit=50" <<<"$auth" |
|
||||
jq -r --argjson k "$KEEP" 'map(select(.tag_name | startswith("tth-")))
|
||||
jq -r --argjson k "$KEEP" 'map(select(.tag_name | startswith("tth-") or test("[+]tth[.]")))
|
||||
| sort_by(.created_at) | reverse | .[$k:][] | "\(.id) \(.tag_name)"' |
|
||||
while read -r old_id old_tag; do
|
||||
curl -sSf --config - -X DELETE "$api/releases/$old_id" <<<"$auth"
|
||||
curl -sSf --config - -X DELETE "$api/tags/$old_tag" <<<"$auth" || true
|
||||
curl -sSf --config - -X DELETE "$api/tags/$(jq -rn --arg s "$old_tag" '$s|@uri')" <<<"$auth" || true
|
||||
echo "pruned $old_tag"
|
||||
done
|
||||
Reference in new issue
Block a user