From b32a18393a6a32ecb7243aa011c88a8ea9c54a6a Mon Sep 17 00:00:00 2001 From: zhgzhg Date: Sun, 31 Mar 2024 18:50:09 +0300 Subject: [PATCH] Upgrade to RadioLib 6.5.0 --- RadioLib | 2 +- smtUdpPacketForwarder/Radio.cpp | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/RadioLib b/RadioLib index e81859a..b6de4c5 160000 --- a/RadioLib +++ b/RadioLib @@ -1 +1 @@ -Subproject commit e81859a482184c2e9db4dd246bb66dc07fb33649 +Subproject commit b6de4c588960ab44b4188adc1a47e0e0e110876d diff --git a/smtUdpPacketForwarder/Radio.cpp b/smtUdpPacketForwarder/Radio.cpp index eac1124..c90cc38 100644 --- a/smtUdpPacketForwarder/Radio.cpp +++ b/smtUdpPacketForwarder/Radio.cpp @@ -147,7 +147,6 @@ void hexPrint(uint8_t data[], int length, FILE *dest) { // {{{ } else { \ SX126x* sx126x_chip = dynamic_cast(origin); \ if (sx126x_chip != nullptr) { \ - sx126x_chip->XTAL = true; \ result = sx126x_chip->invertIQ(false); \ if (result == RADIOLIB_ERR_NONE) { \ result = sx126x_chip->setCRC((uint8_t) 1); \ @@ -185,7 +184,6 @@ void hexPrint(uint8_t data[], int length, FILE *dest) { // {{{ } else { \ SX126x* sx126x_chip = dynamic_cast(origin); \ if (sx126x_chip != nullptr) { \ - sx126x_chip->XTAL = true; \ result = sx126x_chip->invertIQ(downlink_pkt.iq_polatization_inversion); \ if (result == RADIOLIB_ERR_NONE) { \ result = sx126x_chip->setCRC(downlink_pkt.disable_crc ? (uint8_t) 0 : (uint8_t) 1); \ @@ -205,8 +203,6 @@ void hexPrint(uint8_t data[], int length, FILE *dest) { // {{{ downlink_pkt.preamble_length, \ false /* don't use OOK */ \ ); \ - SX126x* sx126x_chip = dynamic_cast(origin); \ - if (sx126x_chip != nullptr) sx126x_chip->XTAL = true; \ if (result == RADIOLIB_ERR_NONE) result = chip->setSyncWord(gfskSyncWord, ((uint8_t) sizeof(gfskSyncWord))); \ } \ if (result == RADIOLIB_ERR_NONE) result = chip->setCurrentLimit(current_lim_ma); \ @@ -267,7 +263,16 @@ PhysicalLayer* instantiateLoRaChip(LoRaChipSettings_t& lora_chip_settings, SPICl spiSettings ); - return LORA_CHIPS.at(lora_chip_settings.ic_model)(module_settings); + auto instance = LORA_CHIPS.at(lora_chip_settings.ic_model)(module_settings); + + SX126x* sx126x_chip = dynamic_cast(instance); + if (sx126x_chip != nullptr) + { + sx126x_chip->XTAL = true; + sx126x_chip->standbyXOSC = true; + } + + return instance; } // }}} #define PKT_ENRICHER(origin_class, instance_ptr, inst_type_info, lora_packet, freq_err) \