From 88d75b55c360653af3b27a4ca7af02710f09117e Mon Sep 17 00:00:00 2001 From: "Hans P. Reiser" Date: Mon, 15 Apr 2019 20:59:30 +0200 Subject: [PATCH] working version with config page (readonly) --- RX_FSK/RX_FSK.ino | 23 ++++++++++++++--------- RX_FSK/data/index.html | 6 ++++++ libraries/SondeLib/Sonde.cpp | 17 +++++++++++++++++ libraries/SondeLib/Sonde.h | 2 ++ 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/RX_FSK/RX_FSK.ino b/RX_FSK/RX_FSK.ino index 4ae1882..2ba2fc0 100644 --- a/RX_FSK/RX_FSK.ino +++ b/RX_FSK/RX_FSK.ino @@ -26,8 +26,11 @@ int e; AsyncWebServer server(80); -const char * udpAddress = "192.168.42.20"; -const int udpPort = 9002; +#define LOCALUDPPORT 9002 + +// moved to sonde.config +//const char * udpAddress = "192.168.42.20"; +//const int udpPort = 9002; boolean connected = false; WiFiUDP udp; @@ -278,13 +281,13 @@ struct st_configitems config_list[N_CONFIG] = { {"Call", 8, sonde.config.call}, {"Passcode", 8, sonde.config.passcode}, {"---", -1, NULL}, - {"AXUDP active", -3, sonde.config.udpfeed.active}, + {"AXUDP active", -3, &sonde.config.udpfeed.active}, {"AXUDP Host", 63, sonde.config.udpfeed.host}, {"AXUDP Port", 0, &sonde.config.udpfeed.port}, {"DFM ID Format", -2, &sonde.config.udpfeed.idformat}, {"Rate limit", 0, &sonde.config.udpfeed.highrate}, {"---", -1, NULL}, - {"APRS TCP active", -3, sonde.config.tcpfeed.active}, + {"APRS TCP active", -3, &sonde.config.tcpfeed.active}, {"ARPS TCP Host", 63, sonde.config.tcpfeed.host}, {"APRS TCP Port", 0, &sonde.config.tcpfeed.port}, {"DFM ID Format", -2, &sonde.config.tcpfeed.idformat}, @@ -314,7 +317,7 @@ void addConfigSeparatorEntry(char *ptr) { const char *createConfigForm() { char *ptr = message; char tmp[4]; - strcpy(ptr,"
"); + strcpy(ptr,"
NrSSIDPassword
"); for(int i=0; i"); + strcat(ptr,"
OptionValue
"); return message; } @@ -551,7 +554,7 @@ void loopDecoder() { const char *str = aprs_senddata(s->lat, s->lon, s->hei, s->hs, s->dir, s->vs, sondeTypeStr[s->type], s->id, "TE0ST", "EO"); int rawlen = aprsstr_mon2raw(str, raw, APRS_MAXLEN); Serial.print("Sending: "); Serial.println(raw); - udp.beginPacket(udpAddress,udpPort); + udp.beginPacket(sonde.config.udpfeed.host,sonde.config.udpfeed.port); udp.write((const uint8_t *)raw,rawlen); udp.endPacket(); } @@ -632,7 +635,7 @@ void WiFiEvent(WiFiEvent_t event){ Serial.println(WiFi.localIP()); //initializes the UDP state //This initializes the transfer buffer - udp.begin(WiFi.localIP(),udpPort); + udp.begin(WiFi.localIP(),LOCALUDPPORT); connected = true; break; case SYSTEM_EVENT_STA_DISCONNECTED: @@ -684,12 +687,14 @@ void loopWifiScan() { Serial.print("."); u8x8.drawString(15,7,_scan[cnt&1]); cnt++; + #if 0 if(cnt==4) { WiFi.disconnect(true); // retry, for my buggy FritzBox WiFi.onEvent(WiFiEvent); WiFi.begin(id, pw); } - if(cnt==10) { + #endif + if(cnt==15) { WiFi.disconnect(true); delay(1000); WiFi.softAP(networks[0].id.c_str(),networks[0].pw.c_str()); diff --git a/RX_FSK/data/index.html b/RX_FSK/data/index.html index 7e78cf1..35a3775 100644 --- a/RX_FSK/data/index.html +++ b/RX_FSK/data/index.html @@ -18,6 +18,7 @@ + @@ -36,6 +37,11 @@ +
+

Config

+ +
+

About

RDZSonde diff --git a/libraries/SondeLib/Sonde.cpp b/libraries/SondeLib/Sonde.cpp index efdd2f1..5676438 100644 --- a/libraries/SondeLib/Sonde.cpp +++ b/libraries/SondeLib/Sonde.cpp @@ -47,6 +47,23 @@ static uint8_t empty_tile1[8]={0x00, 0xF0, 0x88, 0x48, 0x28, 0xF0, 0x00, 0x00}; 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.noisefloor = -130; + strcpy(config.call,"NOCALL"); + strcpy(config.passcode, "---"); + config.udpfeed.active = 1; + config.udpfeed.type = 0; + strcpy(config.udpfeed.host, "192.168.42.20"); + config.udpfeed.port = 9002; + config.udpfeed.highrate = 1; + config.udpfeed.idformat = ID_DFMGRAW; + config.tcpfeed.active = 0; + config.tcpfeed.type = 1; + strcpy(config.tcpfeed.host, "radiosondy.info"); + config.tcpfeed.port = 12345; + config.tcpfeed.highrate = 10; + config.tcpfeed.idformat = ID_DFMDXL; +} void Sonde::setIP(const char *ip, bool AP) { memset(myIP_tiles, 0, 11*8); diff --git a/libraries/SondeLib/Sonde.h b/libraries/SondeLib/Sonde.h index 105177d..ee21f07 100644 --- a/libraries/SondeLib/Sonde.h +++ b/libraries/SondeLib/Sonde.h @@ -55,6 +55,8 @@ public: int nSonde; SondeInfo sondeList[MAXSONDE+1]; + Sonde(); + void clearSonde(); void addSonde(float frequency, SondeType type, int active); void nextConfig();