1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-16 13:21:50 -05:00

Implicit Mode.

This commit is contained in:
John Greb 2015-02-13 18:16:22 +00:00
parent cf38c13bb6
commit 3705b062a0
2 changed files with 27 additions and 14 deletions

View File

@ -3,12 +3,15 @@
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. 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. Want higher bandwidth when using more spreading, which needs more CPU and a better FFT.
Six bit Hamming can only correct drift errors. Want 7 or 8 bit FEC for QRM Six bit Hamming can only correct drift errors. Need 7 or 8 bit FEC for QRM
Easier to use 5:4 FEC with Reed-Soloman messages.
Implicit Mode: explicit starts with a 4:8 block and has different whitening
*/ */
// Needs adjusting for different sizes // Six bits per symbol, six chars per block
void LoRaDemod::interleave6(char* inout, int size) void LoRaDemod::interleave6(char* inout, int size)
{ {
int i, j; int i, j;
@ -46,11 +49,11 @@ void LoRaDemod::hamming6(char* c, int size)
i++; i++;
c[i] = ((c[i] & 1)<<2) | ((c[i] & 2)<<2) | ((c[i] & 4)>>1) | ((c[i] & 8)>>3); c[i] = ((c[i] & 1)<<2) | ((c[i] & 2)<<2) | ((c[i] & 4)>>1) | ((c[i] & 8)>>3);
i++; i++;
c[i] = ((c[i] & 32)>>2) | ((c[i] & 2)<<1) | ((c[i] & 4)>>1) | ((c[i] & 8)>>3); c[i] = ((c[i] &32)>>2) | ((c[i] & 2)<<1) | ((c[i] & 4)>>1) | ((c[i] & 8)>>3);
i++; i++;
c[i] = ((c[i] & 1)<<3) | ((c[i] & 2)<<1) | ((c[i] & 4)>>1) | ((c[i] & 8)>>3); c[i] = ((c[i] & 1)<<3) | ((c[i] & 2)<<1) | ((c[i] & 4)>>1) | ((c[i] & 8)>>3);
i++; i++;
c[i] = ((c[i] & 1)<<3) | ((c[i] & 2)<<1) | ((c[i] & 4)>>1) | ((c[i] & 16)>>4); c[i] = ((c[i] & 1)<<3) | ((c[i] & 2)<<1) | ((c[i] & 4)>>1) | ((c[i] &16)>>4);
i++; i++;
c[i] = ((c[i] & 1)<<3) | ((c[i] & 2)<<1) | ((c[i] & 4)>>2) | ((c[i] & 8)>>2); c[i] = ((c[i] & 1)<<3) | ((c[i] & 2)<<1) | ((c[i] & 4)>>2) | ((c[i] & 8)>>2);
} }
@ -61,7 +64,12 @@ void LoRaDemod::hamming6(char* c, int size)
void LoRaDemod::prng6(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" //explicit mode
"cOGGg7CM2=b5a?<`i;T2of5jDAB=2DoQ9ko?h_RLQR4@Z\\`9jY\\PX89lHX8h_R]c_^@OB<0`W08ik?Mg>dQZf3kn5Je5R=R4h[<Ph90HHh9j;h:mS^?f:lQ:GG;nU:b?WFU20Lf4@A?`hYJMnW\\QZ\\AMIZ<h:jQk[PP<`6[Z"
#if 0
// implicit mode (offset 2 symbols)
"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_WfUV2?V4@c=8h9B9njlQZDC@9Z<Q8\\iiX\\Rb6k:iY"
#endif
}; };
int i, maxchars; int i, maxchars;

View File

@ -77,25 +77,30 @@ void LoRaDemod::dumpRaw()
char text[256]; char text[256];
max = m_time / 4 - 3; max = m_time / 4 - 3;
if (max > 100) if (max > 140)
max = 100; // about 2 symbols to each char max = 140; // about 2 symbols to each char
for ( j=0; j < max; j++) { for ( j=0; j < max; j++) {
bin = (history[j * 4 + 12] + m_tune ) & (LORA_SFFT_LEN - 1); bin = (history[(j + 1) * 4] + m_tune ) & (LORA_SFFT_LEN - 1);
text[j] = toGray(bin >> 1); text[j] = toGray(bin >> 1);
} }
prng6(text, max); prng6(text, max);
interleave6(text, max); // First block is always 8 symbols
hamming6(text, max); interleave6(text, 6);
interleave6(&text[8], max);
hamming6(text, 6);
hamming6(&text[8], 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 + 1] << 4) | (0xf & text[j * 2 + 0]);
if ((text[j] < 32 )||( text[j] > 126)) if ((text[j] < 32 )||( text[j] > 126))
text[j] = 0x5f; text[j] = 0x5f;
} }
text[3] = text[2];
text[2] = text[1];
text[1] = text[0];
text[j] = 0; text[j] = 0;
printf("%s\n", text); printf("%s\n", &text[1]);
} }
short LoRaDemod::synch(short bin) short LoRaDemod::synch(short bin)