From fb835ca6ed9e81364727a77db3cf7059dfb51a05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20BOU=C3=89?= Date: Sun, 13 Oct 2024 20:50:30 +0200 Subject: [PATCH] DataRegion struct DataRegion struct from #5043 PR --- src/mesh/RadioInterface.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index 7501852f29..0eff919c08 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -18,6 +18,8 @@ frequency_switching, wide_lora, #name \ } +DataInfo DataRegion; + const RegionInfo regions[] = { /* https://link.springer.com/content/pdf/bbm%3A978-1-4842-4357-2%2F1.pdf @@ -212,6 +214,8 @@ uint32_t RadioInterface::getPacketTime(uint32_t pl) float tPacket = tPreamble + tPayload; uint32_t msecs = tPacket * 1000; + DataRegion.lora_sf=sf; + DataRegion.lora_cr=cr; return msecs; } @@ -556,6 +560,12 @@ void RadioInterface::applyModemConfig() preambleTimeMsec = getPacketTime((uint32_t)0); maxPacketTimeMsec = getPacketTime(meshtastic_Constants_DATA_PAYLOAD_LEN + sizeof(PacketHeader)); + DataRegion.lora_channel_num=channel_num; + DataRegion.lora_freq=getFreq(); + DataRegion.lora_channel_name=channelName; + DataRegion.lora_power_output=power; + DataRegion.lora_bw=bw; + LOG_INFO("Radio freq=%.3f, config.lora.frequency_offset=%.3f\n", freq, loraConfig.frequency_offset); LOG_INFO("Set radio: region=%s, name=%s, config=%u, ch=%d, power=%d\n", myRegion->name, channelName, loraConfig.modem_preset, channel_num, power);