diff --git a/Cargo.lock b/Cargo.lock index 2121cdf..b5a2571 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1812,7 +1812,7 @@ dependencies = [ [[package]] name = "lora-modulation" version = "0.1.5" -source = "git+https://github.com/swaits/lora-rs.git?branch=fixed#e8a52ebd35352ce0267148fd392a0b1956d7735f" +source = "git+https://github.com/swaits/lora-rs.git?branch=fixed#043d7659dfe2148913f16b2f7ea3e9241642b770" dependencies = [ "defmt 0.3.100", ] @@ -1820,7 +1820,7 @@ dependencies = [ [[package]] name = "lora-phy" version = "3.0.2-alpha" -source = "git+https://github.com/swaits/lora-rs.git?branch=fixed#e8a52ebd35352ce0267148fd392a0b1956d7735f" +source = "git+https://github.com/swaits/lora-rs.git?branch=fixed#043d7659dfe2148913f16b2f7ea3e9241642b770" dependencies = [ "defmt 0.3.100", "document-features", @@ -1834,7 +1834,7 @@ dependencies = [ [[package]] name = "lorawan" version = "0.9.1" -source = "git+https://github.com/swaits/lora-rs.git?branch=fixed#e8a52ebd35352ce0267148fd392a0b1956d7735f" +source = "git+https://github.com/swaits/lora-rs.git?branch=fixed#043d7659dfe2148913f16b2f7ea3e9241642b770" dependencies = [ "aes", "cmac", @@ -1846,7 +1846,7 @@ dependencies = [ [[package]] name = "lorawan-device" version = "0.12.2" -source = "git+https://github.com/swaits/lora-rs.git?branch=fixed#e8a52ebd35352ce0267148fd392a0b1956d7735f" +source = "git+https://github.com/swaits/lora-rs.git?branch=fixed#043d7659dfe2148913f16b2f7ea3e9241642b770" dependencies = [ "defmt 0.3.100", "document-features", @@ -1861,7 +1861,7 @@ dependencies = [ [[package]] name = "lorawan-macros" version = "0.1.0" -source = "git+https://github.com/swaits/lora-rs.git?branch=fixed#e8a52ebd35352ce0267148fd392a0b1956d7735f" +source = "git+https://github.com/swaits/lora-rs.git?branch=fixed#043d7659dfe2148913f16b2f7ea3e9241642b770" dependencies = [ "proc-macro2", "quote", diff --git a/src/radio.rs b/src/radio.rs index cb39047..06ddf25 100644 --- a/src/radio.rs +++ b/src/radio.rs @@ -2096,6 +2096,22 @@ fn to_lora_mod_params( async fn reconfigure_radio(lora: &mut LoRaDriver, cfg: &LoRaConfig) -> Result<(), RadioError> { lora_setup("reconfigure_radio.enter_standby", lora.enter_standby()).await?; + // Apply the host-supplied LoRa sync word. The protocol field is a + // u16 holding the SX126x register pair in big-endian order + // (RadioLib convention: 0x1424 == byte 0x12 == LoRa "private" / + // MeshCore; 0x3444 == byte 0x34 == LoRaWAN "public"). lora-phy's + // set_lora_sync_word takes the underlying single-byte form, so + // undo the nibble encoding: convert_sync_word(byte) puts the + // chip's mandatory 0x4 in the low nibble of each register byte, + // and the high nibble of each register byte holds the original + // byte's high/low nibble respectively. + let [hi, lo] = cfg.sync_word.to_be_bytes(); + let sync_byte = (hi & 0xF0) | (lo >> 4); + lora_setup( + "reconfigure_radio.set_lora_sync_word", + lora.set_lora_sync_word(sync_byte), + ) + .await?; // Calibrate image etc. via a throwaway create_modulation_params call // — inside the SET_CONFIG OK window so first TX/RX is fast. let _ = to_lora_mod_params(lora, cfg)?;