Fixing missing libs and minor changes, improving spectrum display info.

This commit is contained in:
DL2MF 2019-04-22 20:12:12 +02:00
parent a1dd2ebd2c
commit 86982f6a91
13 changed files with 152 additions and 62 deletions

View File

@ -106,7 +106,7 @@ void setupChannelList() {
const char *createQRGForm() {
char *ptr = message;
strcpy(ptr,"<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"></head><body><form action=\"qrg.html\" method=\"post\"><table><tr><th>ID</th><th>Active</th><th>Freq</th><th>Mode</th></tr>");
for(int i=0; i<10; i++) {
for(int i=0; i<sonde.config.maxsonde; i++) {
String s = sondeTypeSelect(i>=sonde.nSonde?2:sonde.sondeList[i].type);
sprintf(ptr+strlen(ptr), "<tr><td>%d</td><td><input name=\"A%d\" type=\"checkbox\" %s/></td>"
"<td><input name=\"F%d\" type=\"text\" value=\"%3.3f\"></td>"
@ -286,8 +286,12 @@ struct st_configitems {
int type; // 0: numeric; i>0 string of length i; -1: separator; -2: type selector
void *data;
};
#define N_CONFIG 16
#define N_CONFIG 20
struct st_configitems config_list[N_CONFIG] = {
{"ShowSpectrum (s)", 0, &sonde.config.spectrum},
{"Startfreq (MHz)", 0, &sonde.config.startfreq},
{"Bandwidth (kHz)", 0, &sonde.config.channelbw},
{"---", -1, NULL},
{"Call", 8, sonde.config.call},
{"Passcode", 8, sonde.config.passcode},
{"---", -1, NULL},
@ -491,7 +495,7 @@ void setup()
u8x8->drawString(1, 1, "RDZ_TTGO_SONDE");
u8x8->drawString(2, 3, " V0.1e");
u8x8->drawString(1, 5, "Mods by DL2MF");
delay(4000);
delay(3000);
sonde.clearDisplay();
@ -720,7 +724,6 @@ void WiFiEvent(WiFiEvent_t event){
}
}
static char* _scan[2]={"/","\\"};
void loopWifiScan() {
u8x8->setFont(u8x8_font_chroma48medium8_r);
@ -733,6 +736,7 @@ void loopWifiScan() {
int line=0;
int cnt=0;
int marker=0;
char buf[5];
WiFi.disconnect(true);
@ -807,18 +811,25 @@ void loopWifiScan() {
enterMode(ST_SPECTRUM);
for (int i = 0; i < sonde.config.spectrum; i++) {
//pinMode(i, OUTPUT);
//delay(500);
//digitalWrite(i, HIGH);
scanner.scan();
scanner.plotResult();
if (sonde.config.marker != 0) {
itoa((sonde.config.startfreq), buf, 10);
u8x8->drawString(0, 1, buf);
u8x8->drawString(7, 1, "MHz");
itoa((sonde.config.startfreq + 6), buf, 10);
u8x8->drawString(13, 1, buf);
}
if (sonde.config.timer != 0) {
itoa((sonde.config.spectrum - i), buf, 10);
u8x8->drawString(0, 1, buf);
u8x8->drawString(2, 1, "Sec.");
if (sonde.config.marker != 0) {
marker = 1;
}
u8x8->drawString(0, 1+marker, buf);
u8x8->drawString(2, 1+marker, "Sec.");
}
//digitalWrite(i, LOW);
}
delay(1000);
@ -843,7 +854,6 @@ void loopWifiScan() {
enterMode(ST_SCANNER);
}
void loop() {
Serial.println("Running main loop");
switch(mainState) {

View File

@ -1,4 +1,6 @@
# Input button
#-------------------------------#
# Hardware depending settings
#-------------------------------#
button_pin=0
# LED port
led_pin=25
@ -8,31 +10,41 @@ led_pin=25
oled_sda=21
oled_scl=22
oled_rst=16
noisefloor=-110
call=DL2623
passcode=14251
maxsonde=15
debug=1
#-------------------------------#
# General config settings
#-------------------------------#
maxsonde=20
debug=0
wifi=0
wifiap=1
#-------------------------------#
# Spectrum display settings
#-------------------------------#
startfreq=400
channelbw=10
spectrum=10
timer=1
noisefloor=-110
marker=1
#-------------------------------#
# APRS settings
#-------------------------------#
call=N0CALL
passcode=12345
#-------------------------------#
# axudp for sending to aprsmap
#-------------------------------#
# local use only, do not feed to public services
# data not sanities / quality checked, outliers not filtered out
axudp.active=1
# axudp.host=82.211.8.199
# axudp.port=40100
axudp.host=euro.aprs2.net
axudp.port=14589
axudp.host=192.168.42.20
axudp.port=9002
axudp.symbol=/O
axudp.highrate=1
axudp.idformat=0
#-------------------------------#
# maybe some time in the future
#-------------------------------#
# currently simply not implemented, no need to put anything here anyway
tcp.active=0
tcp.host=radiosondy.info
@ -40,3 +52,6 @@ tcp.port=14590
tcp.symbol=/O
tcp.highrate=20
tcp.idformat=0
#-------------------------------#
# EOF
#-------------------------------#

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>ESP32 Web Server</title>
<title>AutoRX Sonde Server</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="data:,">
<link rel="stylesheet" type="text/css" href="style.css">

View File

@ -1,6 +1,4 @@
RDZsonde
RDZsonde
DinoGast
Schokolade
AndroidDD
dl9rdzhr
AUTORX
12345678
SONDERX
radiosonde

View File

@ -1,17 +1,23 @@
# Frequency in Mhz (format nnn.nnn)
# Type (4=RS41, 6=DFM normal, DFM-06, 9=DFM inverted, DFM-09)
#
404.500 4 - Meppen
405.700 4 + Bergen
405.900 4 + Bergen
405.100 4 - Meppen
405.300 4 - Essen
402.300 4 - Greifswald
402.500 4 - Schleswig
402.700 4 + HH-Sasel
403.000 4 - DeBilt
404.100 4 + Norderney
404.300 4 - Schleswig_2
404.500 4 - Meppen
404.700 4 - Greifswald_2
405.100 4 - Lindenberg
405.700 4 + Bergen
405.900 4 + Bergen_2
405.100 4 + Meppen_2
405.300 4 - Essen
403.330 9 - TrUebPl
403.450 9 - TrUebPl
403.470 9 - TrUebPl
403.850 9 - TrUebPl
403.870 9 - TrUebPl
403.890 9 - TrUebPl
439.275 4 - DB0CEL
# end

View File

@ -228,12 +228,12 @@ int DFM::decodeDAT(uint8_t *dat)
break;
case 4:
{
float hei, vv;
hei = ((uint32_t)dat[0]<<24) + ((uint32_t)dat[1]<<16) + ((uint32_t)dat[2]<<8) + dat[3];
float lat, vv;
lat = ((uint32_t)dat[0]<<24) + ((uint32_t)dat[1]<<16) + ((uint32_t)dat[2]<<8) + dat[3];
vv = (int16_t)( (dat[4]<<8) | dat[5] );
Serial.print("GPS-height: "); Serial.print(hei*0.01);
Serial.print("GPS-height: "); Serial.print(lat*0.01);
Serial.print(", vv: "); Serial.print(vv*0.01);
sonde.si()->hei = hei*0.01;
sonde.si()->lat = lat*0.01;
sonde.si()->vs = vv*0.01;
sonde.si()->validPos |= 0x0C;
}

View File

@ -339,6 +339,7 @@ static void posrs41(const byte b[], uint32_t b_len, uint32_t p)
long0)+vz*(double)sin((float)lat);
dir = X2C_DIVL(atang2(vn, ve),1.7453292519943E-2);
if (dir<0.0) dir = 360.0+dir;
sonde.si()->dir = dir;
Serial.print(" ");
sonde.si()->hs = sqrt((float)(vn*vn+ve*ve))*3.6f;
Serial.print(sonde.si()->hs);
@ -350,16 +351,17 @@ static void posrs41(const byte b[], uint32_t b_len, uint32_t p)
Serial.print("m/s ");
Serial.print(getcard16(b, b_len, p+18UL)&255UL);
Serial.print("Sats");
sonde.si()->hei = heig;
sonde.si()->alt = heig;
sonde.si()->validPos = true;
} /* end posrs41() */
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];
int crcok = 0;
int32_t corr = reedsolomon41(data, 560, 131); // try short frame first
if(corr<0) {
@ -393,6 +395,7 @@ void RS41::decode41(byte *data, int maxlen)
if(!crcrs(data, 560, p, p+len)) {
Serial.println("###CRC ERROR###");
} else {
crcok = 1;
switch(typ) {
case 'y': // name
{
@ -420,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)
{
@ -472,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();

View File

@ -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

View File

@ -2,14 +2,21 @@
#include <SX1278FSK.h>
#include <U8x8lib.h>
#include "Sonde.h"
extern U8X8_SSD1306_128X64_NONAME_SW_I2C *u8x8;
#define CHANBW 10
#define PIXSAMPL (50/CHANBW)
#define SMOOTH 3
#define STARTF 401000000
//#define STARTF 401000000
#define NCHAN ((int)(6000/CHANBW))
double STARTF = (sonde.config.startfreq * 1000000);
//int CHANBW = (sonde.config.channelbw);
//int NCHAN = ((int)(6000/CHANBW));
//int PIXSAMPL = (50/CHANBW);
int scanresult[NCHAN];
int scandisp[NCHAN/PIXSAMPL];

View File

@ -59,8 +59,11 @@ Sonde::Sonde() {
config.debug=0;
config.wifi=1;
config.wifiap=1;
config.startfreq=400;
config.channelbw=10;
config.spectrum=10;
config.timer=0;
config.marker=0;
config.udpfeed.active = 1;
config.udpfeed.type = 0;
strcpy(config.udpfeed.host, "192.168.42.20");
@ -111,10 +114,16 @@ void Sonde::setConfig(const char *cfg) {
config.wifi = atoi(val);
} else if(strcmp(cfg,"wifiap")==0) {
config.wifiap = atoi(val);
} else if(strcmp(cfg,"startfreq")==0) {
config.startfreq = atoi(val);
} else if(strcmp(cfg,"channelbw")==0) {
config.channelbw = atoi(val);
} else if(strcmp(cfg,"spectrum")==0) {
config.spectrum = atoi(val);
} else if(strcmp(cfg,"timer")==0) {
config.timer = atoi(val);
} else if(strcmp(cfg,"marker")==0) {
config.marker = atoi(val);
} else if(strcmp(cfg,"axudp.active")==0) {
config.udpfeed.active = atoi(val)>0;
} else if(strcmp(cfg,"axudp.host")==0) {

View File

@ -21,8 +21,11 @@ typedef struct st_rdzconfig {
int debug; // show port and config options after reboot
int wifi; // connect to known WLAN 0=skip
int wifiap; // enable/disable WiFi AccessPoint mode 0=disable
int startfreq; // spectrum display start freq (400, 401, ...)
int channelbw; // spectrum channel bandwidth (valid: 5, 10, 20, 25, 50, 100 kHz)
int spectrum; // show freq spectrum for n seconds 0=disable
int timer; // show remaining time in spectrum 0=disable
int marker; // show freq marker in spectrum 0=disable
int maxsonde; // number of max sonde in scan (range=1-99)
int noisefloor; // for spectrum display
char call[9]; // APRS callsign

View File

@ -211,10 +211,47 @@ extern int aprsstr_mon2raw(const char *mon, char raw[], int raw_len)
#define FEET (1.0/0.3048)
#define KNOTS (1.851984)
#define X2C_max_longcard 0xFFFFFFFFUL
static uint32_t X2C_TRUNCC(double x, uint32_t min0, uint32_t max0)
{
uint32_t i;
if (x < (double)min0)
i = (uint32_t)min0;
if (x > (double)max0)
i = (uint32_t)max0;
i = (uint32_t)x;
if ((double)i > x)
--i;
return i;
}
static uint32_t truncc(double r)
{
if (r<=0.0) return 0UL;
else if (r>=2.E+9) return 2000000000UL;
else return (uint32_t)X2C_TRUNCC(r,0UL,X2C_max_longcard);
return 0;
} /* end truncc() */
static uint32_t dao91(double x)
/* radix91(xx/1.1) of dddmm.mmxx */
{
double a;
a = fabs(x);
return ((truncc((a-(double)(float)truncc(a))*6.E+5)%100UL)
*20UL+11UL)/22UL;
} /* end dao91() */
char b[201];
char raw[201];
char * aprs_senddata(float lat, float lon, float hei, float speed, float dir, float climb, const char *type, const char *objname, const char *usercall, const char *sym)
char * aprs_senddata(float lat, float lon, float alt, float speed, float dir, float climb, const char *type, const char *objname, const char *usercall, const char *sym)
{
*b=0;
aprsstr_append(b, usercall);
@ -244,11 +281,11 @@ char * aprs_senddata(float lat, float lon, float hei, float speed, float dir, fl
snprintf(b+i, APRS_MAXLEN-i, "%03d/%03d", realcard(dir+1.5), realcard(speed*1.0/KNOTS+0.5));
}
#endif
if(hei>0.5) {
if(alt>0.5) {
i=strlen(b);
snprintf(b+i, APRS_MAXLEN-i, "/A=%06d", realcard(hei*FEET+0.5));
snprintf(b+i, APRS_MAXLEN-i, "/A=%06d", realcard(alt*FEET+0.5));
}
#if 0
#if 1
int dao=1;
if(dao) {
i=strlen(b);

View File

@ -9,6 +9,7 @@ typedef struct st_feedinfo {
int type; // 0:UDP(axudp), 1:TCP(aprs.fi)
char host[64];
int port;
char symbol[3];
int lowrate;
int highrate;
int lowlimit;
@ -19,7 +20,7 @@ typedef struct st_feedinfo {
#define APRS_MAXLEN 201
void aprs_gencrctab(void);
int aprsstr_mon2raw(const char *mon, char raw[], int raw_len);
char * aprs_senddata(float lat, float lon, float hei, float speed, float dir, float climb, const char *type, const char *objname, const char *usercall, const char *sym);
char * aprs_senddata(float lat, float lon, float alt, float speed, float dir, float climb, const char *type, const char *objname, const char *usercall, const char *sym);
#endif