kopia lustrzana https://github.com/dl9rdz/rdz_ttgo_sonde
avoid rs92 decode stack overflow, remove unused code
rodzic
56df804a6a
commit
73244615a8
|
@ -159,6 +159,9 @@ String processor(const String& var) {
|
||||||
snprintf(tmpstr, 128, "Fingerprint %d (%s)", sonde.fingerprint, fpstr);
|
snprintf(tmpstr, 128, "Fingerprint %d (%s)", sonde.fingerprint, fpstr);
|
||||||
return String(tmpstr);
|
return String(tmpstr);
|
||||||
}
|
}
|
||||||
|
if (var == "EPHSTATE") {
|
||||||
|
return String(ephtxt[ephstate]);
|
||||||
|
}
|
||||||
return String();
|
return String();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2838,6 +2841,7 @@ void loopWifiScan() {
|
||||||
}
|
}
|
||||||
if (hasRS92) {
|
if (hasRS92) {
|
||||||
geteph();
|
geteph();
|
||||||
|
if(ephstate==EPH_PENDING) ephstate=EPH_ERROR;
|
||||||
get_eph("/brdc");
|
get_eph("/brdc");
|
||||||
}
|
}
|
||||||
delay(3000);
|
delay(3000);
|
||||||
|
|
|
@ -64,6 +64,8 @@
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
Autodetect info: %AUTODETECT_INFO%<br>
|
Autodetect info: %AUTODETECT_INFO%<br>
|
||||||
|
<br>
|
||||||
|
RS92 RINEX eph state: %EPHSTATE%<br>
|
||||||
<br>
|
<br>
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License as
|
modify it under the terms of the GNU General Public License as
|
||||||
|
|
|
@ -12,6 +12,9 @@ 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 ephstate = EPH_NOTUSED;
|
||||||
|
//enum EPHSTATE { EPH_NOTUSED, EPH_PENDING, EPH_TIMEERR, EPH_ERROR, EPH_EPHERROR, EPH_GOOD };
|
||||||
|
char *ephtxt[] = { "Disabled", "Pending", "Time error", "Fetch error", "Read error", "Good" };
|
||||||
|
|
||||||
uint8_t getreply() {
|
uint8_t getreply() {
|
||||||
String s = client.readStringUntil('\n');
|
String s = client.readStringUntil('\n');
|
||||||
|
@ -45,10 +48,12 @@ void writeFully(File &file, uint8_t *buf, size_t len)
|
||||||
|
|
||||||
void geteph() {
|
void geteph() {
|
||||||
// Set current time via network...
|
// Set current time via network...
|
||||||
|
ephstate = EPH_PENDING;
|
||||||
struct tm tinfo;
|
struct tm tinfo;
|
||||||
configTime(0, 0, "pool.ntp.org");
|
configTime(0, 0, "pool.ntp.org");
|
||||||
bool ok = getLocalTime(&tinfo, 2000); // wait max 2 seconds to get current time via ntp
|
bool ok = getLocalTime(&tinfo, 2000); // wait max 2 seconds to get current time via ntp
|
||||||
if(!ok) {
|
if(!ok) {
|
||||||
|
ephstate = EPH_TIMEERR;
|
||||||
Serial.println("Failed to get current date/time");
|
Serial.println("Failed to get current date/time");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -66,6 +71,7 @@ void geteph() {
|
||||||
if(tsstr && strlen(tsstr)>=9) {
|
if(tsstr && strlen(tsstr)>=9) {
|
||||||
if(strcmp(nowstr, ts.c_str())<=0) {
|
if(strcmp(nowstr, ts.c_str())<=0) {
|
||||||
Serial.println("local brdc is up to date\n");
|
Serial.println("local brdc is up to date\n");
|
||||||
|
ephstate = EPH_GOOD;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,6 +227,7 @@ void geteph() {
|
||||||
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*dispys,buf);
|
disp.rdis->drawString(0,5*dispys,buf);
|
||||||
|
ephstate = EPH_GOOD;
|
||||||
delay(1000);
|
delay(1000);
|
||||||
|
|
||||||
free(obuf);
|
free(obuf);
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#ifndef GETEPH_H
|
||||||
|
#define GETEPH_H
|
||||||
void geteph();
|
void geteph();
|
||||||
|
|
||||||
|
enum EPHSTATE { EPH_NOTUSED, EPH_PENDING, EPH_TIMEERR, EPH_ERROR, EPH_EPHERROR, EPH_GOOD };
|
||||||
|
|
||||||
|
extern uint8_t ephstate;
|
||||||
|
extern char *ephtxt[];
|
||||||
|
#endif
|
||||||
|
|
|
@ -50,13 +50,14 @@
|
||||||
#include <SPIFFS.h>
|
#include <SPIFFS.h>
|
||||||
#include "nav_gps_vel.h"
|
#include "nav_gps_vel.h"
|
||||||
#include "rs92gps.h"
|
#include "rs92gps.h"
|
||||||
|
#include "geteph.h"
|
||||||
#include "Sonde.h"
|
#include "Sonde.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gpx_t gpx;
|
gpx_t gpx;
|
||||||
|
|
||||||
int option_verbose = 0, // ausfuehrliche Anzeige
|
const int option_verbose = 0, // ausfuehrliche Anzeige
|
||||||
option_raw = 1, // rohe Frames
|
option_raw = 1, // rohe Frames
|
||||||
option_inv = 0, // invertiert Signal
|
option_inv = 0, // invertiert Signal
|
||||||
option_res = 0, // genauere Bitmessung
|
option_res = 0, // genauere Bitmessung
|
||||||
|
@ -827,27 +828,33 @@ int naiv_2Dfix(int N, SAT_t sats[], double alt) {
|
||||||
int get_GPSkoord(int N) {
|
int get_GPSkoord(int N) {
|
||||||
double lat, lon, alt, rx_cl_bias;
|
double lat, lon, alt, rx_cl_bias;
|
||||||
double vH, vD, vU;
|
double vH, vD, vU;
|
||||||
double lat1s, lon1s, alt1s,
|
double pos_ecef[3], dpos_ecef[3],
|
||||||
lat0 , lon0 , alt0 , pos0_ecef[3];
|
|
||||||
double pos_ecef[3], pos1s_ecef[3], dpos_ecef[3],
|
|
||||||
vel_ecef[3], dvel_ecef[3];
|
vel_ecef[3], dvel_ecef[3];
|
||||||
double gdop, gdop0 = 1000.0;
|
double gdop, gdop0 = 1000.0;
|
||||||
//double hdop, vdop, pdop;
|
//double hdop, vdop, pdop;
|
||||||
int i0, i1, i2, i3, j, k, n;
|
int i0, i1, i2, i3, j;
|
||||||
int nav_ret = 0;
|
int nav_ret = 0;
|
||||||
int num = 0;
|
int num = 0;
|
||||||
SAT_t Sat_A[4];
|
SAT_t Sat_A[4];
|
||||||
|
#if 0
|
||||||
|
int k, n;
|
||||||
|
double lat1s, lon1s, alt1s,
|
||||||
|
lat0 , lon0 , alt0 , pos0_ecef[3];
|
||||||
|
double pos1s_ecef[3];
|
||||||
SAT_t Sat_B[12]; // N <= 12
|
SAT_t Sat_B[12]; // N <= 12
|
||||||
SAT_t Sat_B1s[12];
|
SAT_t Sat_B1s[12];
|
||||||
SAT_t Sat_C[12]; // 11
|
SAT_t Sat_C[12]; // 11
|
||||||
double diter = 0;
|
|
||||||
int exN = -1;
|
int exN = -1;
|
||||||
|
#endif
|
||||||
|
double diter = 0;
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (option_vergps == 8) {
|
if (option_vergps == 8) {
|
||||||
fprintf(stdout, " sats: ");
|
fprintf(stdout, " sats: ");
|
||||||
for (j = 0; j < N; j++) fprintf(stdout, "%02d ", prn[j]);
|
for (j = 0; j < N; j++) fprintf(stdout, "%02d ", prn[j]);
|
||||||
fprintf(stdout, "\n");
|
fprintf(stdout, "\n");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
gpx.lat = gpx.lon = gpx.alt = 0;
|
gpx.lat = gpx.lon = gpx.alt = 0;
|
||||||
|
|
||||||
|
@ -878,6 +885,7 @@ int get_GPSkoord(int N) {
|
||||||
for (j=0; j<3; j++) vel_ecef[j] += dvel_ecef[j];
|
for (j=0; j<3; j++) vel_ecef[j] += dvel_ecef[j];
|
||||||
get_GPSvel(lat, lon, vel_ecef, &vH, &vD, &vU);
|
get_GPSvel(lat, lon, vel_ecef, &vH, &vD, &vU);
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
if (option_vergps == 8) {
|
if (option_vergps == 8) {
|
||||||
// gdop = sqrt(DOP[0]+DOP[1]+DOP[2]+DOP[3]); // s.o.
|
// gdop = sqrt(DOP[0]+DOP[1]+DOP[2]+DOP[3]); // s.o.
|
||||||
//hdop = sqrt(DOP[0]+DOP[1]);
|
//hdop = sqrt(DOP[0]+DOP[1]);
|
||||||
|
@ -898,6 +906,7 @@ int get_GPSkoord(int N) {
|
||||||
fprintf(stdout, "\n");
|
fprintf(stdout, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else gdop = -1;
|
else gdop = -1;
|
||||||
|
|
||||||
|
@ -921,6 +930,7 @@ int get_GPSkoord(int N) {
|
||||||
}}}}
|
}}}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (option_vergps == 8 || option_vergps == 2) {
|
if (option_vergps == 8 || option_vergps == 2) {
|
||||||
|
|
||||||
for (j = 0; j < N; j++) Sat_B[j] = sat[prn[j]];
|
for (j = 0; j < N; j++) Sat_B[j] = sat[prn[j]];
|
||||||
|
@ -1047,6 +1057,7 @@ int get_GPSkoord(int N) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
@ -1184,6 +1195,8 @@ void get_eph(const char *file) {
|
||||||
if (ephs) {
|
if (ephs) {
|
||||||
ephem = 1;
|
ephem = 1;
|
||||||
almanac = 0;
|
almanac = 0;
|
||||||
|
} else {
|
||||||
|
ephstate = EPH_EPHERROR;
|
||||||
}
|
}
|
||||||
Serial.printf("reading RNX done, result is %d, ephs=%p\n", ephem, ephs);
|
Serial.printf("reading RNX done, result is %d, ephs=%p\n", ephem, ephs);
|
||||||
if (!option_der) d_err = 1000;
|
if (!option_der) d_err = 1000;
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
src_dir = RX_FSK
|
src_dir = RX_FSK
|
||||||
lib_dir = libraries
|
lib_dir = RX_FSK
|
||||||
data_dir = RX_FSK/data
|
data_dir = RX_FSK/data
|
||||||
|
|
||||||
[extra]
|
[extra]
|
||||||
lib_deps_builtin =
|
lib_deps_builtin =
|
||||||
SondeLib
|
src
|
||||||
lib_deps_external =
|
lib_deps_external =
|
||||||
olikraus/U8g2 @ ^2.28.8
|
olikraus/U8g2 @ ^2.28.8
|
||||||
AXP202X_Library
|
AXP202X_Library
|
||||||
|
|
Ładowanie…
Reference in New Issue