feat!: examples on donglora 1.0 async API with shared _common helpers
Rewrite all scripts against the DongLoRa Protocol v2 async Dongle surface, and extract the shared MeshCore US preset into a single module. * _common.py: MESHCORE_US preset (910.525 MHz / BW 62.5 / SF 7 / CR 4/5 / sync 0x1424 / 20 dBm) plus small helpers, imported by every example. * New: explore.py, which prints the device capabilities and runs a single TX + RX roundtrip for quick hardware validation. * simple_rx.py, simple_tx.py, ping_pong.py, lora_bridge.py all switch to donglora.Dongle and the new Modulation / LoRaConfig types. * all_commands.py removed; it was an index of the old v0.1 command enum that no longer exists after the Protocol v2 split. * justfile: drop stale recipes that referenced removed scripts.
This commit is contained in:
8 files changed
+204
-209
No files matched your search
+36
@@ -0,0 +1,36 @@
|
||||
"""Shared defaults for the example scripts.
|
||||
|
||||
MeshCore's "USA/Canada (Recommended)" preset, per
|
||||
https://github.com/ripplebiz/MeshCore/blob/main/docs/faq.md §6.1
|
||||
(the "narrow" channel the project moved to in October 2025):
|
||||
|
||||
* 910.525 MHz — inside the 902-928 MHz ISM band
|
||||
* 62.5 kHz bandwidth
|
||||
* SF 7 — lower SF for faster transmissions and better SNR headroom
|
||||
* CR 4/5 — RadioLib's ``LORA_CR=5``
|
||||
* 16-symbol preamble — matches every board variant's ``radio.begin(...)``
|
||||
* Sync word 0x1424 — ``RADIOLIB_SX126X_SYNC_WORD_PRIVATE``, the SX126x
|
||||
register encoding of the "private" byte 0x12 MeshCore uses to
|
||||
distinguish its traffic from LoRaWAN (byte 0x34, encoded 0x3444).
|
||||
* 20 dBm TX power — MeshCore's compile-time default (see
|
||||
``examples/companion_radio/MyMesh.h``).
|
||||
|
||||
If you operate in the EU, swap ``freq_hz`` for ``869_525_000`` (the
|
||||
EU-equivalent MeshCore channel) and cap ``tx_power_dbm`` at ``14`` to
|
||||
respect the 868 MHz duty-cycle / ERP rules.
|
||||
"""
|
||||
|
||||
import donglora as dl
|
||||
|
||||
MESHCORE_US = dl.LoRaConfig(
|
||||
freq_hz=910_525_000,
|
||||
sf=7,
|
||||
bw=dl.LoRaBandwidth.KHZ_62_5,
|
||||
cr=dl.LoRaCodingRate.CR_4_5,
|
||||
preamble_len=16,
|
||||
sync_word=0x1424,
|
||||
tx_power_dbm=20,
|
||||
header_mode=dl.LoRaHeaderMode.EXPLICIT,
|
||||
payload_crc=True,
|
||||
iq_invert=False,
|
||||
)
|
||||
Reference in new issue
Block a user