RS41: keep previous position if frame with position 0/0 is received

pull/27/head
Hansi, dl9rdz 2019-11-25 10:51:51 +01:00
rodzic 57be2b7d80
commit aa1699066e
3 zmienionych plików z 11 dodań i 5 usunięć

Wyświetl plik

@ -1,4 +1,4 @@
const char *version_name = "rdzTTGOsonde";
const char *version_id = "devel20191110";
const char *version_id = "devel20191125";
const int SPIFFS_MAJOR=2;
const int SPIFFS_MINOR=1;

Wyświetl plik

@ -306,6 +306,8 @@ static void wgs84r(double x, double y, double z,
/* lat:=atan(z/(rh*(1.0 - E2))); */
/* heig:=sqrt(h + z*z) - EARTHA; */
} /* end wgs84r() */
// returns: 0=ok, -1=error
static void posrs41(const byte b[], uint32_t b_len, uint32_t p)
{
double dir;
@ -367,10 +369,14 @@ static void posrs41(const byte b[], uint32_t b_len, uint32_t p)
Serial.print("Sats");
sonde.si()->sats = sats;
sonde.si()->alt = heig;
if( 0==(int)(lat*10000) && 0==(int)(long0*10000) )
sonde.si()->validPos = 0;
if( 0==(int)(lat*10000) && 0==(int)(long0*10000) ) {
if(sonde.si()->validPos) {
// we have an old position, so keep previous position and mark it as old
sonde.si()->validPos |= 0x80;
}
}
else
sonde.si()->validPos = 0x3f;
sonde.si()->validPos = 0x7f;
} /* end posrs41() */

Wyświetl plik

@ -68,7 +68,7 @@ typedef struct st_sondeinfo {
float hs; // horizontal speed
float dir; // 0..360
uint8_t sats; // number of sats
uint8_t validPos; // bit pattern for validity of above 6 fields
uint8_t validPos; // bit pattern for validity of above 7 fields; 0x80: position is old
// decoded GPS time
uint32_t time;
uint16_t sec;