feat(e2e): Meshtasticator radio-level validation harness for the adapter #2
@@ -93,7 +93,31 @@ start_forwards() {
|
||||
}
|
||||
|
||||
SIM_LOG="$REPO_ROOT/meshtasticator-sim.log"
|
||||
SIM_ARGS=("$NODES" -v) # -v: meshtastic/debug logging for RF diagnostics
|
||||
# Deterministic topology: random placement may leave nodes out of range
|
||||
# (nothing was ever delivered between nodes). Provide a --from-file scenario
|
||||
# with all nodes within ~10 m of each other so RF adjacency is guaranteed.
|
||||
NODE_CONF_DIR="$SIM_DIR/out"
|
||||
mkdir -p "$NODE_CONF_DIR"
|
||||
"$VENV/bin/python" - "$NODE_CONF_DIR/nodeConfig.yaml" "$NODES" <<'PY'
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
path, count = sys.argv[1], int(sys.argv[2])
|
||||
conf = {}
|
||||
for i in range(count):
|
||||
x = float((i - (count - 1) / 2) * 10.0) # 10 m spacing around the origin
|
||||
conf[i] = {
|
||||
"x": x, "y": 0.0, "z": 1.0,
|
||||
"isRouter": False, "isRepeater": False, "isClientMute": False,
|
||||
"hopLimit": 3, "antennaGain": 0, "neighborInfo": False,
|
||||
}
|
||||
Path(path).write_text(
|
||||
"".join(f"{k}:\n" + "".join(f" {ck}: {cv}\n" for ck, cv in v.items())
|
||||
for k, v in conf.items())
|
||||
)
|
||||
print(f"wrote deterministic node scenario ({count} nodes) to {path}")
|
||||
PY
|
||||
SIM_ARGS=("--from-file" -v) # node count/positions come from nodeConfig.yaml
|
||||
if [ "$MODE" = native ]; then
|
||||
[ -n "$PROGRAM" ] && [ -d "$PROGRAM" ] || { echo "--mode native needs --program <dir>" >&2; exit 2; }
|
||||
SIM_ARGS+=(-p "$PROGRAM")
|
||||
@@ -159,6 +183,14 @@ new = old + (
|
||||
assert old in src, "simulator subscription moved in the pinned meshtasticator"
|
||||
src = src.replace(old, new, 1)
|
||||
|
||||
old = ' rxs, rssis, snrs = self.calc_receivers(transmitter, receivers)'
|
||||
new = old + (
|
||||
'\n print(f"[sim] TX node={transmitter.nodeid} candidates={[n.nodeid for n in receivers]} '
|
||||
'rxs={[n.nodeid for n in rxs]} rssis={rssis}")'
|
||||
)
|
||||
assert old in src, "calc_receivers call moved in the pinned meshtasticator"
|
||||
src = src.replace(old, new, 1)
|
||||
|
||||
interactive.write_text(src)
|
||||
print("patched lib/interactive.py (RF instrumentation)")
|
||||
PY
|
||||
|
||||
Reference in New Issue
Block a user