This commit is contained in:
John Greb 2015-02-12 09:37:08 +00:00
parent dd8ffc3f31
commit cf38c13bb6
5 changed files with 19 additions and 13 deletions

View File

@ -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"

View File

@ -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)

View File

@ -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

View File

@ -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,

View File

@ -52,7 +52,7 @@
<number>0</number>
</property>
<property name="maximum">
<number>1</number>
<number>2</number>
</property>
<property name="pageStep">
<number>1</number>