Added SondeSeeker function to test. Still outputs the same format as Chasemapper
This commit is contained in:
parent
15c5c83604
commit
7504ec8476
|
|
@ -42,6 +42,9 @@
|
||||||
|
|
||||||
|
|
||||||
/* Data exchange connectors */
|
/* Data exchange connectors */
|
||||||
|
#if FEATURE_SONDESEEKER
|
||||||
|
#include "src/conn-sondeseeker.h"
|
||||||
|
#endif
|
||||||
#if FEATURE_CHASEMAPPER
|
#if FEATURE_CHASEMAPPER
|
||||||
#include "src/conn-chasemapper.h"
|
#include "src/conn-chasemapper.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -71,6 +74,9 @@ Conn *connectors[] = { &connSystem,
|
||||||
#if FEATURE_CHASEMAPPER
|
#if FEATURE_CHASEMAPPER
|
||||||
&connChasemapper,
|
&connChasemapper,
|
||||||
#endif
|
#endif
|
||||||
|
#if FEATURE_SONDESEEKER
|
||||||
|
&connSondeseeker,
|
||||||
|
#endif
|
||||||
#if FEATURE_MQTT
|
#if FEATURE_MQTT
|
||||||
&connMQTT,
|
&connMQTT,
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -753,6 +759,12 @@ struct st_configitems config_list[] = {
|
||||||
{"cm.host", 63, &sonde.config.cm.host},
|
{"cm.host", 63, &sonde.config.cm.host},
|
||||||
{"cm.port", 0, &sonde.config.cm.port},
|
{"cm.port", 0, &sonde.config.cm.port},
|
||||||
#endif
|
#endif
|
||||||
|
#if FEATURE_SONDESEEKER
|
||||||
|
/* Sondeseeker settings */
|
||||||
|
{"ss.active", -3, &sonde.config.ss.active},
|
||||||
|
{"ss.host", 63, &sonde.config.ss.host},
|
||||||
|
{"ss.port", 0, &sonde.config.ss.port},
|
||||||
|
#endif
|
||||||
#if FEATURE_MQTT
|
#if FEATURE_MQTT
|
||||||
/* MQTT */
|
/* MQTT */
|
||||||
{"mqtt.active", 0, &sonde.config.mqtt.active},
|
{"mqtt.active", 0, &sonde.config.mqtt.active},
|
||||||
|
|
@ -2311,6 +2323,9 @@ void loopDecoder() {
|
||||||
#endif
|
#endif
|
||||||
#if FEATURE_CHASEMAPPER
|
#if FEATURE_CHASEMAPPER
|
||||||
connChasemapper.updateSonde( s );
|
connChasemapper.updateSonde( s );
|
||||||
|
#endif
|
||||||
|
#if FEATURE_SONDESEEKER
|
||||||
|
connSondeseeker.updateSonde( s );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if FEATURE_SONDEHUB
|
#if FEATURE_SONDEHUB
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,10 @@ var cfgs = [
|
||||||
[ "cm.active", "Chasemapper active (0=disabled, 1=active)"],
|
[ "cm.active", "Chasemapper active (0=disabled, 1=active)"],
|
||||||
[ "cm.host", "Chasemapper UDP host"],
|
[ "cm.host", "Chasemapper UDP host"],
|
||||||
[ "cm.port", "Chasemapper UDP port"],
|
[ "cm.port", "Chasemapper UDP port"],
|
||||||
|
[ "", "Chasemapper settings", "https://github.com/dl9rdz/rdz_ttgo_sonde/wiki/Sondeseeker-configuration"],
|
||||||
|
[ "ss.active", "Sondeseeker active (0=disabled, 1=active)"],
|
||||||
|
[ "ss.host", "Sondeseeker UDP host"],
|
||||||
|
[ "ss.port", "Sondeseeker UDP port"],
|
||||||
[ "", "SondeHub settings", "https://github.com/dl9rdz/rdz_ttgo_sonde/wiki/SondeHub-settings"],
|
[ "", "SondeHub settings", "https://github.com/dl9rdz/rdz_ttgo_sonde/wiki/SondeHub-settings"],
|
||||||
[ "sondehub.active", "SondeHub reporting (0=disabled, 1=active)"],
|
[ "sondehub.active", "SondeHub reporting (0=disabled, 1=active)"],
|
||||||
[ "sondehub.chase", "SondeHub location reporting (0=off, 1=fixed, 2=chase/GPS, 3=auto)"],
|
[ "sondehub.chase", "SondeHub location reporting (0=off, 1=fixed, 2=chase/GPS, 3=auto)"],
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
#define FEATURE_MQTT 1
|
#define FEATURE_MQTT 1
|
||||||
#define FEATURE_SDCARD 1
|
#define FEATURE_SDCARD 1
|
||||||
#define FEATURE_APRS 1
|
#define FEATURE_APRS 1
|
||||||
|
#define FEATURE_SONDESEEKER 1
|
||||||
|
|
||||||
|
|
||||||
// Additional optional components
|
// Additional optional components
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
#include "../features.h"
|
||||||
|
#if FEATURE_SONDESEEKER
|
||||||
|
|
||||||
|
#include "conn-sondeseeker.h"
|
||||||
|
#include <WiFiUdp.h>
|
||||||
|
|
||||||
|
extern const char *sondeTypeStrSH[];
|
||||||
|
extern WiFiUDP udp;
|
||||||
|
|
||||||
|
void ConnSondeseeker::init() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnSondeseeker::netsetup() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnSondeseeker::netshutdown() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnSondeseeker::updateSonde(SondeInfo *si) {
|
||||||
|
char buf[1024];
|
||||||
|
struct tm tim;
|
||||||
|
|
||||||
|
if(!sonde.config.ss.active) return;
|
||||||
|
|
||||||
|
time_t t = si->d.time;
|
||||||
|
gmtime_r(&t, &tim);
|
||||||
|
uint8_t realtype = si->type;
|
||||||
|
if (TYPE_IS_METEO(realtype)) {
|
||||||
|
realtype = si->d.subtype == 1 ? STYPE_M10 : STYPE_M20;
|
||||||
|
}
|
||||||
|
char prefix[10];
|
||||||
|
if(realtype == STYPE_RS41) {
|
||||||
|
prefix[0] = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
strncpy(prefix, sondeTypeStrSH[realtype], 10);
|
||||||
|
strcat(prefix, "-");
|
||||||
|
}
|
||||||
|
sprintf(buf, "{ \"type\": \"PAYLOAD_SUMMARY\","
|
||||||
|
"\"callsign\": \"%s%s\","
|
||||||
|
"\"latitude\": %.5f,"
|
||||||
|
"\"longitude\": %.5f,"
|
||||||
|
"\"altitude\": %d,"
|
||||||
|
"\"speed\": %d,"
|
||||||
|
"\"heading\": %d,"
|
||||||
|
"\"time\": \"%02d:%02d:%02d\","
|
||||||
|
"\"model\": \"%s\","
|
||||||
|
"\"freq\": \"%.3f MHz\"",
|
||||||
|
prefix,
|
||||||
|
si->d.ser,
|
||||||
|
si->d.lat,
|
||||||
|
si->d.lon,
|
||||||
|
(int)si->d.alt,
|
||||||
|
(int)(si->d.hs * 1.9438445), // m/s into knots
|
||||||
|
(int)si->d.dir,
|
||||||
|
tim.tm_hour, tim.tm_min, tim.tm_sec,
|
||||||
|
sondeTypeStrSH[realtype],
|
||||||
|
si->freq);
|
||||||
|
if( !isnan(si->d.temperature) ) {
|
||||||
|
sprintf(buf + strlen(buf), ", \"temp\": %.1f", si->d.temperature);
|
||||||
|
}
|
||||||
|
strcat(buf, "}");
|
||||||
|
Serial.printf("Sending SondeSeeker json: %s\n", buf);
|
||||||
|
udp.beginPacket(sonde.config.ss.host, sonde.config.ss.port);
|
||||||
|
udp.write((const uint8_t *)buf, strlen(buf));
|
||||||
|
udp.endPacket();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnSondeseeker::updateStation(PosInfo *pi) {
|
||||||
|
}
|
||||||
|
|
||||||
|
String ConnSondeseeker::getStatus() {
|
||||||
|
if(!sonde.config.ss.active) return String("disabled");
|
||||||
|
char info[100];
|
||||||
|
snprintf(info, 100, "active [%s:%d]", sonde.config.ss.host, sonde.config.ss.port);
|
||||||
|
return String(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
String ConnSondeseeker::getName() {
|
||||||
|
return String("SondeSeeker");
|
||||||
|
}
|
||||||
|
|
||||||
|
ConnSondeseeker connSondeseeker;
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
#ifndef _SONDESEEKER_H
|
||||||
|
#define _SONDESEEKER_H
|
||||||
|
|
||||||
|
#include "Sonde.h"
|
||||||
|
#include "conn.h"
|
||||||
|
|
||||||
|
class ConnSondeseeker : public Conn {
|
||||||
|
public:
|
||||||
|
void init();
|
||||||
|
void netsetup();
|
||||||
|
void netshutdown();
|
||||||
|
void updateSonde( SondeInfo *si );
|
||||||
|
void updateStation( PosInfo *pi );
|
||||||
|
String getStatus();
|
||||||
|
String getName();
|
||||||
|
};
|
||||||
|
|
||||||
|
extern ConnSondeseeker connSondeseeker;
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue