kopia lustrzana https://github.com/dl9rdz/rdz_ttgo_sonde
rs92 eph: configurable ftp site
rodzic
a408ae5461
commit
8e6d953e60
|
@ -498,6 +498,7 @@ struct st_configitems config_list[] = {
|
||||||
{"dfm.rxbw", "DFM RX bandwidth", 0, &sonde.config.dfm.rxbw},
|
{"dfm.rxbw", "DFM RX bandwidth", 0, &sonde.config.dfm.rxbw},
|
||||||
{"m10m20.agcbw", "M10/M20 AGC bandwidth", 0, &sonde.config.m10m20.agcbw},
|
{"m10m20.agcbw", "M10/M20 AGC bandwidth", 0, &sonde.config.m10m20.agcbw},
|
||||||
{"m10m20.rxbw", "M10/M20 RX bandwidth", 0, &sonde.config.m10m20.rxbw},
|
{"m10m20.rxbw", "M10/M20 RX bandwidth", 0, &sonde.config.m10m20.rxbw},
|
||||||
|
{"ephftp", "FTP for eph (RS92)", 39, &sonde.config.ephftp},
|
||||||
{"", "Data feed configuration", -5, NULL},
|
{"", "Data feed configuration", -5, NULL},
|
||||||
/* APRS settings */
|
/* APRS settings */
|
||||||
{"call", "Call", 8, sonde.config.call},
|
{"call", "Call", 8, sonde.config.call},
|
||||||
|
@ -1140,7 +1141,7 @@ void unkHandler(T nmea) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEBUG_GPS 1
|
#define DEBUG_GPS 0
|
||||||
static bool gpsCourseOld;
|
static bool gpsCourseOld;
|
||||||
static int lastCourse;
|
static int lastCourse;
|
||||||
void gpsTask(void *parameter) {
|
void gpsTask(void *parameter) {
|
||||||
|
|
|
@ -78,6 +78,14 @@ rs92.alt2d=480
|
||||||
dfm.agcbw=20800
|
dfm.agcbw=20800
|
||||||
dfm.rxbw=10400
|
dfm.rxbw=10400
|
||||||
#-------------------------------#
|
#-------------------------------#
|
||||||
|
# ftp server for RINEX data (for RS92)
|
||||||
|
# YYYY/DDD/brdcDDD0.YYn.gz is appended
|
||||||
|
# s1: igs.bkg.bund.de/IGS/BRDC/
|
||||||
|
# s2: www.ngs.noaa.gov/cors/rinex/
|
||||||
|
#-------------------------------#
|
||||||
|
ephftp=www.ngs.noaa.gov/cors/rinex/
|
||||||
|
#ephftp=igs.bkg.bund.de/IGS/BRDC/
|
||||||
|
#-------------------------------#
|
||||||
# axudp for sending to aprsmap
|
# axudp for sending to aprsmap
|
||||||
#-------------------------------#
|
#-------------------------------#
|
||||||
# local use only, do not feed to public services
|
# local use only, do not feed to public services
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const char *version_name = "rdzTTGOsonde";
|
const char *version_name = "rdzTTGOsonde";
|
||||||
const char *version_id = "devel20210126";
|
const char *version_id = "devel20210205";
|
||||||
const int SPIFFS_MAJOR=2;
|
const int SPIFFS_MAJOR=2;
|
||||||
const int SPIFFS_MINOR=8;
|
const int SPIFFS_MINOR=9;
|
||||||
|
|
|
@ -204,6 +204,7 @@ void Sonde::defaultConfig() {
|
||||||
config.tcpfeed.highrate = 10;
|
config.tcpfeed.highrate = 10;
|
||||||
config.tcpfeed.idformat = ID_DFMDXL;
|
config.tcpfeed.idformat = ID_DFMDXL;
|
||||||
config.kisstnc.active = 0;
|
config.kisstnc.active = 0;
|
||||||
|
strcpy(config.ephftp,"igs.bkg.bund.de/IGS/BRDC/");
|
||||||
|
|
||||||
config.mqtt.active = 0;
|
config.mqtt.active = 0;
|
||||||
strcpy(config.mqtt.id, "rdz_sonde_server");
|
strcpy(config.mqtt.id, "rdz_sonde_server");
|
||||||
|
@ -312,6 +313,8 @@ void Sonde::setConfig(const char *cfg) {
|
||||||
config.dfm.rxbw = atoi(val);
|
config.dfm.rxbw = atoi(val);
|
||||||
} else if(strcmp(cfg,"rs92.alt2d")==0) {
|
} else if(strcmp(cfg,"rs92.alt2d")==0) {
|
||||||
config.rs92.alt2d= atoi(val);
|
config.rs92.alt2d= atoi(val);
|
||||||
|
} else if(strcmp(cfg,"ephftp")==0) {
|
||||||
|
strncpy(config.ephftp, val, 40);
|
||||||
} else if(strcmp(cfg,"kisstnc.active")==0) {
|
} else if(strcmp(cfg,"kisstnc.active")==0) {
|
||||||
config.kisstnc.active = atoi(val);
|
config.kisstnc.active = atoi(val);
|
||||||
} else if(strcmp(cfg,"kisstnc.idformat")==0) {
|
} else if(strcmp(cfg,"kisstnc.idformat")==0) {
|
||||||
|
|
|
@ -209,6 +209,7 @@ typedef struct st_rdzconfig {
|
||||||
struct st_rs92config rs92;
|
struct st_rs92config rs92;
|
||||||
struct st_dfmconfig dfm;
|
struct st_dfmconfig dfm;
|
||||||
struct st_m10m20config m10m20;
|
struct st_m10m20config m10m20;
|
||||||
|
char ephftp[40];
|
||||||
// data feed configuration
|
// data feed configuration
|
||||||
// for now, one feed for each type is enough, but might get extended to more?
|
// for now, one feed for each type is enough, but might get extended to more?
|
||||||
char call[10]; // APRS callsign
|
char call[10]; // APRS callsign
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
|
#include "Sonde.h"
|
||||||
|
|
||||||
extern WiFiClient client;
|
extern WiFiClient client;
|
||||||
|
|
||||||
static const char *ftpserver = "www.ngs.noaa.gov";
|
//static const char *ftpserver = "www.ngs.noaa.gov";
|
||||||
char outbuf[128];
|
char outbuf[128];
|
||||||
|
|
||||||
uint8_t getreply() {
|
uint8_t getreply() {
|
||||||
|
@ -72,31 +72,32 @@ void geteph() {
|
||||||
Serial.printf("now: %s, existing: %s => updating\n", nowstr, tsstr);
|
Serial.printf("now: %s, existing: %s => updating\n", nowstr, tsstr);
|
||||||
}
|
}
|
||||||
status.close();
|
status.close();
|
||||||
disp.rdis->clear();
|
|
||||||
disp.rdis->setFont(FONT_SMALL);
|
|
||||||
disp.rdis->drawString(0, 0, "FTP ngs.noaa.gov");
|
|
||||||
// fetch rinex from server
|
|
||||||
File fh = SPIFFS.open("/brdc.gz","w");
|
File fh = SPIFFS.open("/brdc.gz","w");
|
||||||
if(!fh) {
|
if(!fh) {
|
||||||
Serial.println("cannot open file\n");
|
Serial.println("cannot open file\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char buf[252];
|
char host[252];
|
||||||
snprintf(buf, 128, "/cors/rinex/%04d/%03d/brdc%03d0.%02dn.gz", year, day, day, year-2000);
|
strcpy(host, sonde.config.ephftp);
|
||||||
|
char *buf = strchr(host, '/');
|
||||||
|
if(!buf) { Serial.println("Invalid FTP host config"); return; }
|
||||||
|
*buf = 0;
|
||||||
|
buf++;
|
||||||
|
uint8_t dispw, disph, dispxs, dispys;
|
||||||
|
disp.rdis->getDispSize(&disph, &dispw, &dispxs, &dispys);
|
||||||
|
disp.rdis->clear();
|
||||||
|
disp.rdis->setFont(FONT_SMALL);
|
||||||
|
disp.rdis->drawString(0, 0, host);
|
||||||
|
// fetch rinex from server
|
||||||
|
char *ptr = buf + strlen(buf);
|
||||||
|
snprintf(ptr, 128, "%04d/%03d/brdc%03d0.%02dn.gz", year, day, day, year-2000);
|
||||||
Serial.println("running geteph\n");
|
Serial.println("running geteph\n");
|
||||||
disp.rdis->drawString(0, 1, buf+21);
|
disp.rdis->drawString(0, 1*dispys, ptr+9);
|
||||||
|
|
||||||
if(!client.connect(ftpserver, 21)) {
|
if(!client.connect(host, 21)) {
|
||||||
Serial.println("FTP connection to www.ngs.noaa.gov failed");
|
Serial.printf("FTP connection to %s failed\n", host);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
while(!client.available()) delay(1);
|
|
||||||
while(client.available()) {
|
|
||||||
String s = client.readStringUntil('\n');
|
|
||||||
Serial.println(s);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if(getreply()>='4') { Serial.println("connected failed"); return; }
|
if(getreply()>='4') { Serial.println("connected failed"); return; }
|
||||||
client.print("USER anonymous\r\n");
|
client.print("USER anonymous\r\n");
|
||||||
if(getreply()>='4') { Serial.println("USER failed"); return; }
|
if(getreply()>='4') { Serial.println("USER failed"); return; }
|
||||||
|
@ -121,8 +122,8 @@ void geteph() {
|
||||||
}
|
}
|
||||||
uint16_t port = (array_pasv[4]<<8) | (array_pasv[5]&0xff);
|
uint16_t port = (array_pasv[4]<<8) | (array_pasv[5]&0xff);
|
||||||
WiFiClient dclient;
|
WiFiClient dclient;
|
||||||
Serial.printf("connecting to %s:%d\n", ftpserver,port);
|
Serial.printf("connecting to %s:%d\n", host, port);
|
||||||
dclient.connect(ftpserver, port);
|
dclient.connect(host, port);
|
||||||
if(!dclient) {
|
if(!dclient) {
|
||||||
Serial.println("data connection failed");
|
Serial.println("data connection failed");
|
||||||
return;
|
return;
|
||||||
|
@ -149,9 +150,9 @@ void geteph() {
|
||||||
fh.close();
|
fh.close();
|
||||||
snprintf(buf, 16, "Fetched %d B ",len);
|
snprintf(buf, 16, "Fetched %d B ",len);
|
||||||
buf[16]=0;
|
buf[16]=0;
|
||||||
disp.rdis->drawString(0,2,buf);
|
disp.rdis->drawString(0,2*dispys,buf);
|
||||||
|
|
||||||
disp.rdis->drawString(0,4,"Decompressing...");
|
disp.rdis->drawString(0,4*dispys,"Decompressing...");
|
||||||
// decompression
|
// decompression
|
||||||
tinfl_decompressor *decomp = (tinfl_decompressor *)malloc(sizeof(tinfl_decompressor));
|
tinfl_decompressor *decomp = (tinfl_decompressor *)malloc(sizeof(tinfl_decompressor));
|
||||||
tinfl_init(decomp);
|
tinfl_init(decomp);
|
||||||
|
@ -219,7 +220,7 @@ void geteph() {
|
||||||
status.close();
|
status.close();
|
||||||
snprintf(buf, 16, "Done: %d B ",total);
|
snprintf(buf, 16, "Done: %d B ",total);
|
||||||
buf[16]=0;
|
buf[16]=0;
|
||||||
disp.rdis->drawString(0,5,buf);
|
disp.rdis->drawString(0,5*dispys,buf);
|
||||||
delay(1000);
|
delay(1000);
|
||||||
|
|
||||||
free(obuf);
|
free(obuf);
|
||||||
|
|
Ładowanie…
Reference in New Issue