Skip to content

Commit

Permalink
DataRegion struct
Browse files Browse the repository at this point in the history
DataRegion struct from meshtastic#5043 PR
  • Loading branch information
lboue authored Oct 13, 2024
1 parent fb9f361 commit fb835ca
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/mesh/RadioInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit fb835ca

Please sign in to comment.