use correct M10/M20 type everywhere
This commit is contained in:
parent
a7f6d6bb7b
commit
8bc4eda63c
|
|
@ -503,7 +503,7 @@ void addSondeStatus(char *ptr, int i)
|
||||||
struct tm ts;
|
struct tm ts;
|
||||||
SondeInfo *s = &sonde.sondeList[i];
|
SondeInfo *s = &sonde.sondeList[i];
|
||||||
strcat(ptr, "<table>");
|
strcat(ptr, "<table>");
|
||||||
sprintf(ptr + strlen(ptr), "<tr><td id=\"sfreq\">%3.3f MHz, Type: %s</td><tr><td>ID: %s", s->freq, sondeTypeLongStr[s->type],
|
sprintf(ptr + strlen(ptr), "<tr><td id=\"sfreq\">%3.3f MHz, Type: %s</td><tr><td>ID: %s", s->freq, sondeTypeLongStr[sonde.realType(s)],
|
||||||
s->d.validID ? s->d.id : "<?""?>");
|
s->d.validID ? s->d.id : "<?""?>");
|
||||||
if (s->d.validID && (TYPE_IS_DFM(s->type) || TYPE_IS_METEO(s->type) || s->type == STYPE_MP3H) ) {
|
if (s->d.validID && (TYPE_IS_DFM(s->type) || TYPE_IS_METEO(s->type) || s->type == STYPE_MP3H) ) {
|
||||||
sprintf(ptr + strlen(ptr), " (ser: %s)", s->d.ser);
|
sprintf(ptr + strlen(ptr), " (ser: %s)", s->d.ser);
|
||||||
|
|
@ -548,7 +548,7 @@ const char *createLiveJson() {
|
||||||
|
|
||||||
SondeInfo *s = &sonde.sondeList[sonde.currentSonde];
|
SondeInfo *s = &sonde.sondeList[sonde.currentSonde];
|
||||||
sprintf(ptr + strlen(ptr), "\"sonde\": {\"rssi\": %d, \"vframe\": %d, \"time\": %d,\"id\": \"%s\", \"freq\": %3.3f, \"type\": \"%s\"",
|
sprintf(ptr + strlen(ptr), "\"sonde\": {\"rssi\": %d, \"vframe\": %d, \"time\": %d,\"id\": \"%s\", \"freq\": %3.3f, \"type\": \"%s\"",
|
||||||
s->rssi, s->d.vframe, s->d.time, s->d.id, s->freq, sondeTypeStr[s->type]);
|
s->rssi, s->d.vframe, s->d.time, s->d.id, s->freq, sondeTypeStr[sonde.realType(s)]);
|
||||||
|
|
||||||
if ( !isnan(s->d.lat) && !isnan(s->d.lon) )
|
if ( !isnan(s->d.lat) && !isnan(s->d.lon) )
|
||||||
sprintf(ptr + strlen(ptr), ", \"lat\": %.6f, \"lon\": %.6f", s->d.lat, s->d.lon);
|
sprintf(ptr + strlen(ptr), ", \"lat\": %.6f, \"lon\": %.6f", s->d.lat, s->d.lon);
|
||||||
|
|
@ -1309,7 +1309,7 @@ void addSondeStatusKML(char *ptr, int i)
|
||||||
sprintf(ptr + strlen(ptr), "<Placemark id=\"%s\"><name>%s</name><Point><altitudeMode>absolute</altitudeMode><coordinates>%.6f,%.6f,%.0f</coordinates></Point><description>%3.3f MHz, Type: %s, h=%.0fm</description></Placemark>",
|
sprintf(ptr + strlen(ptr), "<Placemark id=\"%s\"><name>%s</name><Point><altitudeMode>absolute</altitudeMode><coordinates>%.6f,%.6f,%.0f</coordinates></Point><description>%3.3f MHz, Type: %s, h=%.0fm</description></Placemark>",
|
||||||
s->d.id, s->d.id,
|
s->d.id, s->d.id,
|
||||||
s->d.lon, s->d.lat, s->d.alt,
|
s->d.lon, s->d.lat, s->d.alt,
|
||||||
s->freq, sondeTypeStr[s->type], s->d.alt);
|
s->freq, sondeTypeStr[sonde.realType(s)], s->d.alt);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *createKMLDynamic() {
|
const char *createKMLDynamic() {
|
||||||
|
|
@ -2573,7 +2573,7 @@ void loopDecoder() {
|
||||||
char raw[1024];
|
char raw[1024];
|
||||||
char gps[128];
|
char gps[128];
|
||||||
const char *typestr = s->d.typestr;
|
const char *typestr = s->d.typestr;
|
||||||
if (*typestr == 0) typestr = sondeTypeStr[s->type];
|
if (*typestr == 0) typestr = sondeTypeStr[sonde.realType(s)];
|
||||||
// TODO: only if GPS is valid...
|
// TODO: only if GPS is valid...
|
||||||
if (gpsPos.valid) {
|
if (gpsPos.valid) {
|
||||||
snprintf(gps, 128, ", \"gpslat\": %f,"
|
snprintf(gps, 128, ", \"gpslat\": %f,"
|
||||||
|
|
@ -3646,11 +3646,8 @@ void sondehub_send_data(WiFiClient * client, SondeInfo * s, struct st_sondehub *
|
||||||
char rs_msg[MSG_SIZE];
|
char rs_msg[MSG_SIZE];
|
||||||
char *w;
|
char *w;
|
||||||
struct tm ts;
|
struct tm ts;
|
||||||
uint8_t realtype = s->type;
|
|
||||||
// config setting M10 and M20 will both decode both types, so use the real type that was decoded
|
// config setting M10 and M20 will both decode both types, so use the real type that was decoded
|
||||||
if (TYPE_IS_METEO(realtype)) {
|
uint8_t realtype = sonde.realType(s);
|
||||||
realtype = s->d.subtype == 1 ? STYPE_M10 : STYPE_M20;
|
|
||||||
}
|
|
||||||
|
|
||||||
// For DFM, s->d.time is data from subframe DAT8 (gps date/hh/mm), and sec is from DAT1 (gps sec/usec)
|
// For DFM, s->d.time is data from subframe DAT8 (gps date/hh/mm), and sec is from DAT1 (gps sec/usec)
|
||||||
// For all others, sec should always be 0 and time the exact time in seconds
|
// For all others, sec should always be 0 and time the exact time in seconds
|
||||||
|
|
|
||||||
|
|
@ -328,6 +328,25 @@ int M10M20::decodeframeM10(uint8_t *data) {
|
||||||
if(dir<0) dir+=360;
|
if(dir<0) dir+=360;
|
||||||
si->dir = dir;
|
si->dir = dir;
|
||||||
si->validPos = 0x3f;
|
si->validPos = 0x3f;
|
||||||
|
// m10 temp
|
||||||
|
const float p0 = 1.07303516e-03, p1 = 2.41296733e-04, p2 = 2.26744154e-06, p3 = 6.52855181e-08;
|
||||||
|
const float Rs[3] = { 12.1e3 , 36.5e3 , 475.0e3 };
|
||||||
|
const float Rp[3] = { 1e20 , 330.0e3 , 2000.0e3 };
|
||||||
|
uint8_t sct = data[62];
|
||||||
|
float rt = getint16(data+63) & (0xFFF);
|
||||||
|
float T = NAN;
|
||||||
|
if(rt!=0 && sct<3) {
|
||||||
|
rt = (4095-rt)/rt - (Rs[sct]/Rp[sct]);
|
||||||
|
if(rt>0) {
|
||||||
|
rt = Rs[sct] / rt;
|
||||||
|
if(rt>0) {
|
||||||
|
rt = log(rt);
|
||||||
|
rt = 1/( p0 + p1*rt + p2*rt*rt + p3*rt*rt*rt ) - 273.15;
|
||||||
|
if(rt>-99 && rt<50) { T = rt; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
si->temperature = T;
|
||||||
|
|
||||||
uint32_t gpstime = getint32(data+10);
|
uint32_t gpstime = getint32(data+10);
|
||||||
uint16_t gpsweek = getint16(data+32);
|
uint16_t gpsweek = getint16(data+32);
|
||||||
|
|
|
||||||
|
|
@ -716,4 +716,9 @@ void Sonde::clearDisplay() {
|
||||||
disp.rdis->clear();
|
disp.rdis->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SondeType Sonde::realType(SondeInfo *si) {
|
||||||
|
if(TYPE_IS_METEO(si->type)) { return si->d.subtype==1 ? STYPE_M10:STYPE_M20; }
|
||||||
|
else return si->type;
|
||||||
|
}
|
||||||
|
|
||||||
Sonde sonde = Sonde();
|
Sonde sonde = Sonde();
|
||||||
|
|
|
||||||
|
|
@ -319,6 +319,8 @@ public:
|
||||||
// moved to heap, saving space in .bss
|
// moved to heap, saving space in .bss
|
||||||
//SondeInfo sondeList[MAXSONDE+1];
|
//SondeInfo sondeList[MAXSONDE+1];
|
||||||
SondeInfo *sondeList;
|
SondeInfo *sondeList;
|
||||||
|
// helper function for type string
|
||||||
|
static SondeType realType(SondeInfo *si);
|
||||||
|
|
||||||
Sonde();
|
Sonde();
|
||||||
void defaultConfig();
|
void defaultConfig();
|
||||||
|
|
|
||||||
|
|
@ -310,7 +310,7 @@ char *aprs_senddata(SondeInfo *si, const char *usercall, const char *sym) {
|
||||||
if( !isnan(s->relativeHumidity) ) {
|
if( !isnan(s->relativeHumidity) ) {
|
||||||
sprintf(b+strlen(b), "h=%.1f%% ", s->relativeHumidity);
|
sprintf(b+strlen(b), "h=%.1f%% ", s->relativeHumidity);
|
||||||
}
|
}
|
||||||
sprintf(b+strlen(b), "%.3fMHz Type=%s ", si->freq, sondeTypeStr[si->type]);
|
sprintf(b+strlen(b), "%.3fMHz Type=%s ", si->freq, sondeTypeStr[sonde.realType(si)]);
|
||||||
if( s->countKT != 0xffff && s->vframe - s->crefKT < 51 ) {
|
if( s->countKT != 0xffff && s->vframe - s->crefKT < 51 ) {
|
||||||
sprintf(b+strlen(b), "TxOff=%dh%dm ", s->countKT/3600, (s->countKT-s->countKT/3600*3600)/60);
|
sprintf(b+strlen(b), "TxOff=%dh%dm ", s->countKT/3600, (s->countKT-s->countKT/3600*3600)/60);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue