Merge branch 'master' into 2264-feature-check-for-low-heap-before-adding-to-nodedb-was-reboot-loop-heap-too-low

This commit is contained in:
Ben Meadors 2023-03-18 07:26:44 -05:00 committed by GitHub
commit 3bb8cd7613
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 13 deletions

View File

@ -32,6 +32,7 @@ body:
options: options:
- Not Applicable - Not Applicable
- T-Beam - T-Beam
- T-Beam S3
- T-Beam 0.7 - T-Beam 0.7
- T-Lora v1 - T-Lora v1
- T-Lora v1.3 - T-Lora v1.3
@ -42,6 +43,7 @@ body:
- Heltec v1 - Heltec v1
- Heltec v2 - Heltec v2
- Heltec v2.1 - Heltec v2.1
- Heltec V3
- Relay v1 - Relay v1
- Relay v2 - Relay v2
- DIY - DIY

View File

@ -82,7 +82,7 @@ int MeshService::handleFromRadio(const meshtastic_MeshPacket *mp)
} }
printPacket("Forwarding to phone", mp); printPacket("Forwarding to phone", mp);
sendToPhone((meshtastic_MeshPacket *)mp); sendToPhone(packetPool.allocCopy(*mp));
return 0; return 0;
} }
@ -231,7 +231,7 @@ void MeshService::sendToMesh(meshtastic_MeshPacket *p, RxSource src, bool ccToPh
} }
if (ccToPhone) { if (ccToPhone) {
sendToPhone(p); sendToPhone(packetPool.allocCopy(*p));
} }
} }
@ -262,9 +262,8 @@ void MeshService::sendToPhone(meshtastic_MeshPacket *p)
releaseToPool(d); releaseToPool(d);
} }
meshtastic_MeshPacket *copied = packetPool.allocCopy(*p); perhapsDecode(p);
perhapsDecode(copied); assert(toPhoneQueue.enqueue(p, 0));
assert(toPhoneQueue.enqueue(copied, 0));
fromNum++; fromNum++;
} }

View File

@ -454,6 +454,7 @@ void RadioInterface::applyModemConfig()
// If user has manually specified a channel num, then use that, otherwise generate one by hashing the name // If user has manually specified a channel num, then use that, otherwise generate one by hashing the name
const char *channelName = channels.getName(channels.getPrimaryIndex()); const char *channelName = channels.getName(channels.getPrimaryIndex());
// channel_num is actually (channel_num - 1), since modulus (%) returns values from 0 to (numChannels - 1)
int channel_num = (loraConfig.channel_num ? loraConfig.channel_num - 1 : hash(channelName)) % numChannels; int channel_num = (loraConfig.channel_num ? loraConfig.channel_num - 1 : hash(channelName)) % numChannels;
// Old frequency selection formula // Old frequency selection formula
@ -480,7 +481,7 @@ void RadioInterface::applyModemConfig()
LOG_INFO("Radio myRegion->freqStart -> myRegion->freqEnd: %f -> %f (%f mhz)\n", myRegion->freqStart, myRegion->freqEnd, LOG_INFO("Radio myRegion->freqStart -> myRegion->freqEnd: %f -> %f (%f mhz)\n", myRegion->freqStart, myRegion->freqEnd,
myRegion->freqEnd - myRegion->freqStart); myRegion->freqEnd - myRegion->freqStart);
LOG_INFO("Radio myRegion->numChannels: %d x %.3fkHz\n", numChannels, bw); LOG_INFO("Radio myRegion->numChannels: %d x %.3fkHz\n", numChannels, bw);
LOG_INFO("Radio channel_num: %d\n", channel_num); LOG_INFO("Radio channel_num: %d\n", channel_num + 1);
LOG_INFO("Radio frequency: %f\n", getFreq()); LOG_INFO("Radio frequency: %f\n", getFreq());
LOG_INFO("Slot time: %u msec\n", slotTimeMsec); LOG_INFO("Slot time: %u msec\n", slotTimeMsec);
} }

View File

@ -164,13 +164,13 @@ bool ReliableRouter::stopRetransmission(GlobalPacketId key)
{ {
auto old = findPendingPacket(key); auto old = findPendingPacket(key);
if (old) { if (old) {
auto p = old->packet;
auto numErased = pending.erase(key); auto numErased = pending.erase(key);
assert(numErased == 1); assert(numErased == 1);
// remove the 'original' (identified by originator and packet->id) from the txqueue and free it // remove the 'original' (identified by originator and packet->id) from the txqueue and free it
cancelSending(getFrom(old->packet), old->packet->id); cancelSending(getFrom(p), p->id);
// now free the pooled copy for retransmission too. tryfix for #2228 // now free the pooled copy for retransmission too
if (old->packet) packetPool.release(p);
packetPool.release(old->packet);
return true; return true;
} else } else
return false; return false;

View File

@ -6,4 +6,13 @@ SX1268Interface::SX1268Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RA
SPIClass &spi) SPIClass &spi)
: SX126xInterface(cs, irq, rst, busy, spi) : SX126xInterface(cs, irq, rst, busy, spi)
{ {
}
float SX1268Interface::getFreq()
{
// Set frequency to default of EU_433 if outside of allowed range (e.g. when region is UNSET)
if (savedFreq < 410 || savedFreq > 810)
return 433.125f;
else
return savedFreq;
} }

View File

@ -8,8 +8,7 @@
class SX1268Interface : public SX126xInterface<SX1268> class SX1268Interface : public SX126xInterface<SX1268>
{ {
public: public:
/// override frequency of the SX1268 module regardless of the region (use EU433 value) virtual float getFreq() override;
virtual float getFreq() override { return 433.175f; }
SX1268Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi); SX1268Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi);
}; };

View File

@ -47,6 +47,8 @@ template <typename T> bool SX126xInterface<T>::init()
int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage, useRegulatorLDO); int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage, useRegulatorLDO);
// \todo Display actual typename of the adapter, not just `SX126x` // \todo Display actual typename of the adapter, not just `SX126x`
LOG_INFO("SX126x init result %d\n", res); LOG_INFO("SX126x init result %d\n", res);
if (res == RADIOLIB_ERR_CHIP_NOT_FOUND)
return false;
LOG_INFO("Frequency set to %f\n", getFreq()); LOG_INFO("Frequency set to %f\n", getFreq());
LOG_INFO("Bandwidth set to %f\n", bw); LOG_INFO("Bandwidth set to %f\n", bw);

View File

@ -1,4 +1,4 @@
[VERSION] [VERSION]
major = 2 major = 2
minor = 1 minor = 1
build = 2 build = 3