kopia lustrzana https://github.com/dl9rdz/rdz_ttgo_sonde
RS41: keep previous position if frame with position 0/0 is received
rodzic
57be2b7d80
commit
aa1699066e
|
@ -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;
|
||||
|
|
|
@ -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() */
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Ładowanie…
Reference in New Issue