diff --git a/plugins/channel/lora/lorabits.h b/plugins/channel/lora/lorabits.h
index 3ce7d9697..9698a5618 100644
--- a/plugins/channel/lora/lorabits.h
+++ b/plugins/channel/lora/lorabits.h
@@ -1,10 +1,15 @@
/*
Interleaving is "easiest" if the same number of bits is used per symbol as for FEC
Chosen mode "spreading 8, low rate" has 6 bits per symbol, so use 4:6 FEC
+
+ More spreading needs higher frequency resolution and longer time on air, increasing drift errors.
+ Want higher bandwidth when using more spreading, which needs more CPU.
+
+ Six bit Hamming can only correct drift errors. Want 7 or 8 bit FEC for QRM
*/
// Needs adjusting for different sizes
-void LoRaDemod::interleave(char* inout, int size)
+void LoRaDemod::interleave6(char* inout, int size)
{
int i, j;
char in[6 * 2];
@@ -32,7 +37,7 @@ short LoRaDemod::toGray(short num)
}
// ignore FEC, try to extract raw bits
-void LoRaDemod::hamming(char* c, int size)
+void LoRaDemod::hamming6(char* c, int size)
{
int i;
@@ -53,7 +58,7 @@ void LoRaDemod::hamming(char* c, int size)
}
// data whitening (6 bit)
-void LoRaDemod::prng(char* inout, int size)
+void LoRaDemod::prng6(char* inout, int size)
{
const char otp[] = {
"5^ZSm0=cOGMgUB=bNcb<@a^T;_f=6DEB]2ImPIKg:j]RlYT4YZ<`9hZ\\PPb;@8X8i]Zmc_6B52\\8oUPHIcBOc>dY?d9[n5Lg]b]R8hR<0`T008h9c9QJm[c?a:lQEGa;nU=b_UbTW3=W5Aa<9i;F;ondS[LBA;[4S9]kkh]Vc2j>kX"
diff --git a/plugins/channel/lora/lorademod.cpp b/plugins/channel/lora/lorademod.cpp
index 8db1b9201..cea99b88a 100644
--- a/plugins/channel/lora/lorademod.cpp
+++ b/plugins/channel/lora/lorademod.cpp
@@ -85,9 +85,9 @@ void LoRaDemod::dumpRaw()
text[j] = toGray(bin >> 1);
}
- prng(text, max);
- interleave(text, max);
- hamming(text, max);
+ prng6(text, max);
+ interleave6(text, max);
+ hamming6(text, max);
for ( j=0; j < max / 2; j++) {
text[j] = (text[j * 2 + 2] << 4) | (0xf & text[j * 2 + 1]);
@@ -167,7 +167,7 @@ int LoRaDemod::detect(Complex c, Complex a)
q = (result + 1) & (LORA_SFFT_LEN -1);
finetune[15 & m_time] = (mag[p] > mag[q]) ? -1 : 1;
- if (peak < negpeak * 4)
+ if (peak < negpeak * LORA_SQUELCH)
result = -1;
result = synch(result);
if (result >= 0)
diff --git a/plugins/channel/lora/lorademod.h b/plugins/channel/lora/lorademod.h
index 915e2799c..092bc194f 100644
--- a/plugins/channel/lora/lorademod.h
+++ b/plugins/channel/lora/lorademod.h
@@ -29,6 +29,7 @@
#define SAMPLEBITS (DATA_BITS + 2)
#define SPREADFACTOR (1 << SAMPLEBITS)
#define LORA_SFFT_LEN (SPREADFACTOR / 2)
+#define LORA_SQUELCH (3)
class LoRaDemod : public SampleSink {
public:
@@ -44,12 +45,12 @@ public:
private:
int detect(Complex sample, Complex angle);
- void interleave(char* inout, int size);
void dumpRaw(void);
short synch (short bin);
short toGray(short bin);
- void hamming(char* inout, int size);
- void prng(char* inout, int size);
+ void interleave6(char* inout, int size);
+ void hamming6(char* inout, int size);
+ void prng6(char* inout, int size);
class MsgConfigureLoRaDemod : public Message {
MESSAGE_CLASS_DECLARATION
diff --git a/plugins/channel/lora/lorademodgui.cpp b/plugins/channel/lora/lorademodgui.cpp
index 0827edcae..5ee728317 100644
--- a/plugins/channel/lora/lorademodgui.cpp
+++ b/plugins/channel/lora/lorademodgui.cpp
@@ -86,7 +86,7 @@ void LoRaDemodGUI::viewChanged()
void LoRaDemodGUI::on_BW_valueChanged(int value)
{
- const int loraBW[] = {7813, 15625, 10417, 20833};
+ const int loraBW[] = {7813, 15625, 31250, 62500};
int thisBW = loraBW[value];
ui->BWText->setText(QString("%1 Hz").arg(thisBW));
m_channelMarker->setBandwidth(thisBW);
@@ -165,7 +165,7 @@ LoRaDemodGUI::~LoRaDemodGUI()
void LoRaDemodGUI::applySettings()
{
- const int loraBW[] = {7813, 15625, 10417, 20833};
+ const int loraBW[] = {7813, 15625, 31250, 62500};
int thisBW = loraBW[ui->BW->value()];
m_channelizer->configure(m_threadedSampleSink->getMessageQueue(),
thisBW,
diff --git a/plugins/channel/lora/lorademodgui.ui b/plugins/channel/lora/lorademodgui.ui
index 068f86aae..6d80992d7 100644
--- a/plugins/channel/lora/lorademodgui.ui
+++ b/plugins/channel/lora/lorademodgui.ui
@@ -52,7 +52,7 @@
0
- 1
+ 2
1