Added launchsite info to scan and webinterface

This commit is contained in:
DL2MF 2019-05-03 11:38:21 +02:00
parent 71cc86cff0
commit c0fc4980c2
7 changed files with 785 additions and 410 deletions

File diff suppressed because it is too large Load Diff

View File

@ -7,16 +7,17 @@ led_pout=9
# OLED Setup is depending on hardware of LoRa board
# TTGO v1: SDA=4 SCL=15, RST=16
# TTGO v2: SDA=21 SCL=22, RST=16
oled_sda=21
oled_scl=22
# No specification in config file: try autodetection (gpio4 pin level at startup)
#oled_sda=21
#oled_scl=22
oled_rst=16
#-------------------------------#
# General config settings
#-------------------------------#
maxsonde=20
debug=0
wifi=1
wifiap=1
debug=1
# wifi mode: 1=client in background; 2=AP in background; 3=client on startup, ap if failure
wifi=3
#-------------------------------#
# Spectrum display settings
#-------------------------------#

View File

@ -1,4 +1,4 @@
AUTORX
SONDERX
12345678
WXSONDE
radiosonde
12345678

2
RX_FSK/version.h Normal file
View File

@ -0,0 +1,2 @@
const char *version_name = "RDZ_TTGO_SONDE";
const char *version_id = "master v0.6b";

View File

@ -23,7 +23,8 @@ int scandisp[NCHAN/PIXSAMPL];
#define PLOT_N 128
#define TICK1 (128/6)
#define TICK2 (TICK1/4)
#define PLOT_MIN -250
//#define PLOT_MIN -250
#define PLOT_MIN (sonde.config.noisefloor*2)
#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};
@ -51,6 +52,10 @@ void Scanner::plotResult()
if( ((i+j)%TICK2)==0) { row[j] |= 0x01; }
}
for(int y=0; y<8; y++) {
if(sonde.config.marker && y==1) {
// don't overwrite MHz marker text
if(i<3*8 || (i>=7*8&&i<10*8) || i>=13*8) continue;
}
u8x8->drawTile(i/8, y, 1, row+8*y);
}
}

View File

@ -48,12 +48,21 @@ 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 = 1;
config.button_pin = 0;
config.led_pout = 9;
//config.oled_sda = 0;
//config.oled_scl = 0;
//config.oled_rst = 0;
config.noisefloor = -130;
// Try autodetecting board type
// Seems like on startup, GPIO4 is 1 on v1 boards, 0 on v2.1 boards?
int autodetect = gpio_get_level((gpio_num_t)4);
if(autodetect==1) {
config.oled_sda = 4;
config.oled_scl = 15;
} else {
config.oled_sda = 21;
config.oled_scl = 22;
}
//
config.oled_rst = 16;
config.noisefloor = -125;
strcpy(config.call,"NOCALL");
strcpy(config.passcode, "---");
config.maxsonde=15;
@ -109,6 +118,7 @@ void Sonde::setConfig(const char *cfg) {
config.oled_rst = atoi(val);
} else if(strcmp(cfg,"maxsonde")==0) {
config.maxsonde = atoi(val);
if(config.maxsonde>MAXSONDE) config.maxsonde=MAXSONDE;
} else if(strcmp(cfg,"debug")==0) {
config.debug = atoi(val);
} else if(strcmp(cfg,"wifi")==0) {
@ -154,6 +164,10 @@ void Sonde::setConfig(const char *cfg) {
}
}
void Sonde::clearIP() {
memset(myIP_tiles, 0, 11*8);
}
void Sonde::setIP(const char *ip, bool AP) {
memset(myIP_tiles, 0, 11*8);
int len = strlen(ip);
@ -183,13 +197,13 @@ void Sonde::addSonde(float frequency, SondeType type, int active, char *launchsi
sondeList[nSonde].type = type;
sondeList[nSonde].freq = frequency;
sondeList[nSonde].active = active;
sondeList[nSonde].launchsite = launchsite;
strncpy(sondeList[nSonde].launchsite, launchsite, 17);
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() {
currentSonde++;
// Skip non-active entries (but don't loop forever if there are no active ones
// Skip non-active entries (but don't loop forever if there are no active ones)
for(int i=0; i<config.maxsonde; i++) {
if(!sondeList[currentSonde].active) {
currentSonde++;
@ -221,9 +235,6 @@ void Sonde::setup() {
dfm.setFrequency(sondeList[currentSonde].freq * 1000000);
break;
}
// Update display
//updateDisplayRXConfig();
//updateDisplay();
}
int Sonde::receiveFrame() {
int ret;
@ -305,11 +316,9 @@ void Sonde::updateDisplayRXConfig() {
u8x8->setFont(u8x8_font_chroma48medium8_r);
u8x8->drawString(0,0, sondeTypeStr[si()->type]);
snprintf(buf, 16, "%3.3f MHz", si()->freq);
u8x8->drawString(5,0, buf);
//snprintf(buf, 8, "%s", si()->launchsite);
//u8x8->drawString(0,5, buf);
u8x8->drawTile(14,3,2,kmh_tiles);
u8x8->drawString(7,0, buf);
//snprintf(buf, 6, "%s", si()->launchsite);
//u8x8->drawString(9,1, buf);
}
void Sonde::updateDisplayIP() {
@ -325,9 +334,8 @@ void Sonde::updateDisplayScanner() {
u8x8->drawString(8, 0, sondeTypeStr[si()->type]);
snprintf(buf, 16, "%3.3f MHz", si()->freq);
u8x8->drawString(0,3, buf);
//snprintf(buf, 8, "%s", si()->launchsite);
//u8x8->drawString(0,5, buf);
snprintf(buf, 16, "%s", si()->launchsite);
u8x8->drawString(0,5, buf);
updateDisplayIP();
}

View File

@ -43,7 +43,7 @@ typedef struct st_sondeinfo {
// decoded ID
char id[10];
bool validID;
char *launchsite;
char launchsite[18];
// decoded position
float lat; // latitude
float lon; // longitude
@ -92,6 +92,7 @@ public:
void updateDisplayScanner();
void clearDisplay();
void setIP(const char *ip, bool isAP);
void clearIP();
};
extern Sonde sonde;