configurable oled pins, minor spectrum enhancement
This commit is contained in:
parent
500679bdc5
commit
1ffe73708f
|
|
@ -357,10 +357,11 @@ static void posrs41(const byte b[], uint32_t b_len, uint32_t p)
|
|||
|
||||
|
||||
|
||||
|
||||
void RS41::decode41(byte *data, int maxlen)
|
||||
// returns: 0: ok, -1: rs or crc error
|
||||
int RS41::decode41(byte *data, int maxlen)
|
||||
{
|
||||
char buf[128];
|
||||
char buf[128];
|
||||
int crcok = 0;
|
||||
|
||||
int32_t corr = reedsolomon41(data, 560, 131); // try short frame first
|
||||
if(corr<0) {
|
||||
|
|
@ -393,7 +394,8 @@ void RS41::decode41(byte *data, int maxlen)
|
|||
// check CRC
|
||||
if(!crcrs(data, 560, p, p+len)) {
|
||||
Serial.println("###CRC ERROR###");
|
||||
} else {
|
||||
} else {
|
||||
crcok = 1;
|
||||
switch(typ) {
|
||||
case 'y': // name
|
||||
{
|
||||
|
|
@ -421,6 +423,7 @@ void RS41::decode41(byte *data, int maxlen)
|
|||
p += len;
|
||||
Serial.println();
|
||||
}
|
||||
return crcok ? 0 : -1;
|
||||
}
|
||||
void RS41::printRaw(uint8_t *data, int len)
|
||||
{
|
||||
|
|
@ -473,8 +476,8 @@ int RS41::receiveFrame() {
|
|||
//printRaw(data, MAXLEN);
|
||||
for(int i=0; i<RS41MAXLEN; i++) { data[i] = data[i] ^ scramble[i&0x3F]; }
|
||||
//printRaw(data, MAXLEN);
|
||||
decode41(data, RS41MAXLEN);
|
||||
return RX_OK;
|
||||
int res = decode41(data, RS41MAXLEN);
|
||||
return res==0 ? RX_OK : RX_ERROR;
|
||||
}
|
||||
|
||||
RS41 rs41 = RS41();
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ private:
|
|||
uint32_t bits2val(const uint8_t *bits, int len);
|
||||
void printRaw(uint8_t *data, int len);
|
||||
int bitsToBytes(uint8_t *bits, uint8_t *bytes, int len);
|
||||
void decode41(byte *data, int maxlen);
|
||||
int decode41(byte *data, int maxlen);
|
||||
|
||||
#define B 8
|
||||
#define S 4
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ extern U8X8_SSD1306_128X64_NONAME_SW_I2C *u8x8;
|
|||
|
||||
#define CHANBW 10
|
||||
#define PIXSAMPL (50/CHANBW)
|
||||
#define SMOOTH 4
|
||||
#define SMOOTH 3
|
||||
#define STARTF 400000000
|
||||
#define NCHAN ((int)(6000/CHANBW))
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ int scandisp[NCHAN/PIXSAMPL];
|
|||
#define PLOT_N 120
|
||||
#define TICK1 (120/6)
|
||||
#define TICK2 (TICK1/4)
|
||||
#define PLOT_MIN -220
|
||||
#define PLOT_MIN -250
|
||||
#define PLOT_SCALE(x) (x<PLOT_MIN?0:(x-PLOT_MIN)/2)
|
||||
|
||||
const byte tilepatterns[9]={0,0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0xFE,0xFF};
|
||||
|
|
@ -82,7 +82,7 @@ void Scanner::scan()
|
|||
lastfrf = frf;
|
||||
// Wait TS_HOP (20us) + TS_RSSI ( 2^(SMOOTH+1) / 4 / CHANBW us)
|
||||
int wait = 20 + 1000*(1<<(SMOOTH+1))/4/CHANBW;
|
||||
delayMicroseconds(wait);
|
||||
delayMicroseconds(wait+5);
|
||||
int rssi = -(int)sx1278.readRegister(REG_RSSI_VALUE_FSK);
|
||||
if(iter==0) { scanresult[i] = rssi; } else {
|
||||
if(rssi>scanresult[i]) scanresult[i]=rssi;
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ static unsigned char ms_tiles[] U8X8_PROGMEM = {
|
|||
0x1F, 0x02, 0x04, 0x02, 0x1F, 0x40, 0x20, 0x10, 0x08, 0x04, 0x12, 0xA4, 0xA4, 0xA4, 0x40, 0x00
|
||||
};
|
||||
static unsigned char stattiles[4][4] = {
|
||||
0x00, 0x00, 0x00, 0x00 ,
|
||||
0x00, 0x10, 0x10, 0x00 ,
|
||||
0x1F, 0x15, 0x15, 0x00 ,
|
||||
0x00, 0x1F, 0x00, 0x00 };
|
||||
0x00, 0x1F, 0x00, 0x00 , // | == ok
|
||||
0x00, 0x10, 0x10, 0x00 , // . == no header found
|
||||
0x1F, 0x15, 0x15, 0x00 , // E == decode error
|
||||
0x00, 0x00, 0x00, 0x00 }; // ' ' == unknown/unassigned
|
||||
|
||||
byte myIP_tiles[8*11];
|
||||
|
||||
|
|
@ -48,6 +48,11 @@ static uint8_t empty_tile2[8]={0x00, 0x11, 0x02, 0x02, 0x02, 0x01, 0x00, 0x00};
|
|||
static uint8_t ap_tile[8]={0x00,0x04,0x22,0x92, 0x92, 0x22, 0x04, 0x00};
|
||||
|
||||
Sonde::Sonde() {
|
||||
config.button_pin = 0;
|
||||
config.oled_sda = 4;
|
||||
config.oled_scl = 15;
|
||||
config.oled_rst = 16;
|
||||
|
||||
config.noisefloor = -130;
|
||||
strcpy(config.call,"NOCALL");
|
||||
strcpy(config.passcode, "---");
|
||||
|
|
@ -83,6 +88,8 @@ void Sonde::setConfig(const char *cfg) {
|
|||
strncpy(config.call, val, 9);
|
||||
} else if(strcmp(cfg,"passcode")==0) {
|
||||
strncpy(config.passcode, val, 9);
|
||||
} else if(strcmp(cfg,"button_pin")==0) {
|
||||
config.button_pin = atoi(val);
|
||||
} else if(strcmp(cfg,"oled_sda")==0) {
|
||||
config.oled_sda = atoi(val);
|
||||
} else if(strcmp(cfg,"oled_scl")==0) {
|
||||
|
|
@ -147,7 +154,7 @@ void Sonde::addSonde(float frequency, SondeType type, int active) {
|
|||
sondeList[nSonde].type = type;
|
||||
sondeList[nSonde].freq = frequency;
|
||||
sondeList[nSonde].active = active;
|
||||
memcpy(sondeList[nSonde].rxStat, "\x00\x01\x2\x3\x2\x1\x1\x2\x0\x3\x0\x0\x1\x2\x3\x1\x0", 18);
|
||||
memcpy(sondeList[nSonde].rxStat, "\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3", 18); // unknown/undefined
|
||||
nSonde++;
|
||||
}
|
||||
void Sonde::nextConfig() {
|
||||
|
|
@ -196,8 +203,8 @@ int Sonde::receiveFrame() {
|
|||
ret = dfm.receiveFrame();
|
||||
}
|
||||
memmove(sonde.si()->rxStat+1, sonde.si()->rxStat, 17);
|
||||
sonde.si()->rxStat[0] = ret==0 ? 3 : 1; // OK or Timeout; TODO: add error (2)
|
||||
return ret; // 0: OK, 1: Timeuot, 2: Other error (TODO)
|
||||
sonde.si()->rxStat[0] = ret;
|
||||
return ret; // 0: OK, 1: Timeuot, 2: Other error, 3: unknown
|
||||
}
|
||||
|
||||
void Sonde::updateDisplayPos() {
|
||||
|
|
|
|||
|
|
@ -7,12 +7,13 @@
|
|||
// RX_TIMEOUT: no header detected
|
||||
// RX_ERROR: header detected, but data not decoded (crc error, etc.)
|
||||
// RX_OK: header and data ok
|
||||
enum RxResult { RX_OK, RX_TIMEOUT, RX_ERROR };
|
||||
enum RxResult { RX_OK, RX_TIMEOUT, RX_ERROR, RX_UNKNOWN };
|
||||
|
||||
enum SondeType { STYPE_DFM06, STYPE_DFM09, STYPE_RS41 };
|
||||
extern const char *sondeTypeStr[5];
|
||||
|
||||
typedef struct st_rdzconfig {
|
||||
int button_pin;
|
||||
int oled_sda;
|
||||
int oled_scl;
|
||||
int oled_rst;
|
||||
|
|
|
|||
Loading…
Reference in New Issue