fix posInfo bug; aprs timeout convert seconds to ms

This commit is contained in:
Hansi, dl9rdz 2023-08-22 22:28:37 +00:00
parent deec0d362f
commit 082b6ccdf5
6 changed files with 8 additions and 2 deletions

View File

@ -809,6 +809,7 @@ const char *handleConfigPost(AsyncWebServerRequest * request) {
f.close(); f.close();
Serial.printf("Re-reading file file\n"); Serial.printf("Re-reading file file\n");
setupConfigData(); setupConfigData();
if(!gpsPos.valid) fixedToPosInfo();
// TODO: Check if this is better done elsewhere? // TODO: Check if this is better done elsewhere?
// Use new config (whereever this is feasible without a reboot) // Use new config (whereever this is feasible without a reboot)
disp.setContrast(); disp.setContrast();
@ -1975,6 +1976,7 @@ void setup()
NULL); /* task handle*/ NULL); /* task handle*/
#endif #endif
sonde.setup(); sonde.setup();
fixedToPosInfo();
initGPS(); initGPS();
#if FEATURE_APRS #if FEATURE_APRS
connAPRS.init(); connAPRS.init();

View File

@ -15,6 +15,7 @@ document.addEventListener("DOMContentLoaded", function(){
fetch('live.json') fetch('live.json')
.then((response) => response.json()) .then((response) => response.json())
.then((data) => { .then((data) => {
if (data.gps===undefined) { data.gps={} };
console.log(data.gps.lat, data.gps.lon, data.sonde.ser); console.log(data.gps.lat, data.gps.lon, data.sonde.ser);
if( (data.sonde.ser||'')=='' && !(data.gps.lat===undefined) ) { if( (data.sonde.ser||'')=='' && !(data.gps.lat===undefined) ) {
urlarg = maps[maptype][2](data.gps.lat, data.gps.lon); urlarg = maps[maptype][2](data.gps.lat, data.gps.lon);

View File

@ -100,7 +100,7 @@ void ConnAPRS::updateStation( PosInfo *pi ) {
// We check for stalled connection and possibly close it // We check for stalled connection and possibly close it
Serial.printf("last_in - now: %ld\n", millis() - last_in); Serial.printf("last_in - now: %ld\n", millis() - last_in);
if ( sonde.config.tcpfeed.timeout > 0) { if ( sonde.config.tcpfeed.timeout > 0) {
if ( last_in && ( (millis() - last_in) > sonde.config.tcpfeed.timeout ) ) { if ( last_in && ( (millis() - last_in) > sonde.config.tcpfeed.timeout*1000 ) ) {
Serial.println("APRS timeout - closing connection"); Serial.println("APRS timeout - closing connection");
close(tcpclient); close(tcpclient);
tcpclient_state = TCS_DISCONNECTED; tcpclient_state = TCS_DISCONNECTED;

View File

@ -33,6 +33,7 @@ void fixedToPosInfo() {
posInfo.lat = sonde.config.rxlat; posInfo.lat = sonde.config.rxlat;
posInfo.lon = sonde.config.rxlon; posInfo.lon = sonde.config.rxlon;
posInfo.alt = sonde.config.rxalt; posInfo.alt = sonde.config.rxalt;
posInfo.valid = 1;
} }

View File

@ -33,5 +33,7 @@ void initGPS();
// Update position from app (if not local GPS chip) // Update position from app (if not local GPS chip)
void parseGpsJson(char *data, int len); void parseGpsJson(char *data, int len);
// Update position from static config
void fixedToPosInfo();
#endif #endif

View File

@ -1,4 +1,4 @@
const char *version_name = "rdzTTGOsonde"; const char *version_name = "rdzTTGOsonde";
const char *version_id = "devel20230819"; const char *version_id = "devel20230822";
const int SPIFFS_MAJOR=2; const int SPIFFS_MAJOR=2;
const int SPIFFS_MINOR=17; const int SPIFFS_MINOR=17;