fix M10 dir and sondehub frame#
This commit is contained in:
parent
7555eda024
commit
045b61bf23
|
|
@ -3022,7 +3022,7 @@ void loop() {
|
|||
Update station data to the sondehub v2 DB
|
||||
*/
|
||||
void sondehub_station_update(WiFiClient *client, struct st_sondehub *conf) {
|
||||
#define STATION_DATA_LEN 300
|
||||
#define STATION_DATA_LEN 300
|
||||
char data[STATION_DATA_LEN];
|
||||
char *w;
|
||||
|
||||
|
|
@ -3140,7 +3140,7 @@ void sondehub_send_data(WiFiClient *client, SondeInfo *s, struct st_sondehub *co
|
|||
if (((int)s->lat == 0) && ((int)s->lon == 0)) return; // Sometimes these values are zeroes. Don't send those to the sondehub
|
||||
if ((int)s->alt > 50000) return; // If alt is too high don't send to SondeHub
|
||||
// M20 data does not include #sat information
|
||||
if ( s->type!=STYPE_M20 && (int)s->sats < 4) return; // If not enough sats don't send to SondeHub
|
||||
if ( s->type != STYPE_M20 && (int)s->sats < 4) return; // If not enough sats don't send to SondeHub
|
||||
|
||||
// If not connected to sondehub, try reconnecting.
|
||||
// TODO: do this outside of main loop
|
||||
|
|
@ -3216,7 +3216,11 @@ void sondehub_send_data(WiFiClient *client, SondeInfo *s, struct st_sondehub *co
|
|||
// For M10, this is real GPS time (seconds since Jqn 6 1980, without adjusting for leap seconds)
|
||||
// DFM and MP3H send real UTC (with leap seconds considered), so for them the frame number actually
|
||||
// is gps time plus number of leap seconds since the beginning of GPS time.
|
||||
sprintf(w, "\"frame\": %d,", int(t - 315964800));
|
||||
int frame = (int)(t - 315964800);
|
||||
if (s->type == STYPE_M10) {
|
||||
frame += 18;
|
||||
};
|
||||
sprintf(w, "\"frame\": %d,", frame);
|
||||
} else {
|
||||
sprintf(w, "\"frame\": %d,", s->frame);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const char *version_name = "rdzTTGOsonde";
|
||||
const char *version_id = "devel20210726";
|
||||
const char *version_id = "devel20210727";
|
||||
const int SPIFFS_MAJOR=2;
|
||||
const int SPIFFS_MINOR=11;
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ int M10M20::decodeframeM10(uint8_t *data) {
|
|||
sonde.si()->vs = getint16(data+8) * VMUL;
|
||||
sonde.si()->hs = sqrt(ve*ve+vn*vn);
|
||||
sonde.si()->sats = data[30];
|
||||
float dir = atan2(vn, ve)*(1.0/RAD);
|
||||
float dir = atan2(ve, vn)*(1.0/RAD);
|
||||
if(dir<0) dir+=360;
|
||||
sonde.si()->dir = dir;
|
||||
sonde.si()->validPos = 0x3f;
|
||||
|
|
@ -566,7 +566,7 @@ int M10M20::decodeframeM20(uint8_t *data) {
|
|||
//0x18 2 byte
|
||||
sonde.si()->vs = getint16(data+24) * VMUL_M20;
|
||||
sonde.si()->hs = sqrt(ve*ve+vn*vn);
|
||||
float dir = atan2(vn, ve)*(1.0/RAD);
|
||||
float dir = atan2(ve, vn)*(1.0/RAD);
|
||||
if(dir<0) dir+=360;
|
||||
sonde.si()->dir = dir;
|
||||
sonde.si()->validPos = 0x3f;
|
||||
|
|
|
|||
Loading…
Reference in New Issue