1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-18 07:35:47 -05:00
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 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 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 // Needs adjusting for different sizes
void LoRaDemod::interleave(char* inout, int size) void LoRaDemod::interleave6(char* inout, int size)
{ {
int i, j; int i, j;
char in[6 * 2]; char in[6 * 2];
@ -32,7 +37,7 @@ short LoRaDemod::toGray(short num)
} }
// ignore FEC, try to extract raw bits // ignore FEC, try to extract raw bits
void LoRaDemod::hamming(char* c, int size) void LoRaDemod::hamming6(char* c, int size)
{ {
int i; int i;
@ -53,7 +58,7 @@ void LoRaDemod::hamming(char* c, int size)
} }
// data whitening (6 bit) // data whitening (6 bit)
void LoRaDemod::prng(char* inout, int size) void LoRaDemod::prng6(char* inout, int size)
{ {
const char otp[] = { 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" "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); text[j] = toGray(bin >> 1);
} }
prng(text, max); prng6(text, max);
interleave(text, max); interleave6(text, max);
hamming(text, max); hamming6(text, max);
for ( j=0; j < max / 2; j++) { for ( j=0; j < max / 2; j++) {
text[j] = (text[j * 2 + 2] << 4) | (0xf & text[j * 2 + 1]); 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); q = (result + 1) & (LORA_SFFT_LEN -1);
finetune[15 & m_time] = (mag[p] > mag[q]) ? -1 : 1; finetune[15 & m_time] = (mag[p] > mag[q]) ? -1 : 1;
if (peak < negpeak * 4) if (peak < negpeak * LORA_SQUELCH)
result = -1; result = -1;
result = synch(result); result = synch(result);
if (result >= 0) if (result >= 0)

View File

@ -29,6 +29,7 @@
#define SAMPLEBITS (DATA_BITS + 2) #define SAMPLEBITS (DATA_BITS + 2)
#define SPREADFACTOR (1 << SAMPLEBITS) #define SPREADFACTOR (1 << SAMPLEBITS)
#define LORA_SFFT_LEN (SPREADFACTOR / 2) #define LORA_SFFT_LEN (SPREADFACTOR / 2)
#define LORA_SQUELCH (3)
class LoRaDemod : public SampleSink { class LoRaDemod : public SampleSink {
public: public:
@ -44,12 +45,12 @@ public:
private: private:
int detect(Complex sample, Complex angle); int detect(Complex sample, Complex angle);
void interleave(char* inout, int size);
void dumpRaw(void); void dumpRaw(void);
short synch (short bin); short synch (short bin);
short toGray(short bin); short toGray(short bin);
void hamming(char* inout, int size); void interleave6(char* inout, int size);
void prng(char* inout, int size); void hamming6(char* inout, int size);
void prng6(char* inout, int size);
class MsgConfigureLoRaDemod : public Message { class MsgConfigureLoRaDemod : public Message {
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION

View File

@ -86,7 +86,7 @@ void LoRaDemodGUI::viewChanged()
void LoRaDemodGUI::on_BW_valueChanged(int value) 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]; int thisBW = loraBW[value];
ui->BWText->setText(QString("%1 Hz").arg(thisBW)); ui->BWText->setText(QString("%1 Hz").arg(thisBW));
m_channelMarker->setBandwidth(thisBW); m_channelMarker->setBandwidth(thisBW);
@ -165,7 +165,7 @@ LoRaDemodGUI::~LoRaDemodGUI()
void LoRaDemodGUI::applySettings() void LoRaDemodGUI::applySettings()
{ {
const int loraBW[] = {7813, 15625, 10417, 20833}; const int loraBW[] = {7813, 15625, 31250, 62500};
int thisBW = loraBW[ui->BW->value()]; int thisBW = loraBW[ui->BW->value()];
m_channelizer->configure(m_threadedSampleSink->getMessageQueue(), m_channelizer->configure(m_threadedSampleSink->getMessageQueue(),
thisBW, thisBW,

View File

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