The SPI radio listens for the preamble the mesh actually sends
MeshCore transmits a 32-symbol preamble up to SF8 (16 above), but the node and the bridge configured the SX1262 for the library's fixed 12. The chip waits for the sync word only about as long as the preamble it expects, so it locked onto each packet, gave up, and locked on again further along the same preamble - decoding a packet only when it happened to catch the tail. On the uConsole that meant 0 of 5 detected packets decoded after a send; with 32 symbols, 4 of 4. The node now derives the preamble from the spreading factor as MeshCore does, and re-sends it to the listening chip when Device config changes the SF. preamble_length leaves the SPI wiring table (it was protocol, never wiring) and is retired; the bridge defaults to the same rule. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
9538bfedce
commit
dee4674942
8 files changed
+149
-10
No files matched your search
+13
-3
@@ -20,7 +20,7 @@ import os
|
||||
import sys
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from typing import Any, ClassVar
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
import tomllib
|
||||
@@ -93,7 +93,6 @@ class SpiWiring:
|
||||
use_dio2_rf: Whether DIO2 drives the RF switch.
|
||||
use_dio3_tcxo: Whether DIO3 powers a TCXO.
|
||||
is_waveshare: The Waveshare HAT's wiring quirks, which the radio library knows.
|
||||
preamble_length: LoRa preamble symbols.
|
||||
python: An interpreter to run the node under, when the one MeshTerm would find
|
||||
is not the one you want. Empty to let MeshTerm look.
|
||||
"""
|
||||
@@ -112,9 +111,14 @@ class SpiWiring:
|
||||
use_dio2_rf: bool = True
|
||||
use_dio3_tcxo: bool = True
|
||||
is_waveshare: bool = False
|
||||
preamble_length: int = 12
|
||||
python: str = ""
|
||||
|
||||
#: Keys this table once took and must never take again under another meaning (see
|
||||
#: :data:`meshterm.core.preferences.RETIRED`). ``preamble_length`` was never wiring: it is
|
||||
#: protocol, and a fixed 12 against a mesh sending 32 is what left the node deaf to
|
||||
#: most traffic; the node now derives it from the spreading factor as MeshCore does.
|
||||
RETIRED: ClassVar[frozenset[str]] = frozenset({"preamble_length"})
|
||||
|
||||
@classmethod
|
||||
def from_toml(cls, table: dict[str, Any]) -> SpiWiring:
|
||||
"""Build the wiring from a ``[profiles.<name>.spi]`` table, defaults for the rest.
|
||||
@@ -127,6 +131,12 @@ class SpiWiring:
|
||||
ValueError: On an unknown key or a value of the wrong type.
|
||||
"""
|
||||
known = {f.name: f for f in cls.__dataclass_fields__.values()}
|
||||
retired = sorted(set(table) & cls.RETIRED)
|
||||
if retired:
|
||||
raise ValueError(
|
||||
f"{', '.join(retired)} is no longer a wiring key — the node sets the "
|
||||
"preamble from the spreading factor, as MeshCore does; delete the line"
|
||||
)
|
||||
unknown = sorted(set(table) - set(known))
|
||||
if unknown:
|
||||
raise ValueError(f"unknown SPI wiring key(s): {', '.join(unknown)}")
|
||||
|
||||
Reference in new issue
Block a user