kopia lustrzana https://github.com/dl9rdz/rdz_ttgo_sonde
Merge branch 'dl9rdz:devel' into devel
commit
6247f259f1
|
@ -74,8 +74,8 @@ headtxt = function(data,stat) {
|
||||||
var staticon = (stat == '1')?greendot:yellowdot;
|
var staticon = (stat == '1')?greendot:yellowdot;
|
||||||
statbar = staticon + statbar;
|
statbar = staticon + statbar;
|
||||||
if ((statbar.length) > 10*greendot.length) { statbar = statbar.substring(0,10*greendot.length); }
|
if ((statbar.length) > 10*greendot.length) { statbar = statbar.substring(0,10*greendot.length); }
|
||||||
//if (data.lat == '0.000000') { return false; }
|
if (data.lat == '0.000000') { return false; }
|
||||||
if (data.res == 0) {
|
if (data.id) {
|
||||||
$('#sonde_id').html(data.id);
|
$('#sonde_id').html(data.id);
|
||||||
$('#sonde_alt').html(data.alt);
|
$('#sonde_alt').html(data.alt);
|
||||||
$('#sonde_climb').html(data.climb);
|
$('#sonde_climb').html(data.climb);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
/* data feed to sondehubv2 */
|
/* data feed to sondehubv2 */
|
||||||
/* needs about 4k4 code, 200b data, 200b stack, 200b heap */
|
/* needs about 4k4 code, 200b data, 200b stack, 200b heap */
|
||||||
#define FEATURE_SONDEHUB 1
|
#define FEATURE_SONDEHUB 1
|
||||||
|
#define FEaTURE_CHASEMAPPER 1
|
||||||
#define FEATURE_MQTT 1
|
#define FEATURE_MQTT 1
|
||||||
|
|
||||||
#define FEATURE_RS92 1
|
#define FEATURE_RS92 1
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
#include "Chasemapper.h"
|
||||||
|
|
||||||
|
extern const char *sondeTypeStrSH[];
|
||||||
|
|
||||||
|
int Chasemapper::send(WiFiUDP &udp, SondeInfo *si) {
|
||||||
|
char buf[1024];
|
||||||
|
struct tm tim;
|
||||||
|
time_t t = si->time;
|
||||||
|
gmtime_r(&t, &tim);
|
||||||
|
uint8_t realtype = si->type;
|
||||||
|
if (TYPE_IS_METEO(realtype)) {
|
||||||
|
realtype = si->subtype == 1 ? STYPE_M10 : STYPE_M20;
|
||||||
|
}
|
||||||
|
sprintf(buf, "{ \"type\": \"PAYLOAD_SUMMARY\","
|
||||||
|
"\"callsign\": \"%s\","
|
||||||
|
"\"latitude\": %g,"
|
||||||
|
"\"longidude\": %g,"
|
||||||
|
"\"altitude\": %d,"
|
||||||
|
"\"speed\": %d,"
|
||||||
|
"\"heading\": %d,"
|
||||||
|
"\"time\": \"%02d:%02d:%02d\","
|
||||||
|
"\"model\": \"%s\","
|
||||||
|
"\"freq\": \"%.3f MHz\","
|
||||||
|
"\"temp\": %g }",
|
||||||
|
si->ser,
|
||||||
|
si->lat,
|
||||||
|
si->lon,
|
||||||
|
(int)si->alt,
|
||||||
|
(int)(si->hs * 1.9438445), // m/s into knots
|
||||||
|
(int)si->dir,
|
||||||
|
tim.tm_hour, tim.tm_min, tim.tm_sec,
|
||||||
|
sondeTypeStrSH[realtype],
|
||||||
|
si->freq,
|
||||||
|
si->temperature);
|
||||||
|
Serial.printf("Sending chasemapper json: %s\n", buf);
|
||||||
|
udp.beginPacket(sonde.config.cm.host, sonde.config.cm.port);
|
||||||
|
udp.write((const uint8_t *)buf, strlen(buf));
|
||||||
|
udp.endPacket();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#ifndef _CHASEMAPPER_H
|
||||||
|
#define _CHASEMAPPER_H
|
||||||
|
|
||||||
|
#include "Sonde.h"
|
||||||
|
//#include <WiFi.h>
|
||||||
|
#include <WiFiUdp.h>
|
||||||
|
|
||||||
|
class Chasemapper {
|
||||||
|
public:
|
||||||
|
static int send(WiFiUDP &udb, SondeInfo *si);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -3,6 +3,7 @@
|
||||||
#define Sonde_h
|
#define Sonde_h
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
enum DbgLevel { DEBUG_OFF=0, DEBUG_INFO=1, DEBUG_SPARSER=16, DEBUG_DISPLAY=8 }; // to be extended for configuring serial debug output
|
enum DbgLevel { DEBUG_OFF=0, DEBUG_INFO=1, DEBUG_SPARSER=16, DEBUG_DISPLAY=8 }; // to be extended for configuring serial debug output
|
||||||
extern uint8_t debug;
|
extern uint8_t debug;
|
||||||
|
@ -103,7 +104,7 @@ typedef struct st_sondeinfo {
|
||||||
uint32_t viewStart; // millis() timestamp of viewinf this sonde with current display
|
uint32_t viewStart; // millis() timestamp of viewinf this sonde with current display
|
||||||
int8_t lastState; // -1: disabled; 0: norx; 1: rx
|
int8_t lastState; // -1: disabled; 0: norx; 1: rx
|
||||||
// shut down timers, currently only for RS41; -1=disabled
|
// shut down timers, currently only for RS41; -1=disabled
|
||||||
int16_t launchKT, burstKT, countKT;
|
uint16_t launchKT, burstKT, countKT;
|
||||||
uint16_t crefKT; // frame number in which countKT was last sent
|
uint16_t crefKT; // frame number in which countKT was last sent
|
||||||
// sonde specific extra data, NULL if unused or not yet initialized, currently used for RS41 subframe data (calibration)
|
// sonde specific extra data, NULL if unused or not yet initialized, currently used for RS41 subframe data (calibration)
|
||||||
void *extra;
|
void *extra;
|
||||||
|
@ -186,6 +187,12 @@ struct st_mqtt {
|
||||||
char prefix[64];
|
char prefix[64];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct st_cm {
|
||||||
|
int active;
|
||||||
|
char host[64];
|
||||||
|
int port;
|
||||||
|
};
|
||||||
|
|
||||||
struct st_sondehub {
|
struct st_sondehub {
|
||||||
int active;
|
int active;
|
||||||
int chase;
|
int chase;
|
||||||
|
@ -259,6 +266,7 @@ typedef struct st_rdzconfig {
|
||||||
struct st_kisstnc kisstnc; // target for KISS TNC (via TCP, mainly for APRSdroid)
|
struct st_kisstnc kisstnc; // target for KISS TNC (via TCP, mainly for APRSdroid)
|
||||||
struct st_mqtt mqtt;
|
struct st_mqtt mqtt;
|
||||||
struct st_sondehub sondehub;
|
struct st_sondehub sondehub;
|
||||||
|
struct st_cm cm;
|
||||||
} RDZConfig;
|
} RDZConfig;
|
||||||
|
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue