Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6978f1cccc |
@@ -1,4 +1,4 @@
|
|||||||
RadioSonde Version 0.9.2
|
RadioSonde Version 0.9.1
|
||||||
============================
|
============================
|
||||||
<img src="http://xavier.debert.free.fr/RS/TTGO.jpg" width="50%"><img src="http://xavier.debert.free.fr/RS/TTGO2.jpg" width="50%">
|
<img src="http://xavier.debert.free.fr/RS/TTGO.jpg" width="50%"><img src="http://xavier.debert.free.fr/RS/TTGO2.jpg" width="50%">
|
||||||
<img src="http://xavier.debert.free.fr/RS/TTGO3.jpg" width="50%"><img src="http://xavier.debert.free.fr/RS/TTGO4.jpg" width="50%"><img src="http://xavier.debert.free.fr/RS/TTGO5.jpg" width="50%"><img src="http://xavier.debert.free.fr/RS/TTGO6.jpg" width="50%">
|
<img src="http://xavier.debert.free.fr/RS/TTGO3.jpg" width="50%"><img src="http://xavier.debert.free.fr/RS/TTGO4.jpg" width="50%"><img src="http://xavier.debert.free.fr/RS/TTGO5.jpg" width="50%"><img src="http://xavier.debert.free.fr/RS/TTGO6.jpg" width="50%">
|
||||||
@@ -18,18 +18,10 @@ Décodage de RadioSonde RS41/92 and DFM06/09/17 et M10+/20
|
|||||||
Attention à la version de votre TTGO! <br>
|
Attention à la version de votre TTGO! <br>
|
||||||
vous devez modifier dans config.txt, le port de l'écran OLED <br>
|
vous devez modifier dans config.txt, le port de l'écran OLED <br>
|
||||||
- TTGO v1: SDA=4 SCL=15, RST=16 <br>
|
- TTGO v1: SDA=4 SCL=15, RST=16 <br>
|
||||||
- TTGO v2: SDA=21 SCL=22, RST=16 <br>
|
- TTGO v2: SDA=21 SCL=22, RST=16
|
||||||
puis pour le GPS:<br>
|
|
||||||
- Lilygo esp32 GPS pin 34 Rx, 12 Tx<br>
|
|
||||||
puis Buzzer<br>
|
|
||||||
- par defaut 12 si pas de GPS si non pin 25<br>
|
|
||||||
|
|
||||||
## Version en production 0.9.1 devel 0.9.2
|
## Version en production 0.9.1 devel 0.9.2
|
||||||
|
|
||||||
## 0.9.2
|
|
||||||
Correctif Dash SiteWeb config
|
|
||||||
ADD API SondeHub Thank's DL9RDZ
|
|
||||||
|
|
||||||
## 0.9.1
|
## 0.9.1
|
||||||
Corection RS41 <br>
|
Corection RS41 <br>
|
||||||
Correction DFM 06/09 <br>
|
Correction DFM 06/09 <br>
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#include "spiffs_sd.h"
|
#include "spiffs_sd.h"
|
||||||
|
|
||||||
#include <APRS-IS.h>
|
|
||||||
|
|
||||||
int e;
|
int e;
|
||||||
enum MainState { ST_DECODER, ST_SPECTRUM, ST_WIFISCAN, ST_UPDATE, ST_TOUCHCALIB };
|
enum MainState { ST_DECODER, ST_SPECTRUM, ST_WIFISCAN, ST_UPDATE, ST_TOUCHCALIB };
|
||||||
@@ -44,18 +43,12 @@ String *updateBin = &updateBinM;
|
|||||||
|
|
||||||
String updateDataWeb = "/RS/dataweb/data.tar";
|
String updateDataWeb = "/RS/dataweb/data.tar";
|
||||||
|
|
||||||
#define LOCALUDPPORT 14580
|
#define LOCALUDPPORT 9002
|
||||||
|
|
||||||
boolean connected = false;
|
boolean connected = false;
|
||||||
WiFiUDP udp;
|
WiFiUDP udp;
|
||||||
WiFiClient client;
|
WiFiClient client;
|
||||||
|
|
||||||
//SondeHub
|
|
||||||
#define SONDEHUB_STATION_UPDATE_TIME (60*60*1000) // 60 min
|
|
||||||
#define SONDEHUB_MOBILE_STATION_UPDATE_TIME (30*1000) // 30 sec
|
|
||||||
WiFiClient shclient; // Sondehub v2
|
|
||||||
unsigned long time_last_update = 0;
|
|
||||||
|
|
||||||
// KISS over TCP für communicating with APRSdroid
|
// KISS over TCP für communicating with APRSdroid
|
||||||
WiFiServer tncserver(14580);
|
WiFiServer tncserver(14580);
|
||||||
WiFiClient tncclient;
|
WiFiClient tncclient;
|
||||||
@@ -422,7 +415,7 @@ void addSondeStatus(char *ptr, int i)
|
|||||||
s->burstKT, s->launchKT, s->countKT, ((uint16_t)s->frame - s->crefKT));
|
s->burstKT, s->launchKT, s->countKT, ((uint16_t)s->frame - s->crefKT));
|
||||||
}
|
}
|
||||||
sprintf(ptr + strlen(ptr), "<tr><td>");
|
sprintf(ptr + strlen(ptr), "<tr><td>");
|
||||||
sprintf(ptr + strlen(ptr), "<a target=\"_empty\" href=\"https://www.google.fr/maps/dir//%.6f,%.6f\">G-MAPS</a> - ", s->lat, s->lon);
|
sprintf(ptr + strlen(ptr), "<a target=\"_empty\" href=\"https://www.google.fr/maps/dir//%.6f;%.6f\">G-MAPS</a> - ", s->lat, s->lon);
|
||||||
sprintf(ptr + strlen(ptr), "<a target=\"_empty\" href=\"https://tracker.sondehub.org/?sondehub=1#!mt=osm&mz=8&qm=6_hours&mc=%.6f,%.6f&q=RS_%s\">Sondehub</a> - ", s->lat, s->lon, s->id);
|
sprintf(ptr + strlen(ptr), "<a target=\"_empty\" href=\"https://tracker.sondehub.org/?sondehub=1#!mt=osm&mz=8&qm=6_hours&mc=%.6f,%.6f&q=RS_%s\">Sondehub</a> - ", s->lat, s->lon, s->id);
|
||||||
sprintf(ptr + strlen(ptr), "<a target=\"_empty\" href=\"https://www.openstreetmap.org/?mlat=%.6f&mlon=%.6f&zoom=14\">OSM</a> - ", s->lat, s->lon);
|
sprintf(ptr + strlen(ptr), "<a target=\"_empty\" href=\"https://www.openstreetmap.org/?mlat=%.6f&mlon=%.6f&zoom=14\">OSM</a> - ", s->lat, s->lon);
|
||||||
sprintf(ptr + strlen(ptr), "<a target=\"_empty\" href=\"https://www.google.com/maps/search/?api=1&query=%.6f,%.6f\">Google</a></td></tr>", s->lat, s->lon);
|
sprintf(ptr + strlen(ptr), "<a target=\"_empty\" href=\"https://www.google.com/maps/search/?api=1&query=%.6f,%.6f\">Google</a></td></tr>", s->lat, s->lon);
|
||||||
@@ -471,7 +464,7 @@ struct st_configitems config_list[] = {
|
|||||||
|
|
||||||
/* General config settings */
|
/* General config settings */
|
||||||
{"", "Software configuration", -5, NULL},
|
{"", "Software configuration", -5, NULL},
|
||||||
{"wifi", "Wifi mode (0[off]/1[On]/2[Apmode]/3[Scan])", 0, &sonde.config.wifi},
|
{"wifi", "Wifi mode (0/1/2/3)", 0, &sonde.config.wifi},
|
||||||
{"debug", "Debug mode (0/1)", 0, &sonde.config.debug},
|
{"debug", "Debug mode (0/1)", 0, &sonde.config.debug},
|
||||||
{"maxsonde", "Maxsonde", 0, &sonde.config.maxsonde},
|
{"maxsonde", "Maxsonde", 0, &sonde.config.maxsonde},
|
||||||
{"display", "Display screens (scan,default,...)", -6, sonde.config.display},
|
{"display", "Display screens (scan,default,...)", -6, sonde.config.display},
|
||||||
@@ -497,7 +490,7 @@ struct st_configitems config_list[] = {
|
|||||||
{"call", "Call", 8, sonde.config.call},
|
{"call", "Call", 8, sonde.config.call},
|
||||||
{"passcode", "Passcode", 8, sonde.config.passcode},
|
{"passcode", "Passcode", 8, sonde.config.passcode},
|
||||||
/* KISS tnc settings */
|
/* KISS tnc settings */
|
||||||
{"kisstnc.active", "KISS TNC (1 active) (needs reboot)", 0, &sonde.config.kisstnc.active},
|
{"kisstnc.active", "KISS TNC (port 14590) (needs reboot)", 0, &sonde.config.kisstnc.active},
|
||||||
{"kisstnc.idformat", "KISS TNC ID Format", -2, &sonde.config.kisstnc.idformat},
|
{"kisstnc.idformat", "KISS TNC ID Format", -2, &sonde.config.kisstnc.idformat},
|
||||||
/* AXUDP settings */
|
/* AXUDP settings */
|
||||||
{"axudp.active", "AXUDP active", -3, &sonde.config.udpfeed.active},
|
{"axudp.active", "AXUDP active", -3, &sonde.config.udpfeed.active},
|
||||||
@@ -511,17 +504,6 @@ struct st_configitems config_list[] = {
|
|||||||
{"tcp.port", "APRS TCP Port", 0, &sonde.config.tcpfeed.port},
|
{"tcp.port", "APRS TCP Port", 0, &sonde.config.tcpfeed.port},
|
||||||
{"tcp.idformat", "DFM ID Format", -2, &sonde.config.tcpfeed.idformat},
|
{"tcp.idformat", "DFM ID Format", -2, &sonde.config.tcpfeed.idformat},
|
||||||
{"tcp.highrate", "Rate limit", 0, &sonde.config.tcpfeed.highrate},
|
{"tcp.highrate", "Rate limit", 0, &sonde.config.tcpfeed.highrate},
|
||||||
/* Sondehub v2 settings */
|
|
||||||
{"", "Sondehub v2 settings", -5, NULL},
|
|
||||||
{"sondehub.active", "Sondehub reporting active", 0, &sonde.config.sondehub.active},
|
|
||||||
{"sondehub.chase", "Sondehub chase location active", 0, &sonde.config.sondehub.chase},
|
|
||||||
{"sondehub.host", "Sondehub host", 63, &sonde.config.sondehub.host},
|
|
||||||
{"sondehub.callsign", "Callsign", 63, &sonde.config.sondehub.callsign},
|
|
||||||
{"sondehub.lat", "Latitude", 19, &sonde.config.sondehub.lat},
|
|
||||||
{"sondehub.lon", "Longitude", 19, &sonde.config.sondehub.lon},
|
|
||||||
{"sondehub.alt", "Altitude", 19, &sonde.config.sondehub.alt},
|
|
||||||
{"sondehub.antenna", "Antenna", 63, &sonde.config.sondehub.antenna},
|
|
||||||
{"sondehub.email", "Sondehub email", 63, &sonde.config.sondehub.email},
|
|
||||||
/* Hardware dependeing settings */
|
/* Hardware dependeing settings */
|
||||||
{"", "Hardware configuration (requires reboot)", -5, NULL},
|
{"", "Hardware configuration (requires reboot)", -5, NULL},
|
||||||
{"disptype", "Display type (0=OLED/SSD1306, 1=TFT/ILI9225, 2=OLED/SH1106)", 0, &sonde.config.disptype},
|
{"disptype", "Display type (0=OLED/SSD1306, 1=TFT/ILI9225, 2=OLED/SH1106)", 0, &sonde.config.disptype},
|
||||||
@@ -530,7 +512,7 @@ struct st_configitems config_list[] = {
|
|||||||
{"oled_scl", "OLED SCL CLK", 0, &sonde.config.oled_scl},
|
{"oled_scl", "OLED SCL CLK", 0, &sonde.config.oled_scl},
|
||||||
{"oled_rst", "OLED RST (needs reboot)", 0, &sonde.config.oled_rst},
|
{"oled_rst", "OLED RST (needs reboot)", 0, &sonde.config.oled_rst},
|
||||||
{"oled_orient", "Oled orientation default 1, OLED flip: 3", 0, &sonde.config.oled_orient},
|
{"oled_orient", "Oled orientation default 1, OLED flip: 3", 0, &sonde.config.oled_orient},
|
||||||
{"button_pin", "Button input port (38)", -4, &sonde.config.button_pin},
|
{"button_pin", "Button input port", -4, &sonde.config.button_pin},
|
||||||
{"button2_pin", "Button 2 input port", -4, &sonde.config.button2_pin},
|
{"button2_pin", "Button 2 input port", -4, &sonde.config.button2_pin},
|
||||||
{"button2_axp", "Use AXP192 PWR as Button 2", 0, &sonde.config.button2_axp},
|
{"button2_axp", "Use AXP192 PWR as Button 2", 0, &sonde.config.button2_axp},
|
||||||
{"touch_thresh", "Touch button threshold<br>(0 for calib mode)", 0, &sonde.config.touch_thresh},
|
{"touch_thresh", "Touch button threshold<br>(0 for calib mode)", 0, &sonde.config.touch_thresh},
|
||||||
@@ -547,7 +529,7 @@ struct st_configitems config_list[] = {
|
|||||||
{"vbatmin", "VBat Min", 5, sonde.config.vbatmin},
|
{"vbatmin", "VBat Min", 5, sonde.config.vbatmin},
|
||||||
{"telemetryOn", "Telemetry (0=Disabled, 1 Enable)", 0, &sonde.config.telemetryOn},
|
{"telemetryOn", "Telemetry (0=Disabled, 1 Enable)", 0, &sonde.config.telemetryOn},
|
||||||
{"buzzerOn", "Buzzer (0=Disabled, 1 Enable)", 0, &sonde.config.buzzerOn},
|
{"buzzerOn", "Buzzer (0=Disabled, 1 Enable)", 0, &sonde.config.buzzerOn},
|
||||||
{"buzzerPort", "Buzzer Port (25)", 0, &sonde.config.buzzerPort},
|
{"buzzerPort", "Buzzer Port (12)", 0, &sonde.config.buzzerPort},
|
||||||
{"buzzerFreq", "Buzzer Frequency (700)", 0, &sonde.config.buzzerFreq},
|
{"buzzerFreq", "Buzzer Frequency (700)", 0, &sonde.config.buzzerFreq},
|
||||||
{"dbsmetre", "dB = 0 / Smetre =1)", 0, &sonde.config.dbsmetre},
|
{"dbsmetre", "dB = 0 / Smetre =1)", 0, &sonde.config.dbsmetre},
|
||||||
{"degdec", "Lat,Lon Decimal =0 ou Degres =1)", 0, &sonde.config.degdec},
|
{"degdec", "Lat,Lon Decimal =0 ou Degres =1)", 0, &sonde.config.degdec},
|
||||||
@@ -1853,25 +1835,23 @@ void loopDecoder() {
|
|||||||
}
|
}
|
||||||
Serial.printf("current main is %d, current rxtask is %d\n", sonde.currentSonde, rxtask.currentSonde);
|
Serial.printf("current main is %d, current rxtask is %d\n", sonde.currentSonde, rxtask.currentSonde);
|
||||||
}
|
}
|
||||||
|
|
||||||
//APRSIs
|
if (!tncclient.connected()) {
|
||||||
APRS_IS aprs_is(sonde.config.call, sonde.config.passcode, "RadioSonde", version_id);
|
Serial.println("TNC client not connected");
|
||||||
if(!aprs_is.connected())
|
tncclient = tncserver.available();
|
||||||
{
|
if (tncclient.connected()) {
|
||||||
Serial.print("connecting to server: ");
|
Serial.println("new TCP KISS connection");
|
||||||
Serial.print(sonde.config.tcpfeed.host);
|
}
|
||||||
Serial.print(" on port: ");
|
}
|
||||||
Serial.println(sonde.config.tcpfeed.port);
|
if (tncclient.available()) {
|
||||||
if(!aprs_is.connect(sonde.config.tcpfeed.host, sonde.config.tcpfeed.port, "-t/po"))
|
Serial.print("TCP KISS socket: recevied ");
|
||||||
{
|
while (tncclient.available()) {
|
||||||
Serial.println("Connection failed.");
|
Serial.print(tncclient.read()); // Check if we receive anything from from APRSdroid
|
||||||
Serial.println("Waiting 5 seconds before retrying...");
|
}
|
||||||
delay(5000);
|
Serial.println("");
|
||||||
return;
|
}
|
||||||
}
|
// wifi (axudp) or bluetooth (bttnc) active => send packet
|
||||||
Serial.println("Connected to server!");
|
if ((res & 0xff) == 0 && (connected || tncclient.connected() )) {
|
||||||
}
|
|
||||||
if ((res & 0xff) == 0) {
|
|
||||||
//Send a packet with position information
|
//Send a packet with position information
|
||||||
// first check if ID and position lat+lonis ok
|
// first check if ID and position lat+lonis ok
|
||||||
SondeInfo *s = &sonde.sondeList[rxtask.receiveSonde];
|
SondeInfo *s = &sonde.sondeList[rxtask.receiveSonde];
|
||||||
@@ -1886,25 +1866,17 @@ void loopDecoder() {
|
|||||||
udp.write((const uint8_t *)raw, rawlen);
|
udp.write((const uint8_t *)raw, rawlen);
|
||||||
udp.endPacket();
|
udp.endPacket();
|
||||||
}
|
}
|
||||||
if (aprs_is.connected()) {
|
if (tncclient.connected()) {
|
||||||
Serial.println("Sending position via TCP");
|
Serial.println("Sending position via TCP");
|
||||||
char raw[201];
|
char raw[201];
|
||||||
int rawlen = aprsstr_mon2kiss(str, raw, APRS_MAXLEN);
|
int rawlen = aprsstr_mon2kiss(str, raw, APRS_MAXLEN);
|
||||||
Serial.print("sending: "); Serial.println(raw);
|
Serial.print("sending: "); Serial.println(raw);
|
||||||
aprs_is.sendMessage(str);
|
tncclient.write(raw, rawlen);
|
||||||
aprs_is.sendMessage(raw);
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
sondehub_finish_data(&shclient, s, &sonde.config.sondehub);
|
|
||||||
}
|
}
|
||||||
|
// also send to web socket
|
||||||
// Sonde hub
|
//TODO
|
||||||
if (sonde.config.sondehub.active) {
|
}
|
||||||
sondehub_send_data(&shclient, s, &sonde.config.sondehub);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Serial.println("updateDisplay started");
|
Serial.println("updateDisplay started");
|
||||||
if (forceReloadScreenConfig) {
|
if (forceReloadScreenConfig) {
|
||||||
disp.initFromFile();
|
disp.initFromFile();
|
||||||
@@ -1993,26 +1965,15 @@ String translateEncryptionType(wifi_auth_mode_t encryptionType) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
enum t_wifi_state { WIFI_DISABLED, WIFI_SCAN, WIFI_CONNECT, WIFI_CONNECTED, WIFI_APMODE };
|
|
||||||
|
|
||||||
static t_wifi_state wifi_state = WIFI_DISABLED;
|
|
||||||
|
|
||||||
|
|
||||||
void enableNetwork(bool enable) {
|
void enableNetwork(bool enable) {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
MDNS.begin(sonde.config.mdnsname);
|
MDNS.begin(sonde.config.mdnsname);
|
||||||
SetupAsyncServer();
|
SetupAsyncServer();
|
||||||
udp.begin(WiFi.localIP(), LOCALUDPPORT);
|
udp.begin(WiFi.localIP(), LOCALUDPPORT);
|
||||||
MDNS.addService("http", "tcp", 80);
|
MDNS.addService("http", "tcp", 80);
|
||||||
MDNS.addService("kisstnc", "tcp", 14570);
|
|
||||||
if (sonde.config.kisstnc.active) {
|
if (sonde.config.kisstnc.active) {
|
||||||
tncserver.begin();
|
tncserver.begin();
|
||||||
}
|
}
|
||||||
if (sonde.config.sondehub.active && wifi_state != WIFI_APMODE) {
|
|
||||||
sondehub_station_update(&shclient, &sonde.config.sondehub);
|
|
||||||
time_last_update = millis();
|
|
||||||
}
|
|
||||||
connected = true;
|
connected = true;
|
||||||
} else {
|
} else {
|
||||||
MDNS.end();
|
MDNS.end();
|
||||||
@@ -2021,6 +1982,10 @@ void enableNetwork(bool enable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
enum t_wifi_state { WIFI_DISABLED, WIFI_SCAN, WIFI_CONNECT, WIFI_CONNECTED, WIFI_APMODE };
|
||||||
|
|
||||||
|
static t_wifi_state wifi_state = WIFI_DISABLED;
|
||||||
|
|
||||||
// Events used only for debug output right now
|
// Events used only for debug output right now
|
||||||
void WiFiEvent(WiFiEvent_t event)
|
void WiFiEvent(WiFiEvent_t event)
|
||||||
{
|
{
|
||||||
@@ -2646,359 +2611,5 @@ void loop() {
|
|||||||
lastDisplay = currentDisplay;
|
lastDisplay = currentDisplay;
|
||||||
}
|
}
|
||||||
Serial.printf("Unused stack: %d\n", uxTaskGetStackHighWaterMark(0));
|
Serial.printf("Unused stack: %d\n", uxTaskGetStackHighWaterMark(0));
|
||||||
|
//transfert_sd();
|
||||||
//transfert_sd();
|
|
||||||
|
|
||||||
//SondHub
|
|
||||||
if (sonde.config.sondehub.active) {
|
|
||||||
unsigned long time_now = millis();
|
|
||||||
// time_delta will be correct, even if time_now overflows
|
|
||||||
unsigned long time_delta = time_now - time_last_update;
|
|
||||||
if ((sonde.config.sondehub.chase == 0) && (time_delta >= SONDEHUB_STATION_UPDATE_TIME) && (wifi_state != WIFI_APMODE)) { // 60 min
|
|
||||||
sondehub_station_update(&shclient, &sonde.config.sondehub);
|
|
||||||
time_last_update = time_now;
|
|
||||||
}
|
|
||||||
else if ((sonde.config.sondehub.chase == 1) && (time_delta >= SONDEHUB_MOBILE_STATION_UPDATE_TIME) && (wifi_state != WIFI_APMODE)) { // 30 sec
|
|
||||||
sondehub_station_update(&shclient, &sonde.config.sondehub);
|
|
||||||
time_last_update = time_now;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sondehub v2 DB related codes
|
|
||||||
/*
|
|
||||||
Update station data to the sondehub v2 DB
|
|
||||||
*/
|
|
||||||
void sondehub_station_update(WiFiClient *client, struct st_sondehub *conf) {
|
|
||||||
#define STATION_DATA_LEN 300
|
|
||||||
char data[STATION_DATA_LEN];
|
|
||||||
char *w;
|
|
||||||
|
|
||||||
Serial.println("sondehub_station_update()");
|
|
||||||
|
|
||||||
if (!client->connected()) {
|
|
||||||
if (!client->connect(conf->host, 80)) {
|
|
||||||
Serial.println("Connection FAILED");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
w = data;
|
|
||||||
memset(w, 0, STATION_DATA_LEN);
|
|
||||||
|
|
||||||
sprintf(w,
|
|
||||||
"{"
|
|
||||||
"\"software_name\": \"%s\","
|
|
||||||
"\"software_version\": \"%s\","
|
|
||||||
"\"uploader_callsign\": \"%s\","
|
|
||||||
"\"uploader_contact_email\": \"%s\",",
|
|
||||||
version_name, version_id, conf->callsign, conf->email);
|
|
||||||
w += strlen(w);
|
|
||||||
if ((conf->chase == 0) && (conf->lat[0] != '\0') && (conf->lon[0] != '\0')) {
|
|
||||||
if (conf->alt[0] != '\0') {
|
|
||||||
sprintf(w,
|
|
||||||
"\"uploader_position\": [%s,%s,%s],"
|
|
||||||
"\"uploader_antenna\": \"%s\""
|
|
||||||
"}",
|
|
||||||
conf->lat, conf->lon, conf->alt, conf->antenna);
|
|
||||||
} else {
|
|
||||||
sprintf(w,
|
|
||||||
"\"uploader_position\": [%s,%s,null],"
|
|
||||||
"\"uploader_antenna\": \"%s\""
|
|
||||||
"}",
|
|
||||||
conf->lat, conf->lon, conf->antenna);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (sonde.config.gps_Valid && sonde.config.gps_Lat != 0 && sonde.config.gps_Lon != 0) {
|
|
||||||
sprintf(w,
|
|
||||||
"\"uploader_position\": [%.6f,%.6f,%d],"
|
|
||||||
"\"uploader_antenna\": \"%s\","
|
|
||||||
"\"mobile\": true"
|
|
||||||
"}",
|
|
||||||
sonde.config.gps_Lat, sonde.config.gps_Lon, sonde.config.gps_Alt, conf->antenna);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
client->println("PUT /listeners HTTP/1.1");
|
|
||||||
client->print("Host: ");
|
|
||||||
client->println(conf->host);
|
|
||||||
client->println("accept: text/plain");
|
|
||||||
client->println("Content-Type: application/json");
|
|
||||||
client->print("Content-Length: ");
|
|
||||||
client->println(strlen(data));
|
|
||||||
client->println();
|
|
||||||
client->println(data);
|
|
||||||
Serial.println(strlen(data));
|
|
||||||
Serial.println(data);
|
|
||||||
Serial.println("Waiting for response");
|
|
||||||
String response = client->readString();
|
|
||||||
Serial.println(response);
|
|
||||||
Serial.println("Response done...");
|
|
||||||
//client->stop();r
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Update sonde data to the sondehub v2 DB
|
|
||||||
*/
|
|
||||||
enum SHState { SH_DISCONNECTED, SH_CONNECTING, SH_CONN_IDLE, SH_CONN_APPENDING, SH_CONN_WAITACK };
|
|
||||||
|
|
||||||
SHState shState = SH_DISCONNECTED;
|
|
||||||
time_t shStart = 0;
|
|
||||||
|
|
||||||
/* Sonde.h: enum SondeType { STYPE_DFM06, STYPE_DFM09, STYPE_RS41, STYPE_RS92, STYPE_M10, STYPE_M20, STYPE_DFM }; */
|
|
||||||
const char *sondeTypeStrSH[NSondeTypes] = { "DFM", "DFM", "RS41", "RS92", "M10", "M20", "DFM" };
|
|
||||||
const char *dfmSubtypeStrSH[16] = { NULL, NULL, NULL, NULL, NULL, NULL,
|
|
||||||
"DFM06", // 0x06
|
|
||||||
"PS15", // 0x07
|
|
||||||
NULL, NULL,
|
|
||||||
"DFM09", // 0x0A
|
|
||||||
"DFM17", // 0x0B
|
|
||||||
"DFM09P", // 0x0C
|
|
||||||
"DFM17", // 0x0D
|
|
||||||
NULL, NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
// in hours.... max allowed diff UTC <-> sonde time
|
|
||||||
#define SONDEHUB_TIME_THRESHOLD (3)
|
|
||||||
void sondehub_send_data(WiFiClient *client, SondeInfo *s, struct st_sondehub *conf) {
|
|
||||||
Serial.println("sondehub_send_data()");
|
|
||||||
Serial.printf("shState = %d\n", shState);
|
|
||||||
|
|
||||||
// max age of data in JSON request (in seconds)
|
|
||||||
#define SONDEHUB_MAXAGE 15
|
|
||||||
|
|
||||||
#define MSG_SIZE 550
|
|
||||||
char rs_msg[MSG_SIZE];
|
|
||||||
char *w;
|
|
||||||
struct tm ts;
|
|
||||||
// For DFM, s->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
|
|
||||||
time_t t = s->time + s->sec;
|
|
||||||
|
|
||||||
while (client->available() > 0) {
|
|
||||||
// data is available from remote server, process it...
|
|
||||||
int cnt = client->readBytesUntil('\n', rs_msg, MSG_SIZE);
|
|
||||||
rs_msg[cnt] = 0;
|
|
||||||
Serial.println(rs_msg);
|
|
||||||
// If something that looks like a valid HTTP response is received, we are ready to send the next data item
|
|
||||||
if (shState == SH_CONN_WAITACK && cnt > 11 && strncmp(rs_msg, "HTTP/1", 6) == 0) {
|
|
||||||
shState = SH_CONN_IDLE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct tm timeinfo;
|
|
||||||
time_t now;
|
|
||||||
time(&now);
|
|
||||||
gmtime_r(&now, &timeinfo);
|
|
||||||
if (timeinfo.tm_year <= (2016 - 1900)) {
|
|
||||||
Serial.println("Failed to obtain time");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if current sonde data is valid. If not, don't do anything....
|
|
||||||
if (*s->ser == 0) return; // Don't send anything without serial number
|
|
||||||
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 not connected to sondehub, try reconnecting.
|
|
||||||
// TODO: do this outside of main loop
|
|
||||||
if (!client->connected()) {
|
|
||||||
Serial.println("NO CONNECTION");
|
|
||||||
shState = SH_DISCONNECTED;
|
|
||||||
if (!client->connect(conf->host, 80)) {
|
|
||||||
Serial.println("Connection FAILED");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
client->Client::setTimeout(0); // does this work?
|
|
||||||
shState = SH_CONN_IDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( shState == SH_CONN_WAITACK ) {
|
|
||||||
Serial.println("Previous SH-frame not yet ack'ed, not sending new data");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( abs(now - (time_t)s->time) > (3600 * SONDEHUB_TIME_THRESHOLD) ) {
|
|
||||||
Serial.printf("Sonde time %d too far from current UTC time %ld", s->time, now);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// DFM uses UTC. Most of the other radiosondes use GPS time
|
|
||||||
// SondeHub expect datetime to be the same time sytem as the sonde transmits as time stamp
|
|
||||||
if ( s->type == STYPE_RS41 || s->type == STYPE_RS92 || s->type == STYPE_M20 ) {
|
|
||||||
t += 18; // convert back to GPS time from UTC time +18s
|
|
||||||
}
|
|
||||||
|
|
||||||
gmtime_r(&t, &ts);
|
|
||||||
|
|
||||||
memset(rs_msg, 0, MSG_SIZE);
|
|
||||||
w = rs_msg;
|
|
||||||
|
|
||||||
sprintf(w,
|
|
||||||
" {"
|
|
||||||
"\"software_name\": \"%s\","
|
|
||||||
"\"software_version\": \"%s\","
|
|
||||||
"\"uploader_callsign\": \"%s\","
|
|
||||||
"\"time_received\": \"%04d-%02d-%02dT%02d:%02d:%02d.000Z\","
|
|
||||||
"\"manufacturer\": \"%s\","
|
|
||||||
"\"serial\": \"%s\","
|
|
||||||
"\"datetime\": \"%04d-%02d-%02dT%02d:%02d:%02d.000Z\","
|
|
||||||
"\"lat\": %.6f,"
|
|
||||||
"\"lon\": %.6f,"
|
|
||||||
"\"alt\": %.3f,"
|
|
||||||
"\"frequency\": %.3f,"
|
|
||||||
"\"vel_h\": %.3f,"
|
|
||||||
"\"vel_v\": %.3f,"
|
|
||||||
"\"heading\": %.3f,"
|
|
||||||
"\"rssi\": %.1f,",
|
|
||||||
version_name, version_id, conf->callsign,
|
|
||||||
timeinfo.tm_year + 1900, timeinfo.tm_mon + 1, timeinfo.tm_mday, timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec,
|
|
||||||
manufacturer_string[s->type], s->ser,
|
|
||||||
ts.tm_year + 1900, ts.tm_mon + 1, ts.tm_mday, ts.tm_hour, ts.tm_min, ts.tm_sec + s->sec,
|
|
||||||
(float)s->lat, (float)s->lon, (float)s->alt, (float)s->freq, (float)s->hs, (float)s->vs,
|
|
||||||
(float)s->dir, -((float)s->rssi / 2)
|
|
||||||
);
|
|
||||||
w += strlen(w);
|
|
||||||
|
|
||||||
if (s->type != STYPE_M20) {
|
|
||||||
sprintf(w, "\"sats\": %d,", (int)s->sats);
|
|
||||||
w += strlen(w);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( TYPE_IS_DFM(s->type) || TYPE_IS_METEO(s->type) ) {
|
|
||||||
// send frame as gps timestamp for these sonde, identical to autorx
|
|
||||||
// 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.
|
|
||||||
int frame = (int)(t - 315964800);
|
|
||||||
if (s->type == STYPE_M10) {
|
|
||||||
frame += 18;
|
|
||||||
};
|
|
||||||
sprintf(w, "\"frame\": %d,", frame);
|
|
||||||
} else {
|
|
||||||
sprintf(w, "\"frame\": %d,", s->frame);
|
|
||||||
}
|
|
||||||
w += strlen(w);
|
|
||||||
|
|
||||||
sprintf(w, "\"type\": \"%s\",", sondeTypeStrSH[s->type]);
|
|
||||||
w += strlen(w);
|
|
||||||
|
|
||||||
/* if there is a subtype (DFM only) */
|
|
||||||
if ( TYPE_IS_DFM(s->type) && s->subtype > 0 && s->subtype < 16 ) {
|
|
||||||
const char *t = dfmSubtypeStrSH[s->subtype];
|
|
||||||
// as in https://github.com/projecthorus/radiosonde_auto_rx/blob/e680221f69a568e1fdb24e76db679233f32cb027/auto_rx/autorx/sonde_specific.py#L84
|
|
||||||
if (t) sprintf(w, "\"subtype\": \"%s\",", t);
|
|
||||||
else sprintf(w, "\"subtype\": \"DFMx%X\",", s->subtype); // Unknown subtype
|
|
||||||
w += strlen(w);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (((int)s->temperature != 0) && ((int)s->relativeHumidity != 0)) {
|
|
||||||
sprintf(w,
|
|
||||||
"\"temp\": %.1f,"
|
|
||||||
"\"humidity\": %.1f,",
|
|
||||||
float(s->temperature), float(s->relativeHumidity)
|
|
||||||
);
|
|
||||||
w += strlen(w);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((conf->chase == 0) && (conf->lat[0] != '\0') && (conf->lon[0] != '\0')) {
|
|
||||||
if (conf->alt[0] != '\0') {
|
|
||||||
sprintf(w,
|
|
||||||
"\"uploader_position\": [%s,%s,%s],"
|
|
||||||
"\"uploader_antenna\": \"%s\""
|
|
||||||
"}",
|
|
||||||
conf->lat, conf->lon, conf->alt, conf->antenna
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
sprintf(w,
|
|
||||||
"\"uploader_position\": [%s,%s,null],"
|
|
||||||
"\"uploader_antenna\": \"%s\""
|
|
||||||
"}",
|
|
||||||
conf->lat, conf->lon, conf->antenna
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (sonde.config.gps_Valid && sonde.config.gps_Lat != 0 && sonde.config.gps_Lon != 0) {
|
|
||||||
sprintf(w,
|
|
||||||
"\"uploader_position\": [%.6f,%.6f,%d],"
|
|
||||||
"\"uploader_antenna\": \"%s\""
|
|
||||||
"}",
|
|
||||||
sonde.config.gps_Lat, sonde.config.gps_Lon, sonde.config.gps_Alt, conf->antenna
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
sprintf(w,
|
|
||||||
"\"uploader_antenna\": \"%s\""
|
|
||||||
"}",
|
|
||||||
conf->antenna
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (shState != SH_CONN_APPENDING) {
|
|
||||||
sondehub_send_header(client, s, conf);
|
|
||||||
sondehub_send_next(client, s, conf, rs_msg, strlen(rs_msg), 1);
|
|
||||||
shState = SH_CONN_APPENDING;
|
|
||||||
shStart = now;
|
|
||||||
} else {
|
|
||||||
sondehub_send_next(client, s, conf, rs_msg, strlen(rs_msg), 0);
|
|
||||||
}
|
|
||||||
if (now - shStart > SONDEHUB_MAXAGE) { // after MAXAGE seconds
|
|
||||||
sondehub_send_last(client, s, conf);
|
|
||||||
shState = SH_CONN_WAITACK;
|
|
||||||
shStart = 0;
|
|
||||||
}
|
|
||||||
//client->println(rs_msg);
|
|
||||||
//Serial.println(rs_msg);
|
|
||||||
//String response = client->readString();
|
|
||||||
//Serial.println(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
void sondehub_finish_data(WiFiClient *client, SondeInfo *s, struct st_sondehub *conf) {
|
|
||||||
// If there is an "old" pending collection of JSON data sets, send it even if no now data is received
|
|
||||||
if (shState == SH_CONN_APPENDING) {
|
|
||||||
time_t now;
|
|
||||||
time(&now);
|
|
||||||
if (now - shStart > SONDEHUB_MAXAGE + 3) { // after MAXAGE seconds
|
|
||||||
sondehub_send_last(client, s, conf);
|
|
||||||
shState = SH_CONN_WAITACK;
|
|
||||||
shStart = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void sondehub_send_header(WiFiClient *client, SondeInfo *s, struct st_sondehub *conf) {
|
|
||||||
Serial.print("PUT /sondes/telemetry HTTP/1.1\r\n"
|
|
||||||
"Host: ");
|
|
||||||
Serial.println(conf->host);
|
|
||||||
Serial.println("accept: text/plain\r\n"
|
|
||||||
"Content-Type: application/json\r\n"
|
|
||||||
"Transfer-Encoding: chunked\r\n");
|
|
||||||
client->print("PUT /sondes/telemetry HTTP/1.1\r\n"
|
|
||||||
"Host: ");
|
|
||||||
client->println(conf->host);
|
|
||||||
client->println("accept: text/plain\r\n"
|
|
||||||
"Content-Type: application/json\r\n"
|
|
||||||
"Transfer-Encoding: chunked\r\n");
|
|
||||||
}
|
|
||||||
void sondehub_send_next(WiFiClient *client, SondeInfo *s, struct st_sondehub *conf, char *chunk, int chunklen, int first) {
|
|
||||||
// send next chunk of JSON request
|
|
||||||
client->printf("%x\r\n", chunklen + 1);
|
|
||||||
client->write(first ? "[" : ",", 1);
|
|
||||||
client->write(chunk, chunklen);
|
|
||||||
client->print("\r\n");
|
|
||||||
|
|
||||||
Serial.printf("%x\r\n", chunklen + 1);
|
|
||||||
Serial.write(first ? "[" : ",", 1);
|
|
||||||
Serial.write(chunk, chunklen);
|
|
||||||
Serial.print("\r\n");
|
|
||||||
}
|
|
||||||
void sondehub_send_last(WiFiClient *client, SondeInfo *s, struct st_sondehub *conf) {
|
|
||||||
// last chunk. just the closing "]" of the json request
|
|
||||||
client->printf("1\r\n]\r\n0\r\n\r\n");
|
|
||||||
Serial.printf("1\r\n]\r\n0\r\n\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,8 @@
|
|||||||
#oled_rst=16
|
#oled_rst=16
|
||||||
oled_orient=1
|
oled_orient=1
|
||||||
gpsOn=0
|
gpsOn=0
|
||||||
gps_rxd=34
|
gps_rxd=-1
|
||||||
gps_txd=12
|
gps_txd=-1
|
||||||
gps_lat=43.59169
|
gps_lat=43.59169
|
||||||
gps_lon=7.10071
|
gps_lon=7.10071
|
||||||
gps_alt=123
|
gps_alt=123
|
||||||
@@ -54,7 +54,7 @@ vbatmax=1.86
|
|||||||
vbatmin=1.64
|
vbatmin=1.64
|
||||||
telemetryOn=0
|
telemetryOn=0
|
||||||
buzzerOn=0
|
buzzerOn=0
|
||||||
buzzerPort=25
|
buzzerPort=12
|
||||||
buzzerFreq=700
|
buzzerFreq=700
|
||||||
dbsmetre=1
|
dbsmetre=1
|
||||||
gainLNA=0
|
gainLNA=0
|
||||||
@@ -90,7 +90,7 @@ dfm.rxbw=10400
|
|||||||
# local use only, do not feed to public services
|
# local use only, do not feed to public services
|
||||||
# data not sanitized / quality checked, outliers not filtered out
|
# data not sanitized / quality checked, outliers not filtered out
|
||||||
axudp.active=1
|
axudp.active=1
|
||||||
axudp.host=fra1od.freeboxos.fr
|
axudp.host=fra1od.fr.to
|
||||||
axudp.port=20350
|
axudp.port=20350
|
||||||
axudp.symbol=/O
|
axudp.symbol=/O
|
||||||
axudp.highrate=1
|
axudp.highrate=1
|
||||||
@@ -100,24 +100,11 @@ axudp.idformat=0
|
|||||||
#-------------------------------#
|
#-------------------------------#
|
||||||
# currently simply not implemented, no need to put anything here anyway
|
# currently simply not implemented, no need to put anything here anyway
|
||||||
tcp.active=1
|
tcp.active=1
|
||||||
tcp.host=fra1od.freeboxos.fr
|
tcp.host=fra1od.fr.to
|
||||||
tcp.port=14580
|
tcp.port=14580
|
||||||
tcp.symbol=/O
|
tcp.symbol=/O
|
||||||
tcp.highrate=20
|
tcp.highrate=20
|
||||||
tcp.idformat=0
|
tcp.idformat=0
|
||||||
#-------------------------------#
|
#-------------------------------#
|
||||||
# Sondehub v2 settings
|
|
||||||
#-------------------------------#
|
|
||||||
# Sondehub v2 DB settings
|
|
||||||
sondehub.active=0
|
|
||||||
sondehub.chase=0
|
|
||||||
sondehub.host=api.v2.sondehub.org
|
|
||||||
sondehub.callsign=FRS2013
|
|
||||||
sondehub.lat=
|
|
||||||
sondehub.lon=
|
|
||||||
sondehub.alt=
|
|
||||||
sondehub.antenna=CJU 403Mhz
|
|
||||||
sondehub.email=14frs2013@free.fr
|
|
||||||
#-------------------------------#
|
|
||||||
# EOF
|
# EOF
|
||||||
#-------------------------------#
|
#-------------------------------#
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
<br>
|
<br>
|
||||||
Autodetect info: %AUTODETECT_INFO%<br>
|
Autodetect info: %AUTODETECT_INFO%<br>
|
||||||
<br>
|
<br>
|
||||||
CopyLeft 2021 Modifier par <a href="http://openpmr.cla.fr">FRS2013</a> & Vigor<br>
|
CopyLeft 2020 Modifier par <a href="http://openpmr.cla.fr">FRS2013</a> & Vigor<br>
|
||||||
Licence GNU GPL <a href="https://www.gnu.org/licenses/gpl-2.0.txt">https://www.gnu.org/licenses/gpl-2.0.txt</a>
|
Licence GNU GPL <a href="https://www.gnu.org/licenses/gpl-2.0.txt">https://www.gnu.org/licenses/gpl-2.0.txt</a>
|
||||||
for details
|
for details
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
const char *version_name = "RadioSonde";
|
const char *version_name = "RadioSonde";
|
||||||
const char *version_id = "0.9.2";
|
const char *version_id = "0.9.1";
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ extern AXP20X_Class axp;
|
|||||||
extern bool axp192_found;
|
extern bool axp192_found;
|
||||||
extern SemaphoreHandle_t axpSemaphore;
|
extern SemaphoreHandle_t axpSemaphore;
|
||||||
|
|
||||||
|
|
||||||
SPIClass spiDisp(HSPI);
|
SPIClass spiDisp(HSPI);
|
||||||
|
|
||||||
const char *sondeTypeStr[NSondeTypes] = { "DFM6", "DFM9", "RS41", "RS92", "M10 ", "M20 ", "DFM " };
|
const char *sondeTypeStr[NSondeTypes] = { "DFM6", "DFM9", "RS41", "RS92", "M10 ", "M20 ", "DFM " };
|
||||||
@@ -1127,7 +1128,6 @@ static int tmpc=0;
|
|||||||
gpsCourse = lastCourse;
|
gpsCourse = lastCourse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sonde.config.gps_Valid=gpsValid;
|
|
||||||
sonde.config.gps_Lat=gpsLat;
|
sonde.config.gps_Lat=gpsLat;
|
||||||
sonde.config.gps_Lon=gpsLon;
|
sonde.config.gps_Lon=gpsLon;
|
||||||
sonde.config.gps_Alt=gpsAlt;
|
sonde.config.gps_Alt=gpsAlt;
|
||||||
|
|||||||
@@ -20,21 +20,16 @@ const char *evstring[]={"NONE", "KEY1S", "KEY1D", "KEY1M", "KEY1L", "KEY2S", "KE
|
|||||||
|
|
||||||
const char *RXstr[]={"RX_OK", "RX_TIMEOUT", "RX_ERROR", "RX_UNKNOWN"};
|
const char *RXstr[]={"RX_OK", "RX_TIMEOUT", "RX_ERROR", "RX_UNKNOWN"};
|
||||||
|
|
||||||
// Dependency to enum SondeType
|
int fingerprintValue[]={ 17, 31, 64, 4, 55, 48, 23, 128+23, -1 };
|
||||||
const char *manufacturer_string[]={"Graw", "Graw", "Vaisala", "Vaisala", "Meteomodem", "Meteomodem", "Graw"};
|
|
||||||
|
|
||||||
int fingerprintValue[]={ 17, 31, 64, 4, 55, 48, 23, 128+23, 119,128+119, -1 };
|
|
||||||
const char *fingerprintText[]={
|
const char *fingerprintText[]={
|
||||||
"TTGO T-Beam (new version 1.0), I2C not working after powerup, assuming 0.9\" OLED@21,22",
|
"TTGO T-Beam (new version 1.0), I2C not working after powerup, assuming 0.9\" OLED@21,22",
|
||||||
"TTGO LORA32 v2.1_1.6 (0.9\" OLED@21,22)",
|
"TTGO LORA32 v2.1_1.6 (0.9\" OLED@21,22)",
|
||||||
"TTGO LORA v1.0 (0.9\" OLED@4,15)",
|
"TTGO LORA v1.0 (0.9\" OLED@4,15)",
|
||||||
"Heltec v1/v2 (0.9\"OLED@4,15)",
|
"Heltec v1/v2 (0.9\"OLED@4,15)",
|
||||||
"TTGO T-Beam (V0.7), 0.9\" OLED@21,22",
|
"TTGO T-Beam (old version), 0.9\" OLED@21,22",
|
||||||
"TTGO T-Beam (V0.7), SPI TFT@4,21,22",
|
"TTGO T-Beam (old version), SPI TFT@4,21,22",
|
||||||
"TTGO T-Beam (V1.0), 0.9\" OLED@21,22",
|
"TTGO T-Beam (new version 1.0), 0.9\" OLED@21,22",
|
||||||
"TTGO T-Beam (V1.0), SPI TFT@4,13,14",
|
"TTGO T-Beam (new version 1.0), SPI TFT@4,13,14",
|
||||||
"TTGO T-Beam (V1.1), 0.9\" OLED@21,22",
|
|
||||||
"TTGO T-Beam (V1.1), SPI TFT@4,13,14",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int getKeyPressEvent(); /* in RX_FSK.ino */
|
int getKeyPressEvent(); /* in RX_FSK.ino */
|
||||||
@@ -113,7 +108,6 @@ void Sonde::defaultConfig() {
|
|||||||
//config.button2_pin = 255;
|
//config.button2_pin = 255;
|
||||||
config.button2_axp = 1;
|
config.button2_axp = 1;
|
||||||
config.gps_rxd = 34;
|
config.gps_rxd = 34;
|
||||||
config.gps_txd = 12;
|
|
||||||
// Check for I2C-Display@21,22
|
// Check for I2C-Display@21,22
|
||||||
#define SSD1306_ADDRESS 0x3c
|
#define SSD1306_ADDRESS 0x3c
|
||||||
Wire.begin(21, 22);
|
Wire.begin(21, 22);
|
||||||
@@ -352,24 +346,6 @@ void Sonde::setConfig(const char *cfg) {
|
|||||||
config.tcpfeed.highrate = atoi(val);
|
config.tcpfeed.highrate = atoi(val);
|
||||||
} else if(strcmp(cfg,"tcp.idformat")==0) {
|
} else if(strcmp(cfg,"tcp.idformat")==0) {
|
||||||
config.tcpfeed.idformat = atoi(val);
|
config.tcpfeed.idformat = atoi(val);
|
||||||
} else if(strcmp(cfg, "sondehub.active")==0) {
|
|
||||||
config.sondehub.active = atoi(val);
|
|
||||||
} else if(strcmp(cfg,"sondehub.chase")==0) {
|
|
||||||
config.sondehub.chase = atoi(val);
|
|
||||||
} else if(strcmp(cfg, "sondehub.host")==0) {
|
|
||||||
strncpy(config.sondehub.host, val, 63);
|
|
||||||
} else if(strcmp(cfg, "sondehub.callsign")==0) {
|
|
||||||
strncpy(config.sondehub.callsign, val, 63);
|
|
||||||
} else if(strcmp(cfg, "sondehub.lat")==0) {
|
|
||||||
strncpy(config.sondehub.lat, val, 19);
|
|
||||||
} else if(strcmp(cfg, "sondehub.lon")==0) {
|
|
||||||
strncpy(config.sondehub.lon, val, 19);
|
|
||||||
} else if(strcmp(cfg, "sondehub.alt")==0) {
|
|
||||||
strncpy(config.sondehub.alt, val, 19);
|
|
||||||
} else if(strcmp(cfg, "sondehub.antenna")==0) {
|
|
||||||
strncpy(config.sondehub.antenna, val, 63);
|
|
||||||
} else if(strcmp(cfg, "sondehub.email")==0) {
|
|
||||||
strncpy(config.sondehub.email, val, 63);
|
|
||||||
} else {
|
} else {
|
||||||
Serial.printf("Invalid config option '%s'=%s \n", cfg, val);
|
Serial.printf("Invalid config option '%s'=%s \n", cfg, val);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,16 +50,11 @@ extern const char *RXstr[];
|
|||||||
enum SondeType { STYPE_DFM06, STYPE_DFM09, STYPE_RS41, STYPE_RS92, STYPE_M10, STYPE_M20, STYPE_DFM };
|
enum SondeType { STYPE_DFM06, STYPE_DFM09, STYPE_RS41, STYPE_RS92, STYPE_M10, STYPE_M20, STYPE_DFM };
|
||||||
extern const char *sondeTypeStr[NSondeTypes];
|
extern const char *sondeTypeStr[NSondeTypes];
|
||||||
extern const char sondeTypeChar[NSondeTypes];
|
extern const char sondeTypeChar[NSondeTypes];
|
||||||
extern const char *manufacturer_string[NSondeTypes];
|
|
||||||
|
|
||||||
#define TYPE_IS_DFM(t) ( (t)==STYPE_DFM || (t)==STYPE_DFM09 || (t)==STYPE_DFM06 )
|
|
||||||
#define TYPE_IS_METEO(t) ( (t)==STYPE_M10 || (t)==STYPE_M20 )
|
|
||||||
|
|
||||||
typedef struct st_sondeinfo {
|
typedef struct st_sondeinfo {
|
||||||
// receiver configuration
|
// receiver configuration
|
||||||
bool active;
|
bool active;
|
||||||
SondeType type;
|
SondeType type;
|
||||||
int8_t subtype; /* 0 for none/unknown, hex type for dfm, maybe add 1/2 for M10/M20 as well?*/
|
|
||||||
float freq;
|
float freq;
|
||||||
// decoded ID
|
// decoded ID
|
||||||
char typestr[5]; // decoded type (use type if *typestr==0)
|
char typestr[5]; // decoded type (use type if *typestr==0)
|
||||||
@@ -98,11 +93,6 @@ typedef struct st_sondeinfo {
|
|||||||
// shut down timers, currently only for RS41; -1=disabled
|
// shut down timers, currently only for RS41; -1=disabled
|
||||||
int16_t launchKT, burstKT, countKT;
|
int16_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)
|
|
||||||
void *extra;
|
|
||||||
float temperature = -300.0; // platinum resistor temperature
|
|
||||||
float tempRHSensor = -300.0; // temperature of relative humidity sensor
|
|
||||||
float relativeHumidity = -1.0; // relative humidity
|
|
||||||
} SondeInfo;
|
} SondeInfo;
|
||||||
// rxStat: 3=undef[empty] 1=timeout[.] 2=errro[E] 0=ok[|] 4=no valid position[°]
|
// rxStat: 3=undef[empty] 1=timeout[.] 2=errro[E] 0=ok[|] 4=no valid position[°]
|
||||||
|
|
||||||
@@ -161,18 +151,6 @@ struct st_kisstnc {
|
|||||||
int idformat;
|
int idformat;
|
||||||
};
|
};
|
||||||
|
|
||||||
//SondeHub
|
|
||||||
struct st_sondehub {
|
|
||||||
int active;
|
|
||||||
int chase;
|
|
||||||
char host[64];
|
|
||||||
char callsign[64];
|
|
||||||
char lat[20];
|
|
||||||
char lon[20];
|
|
||||||
char alt[20];
|
|
||||||
char antenna[64];
|
|
||||||
char email[64];
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct st_rdzconfig {
|
typedef struct st_rdzconfig {
|
||||||
// hardware configuration
|
// hardware configuration
|
||||||
@@ -194,7 +172,6 @@ typedef struct st_rdzconfig {
|
|||||||
char gps_lon[20]; // QTH no gps longitude
|
char gps_lon[20]; // QTH no gps longitude
|
||||||
int gps_alt; // QTH no gps altitude
|
int gps_alt; // QTH no gps altitude
|
||||||
float gps_Lat,gps_Lon, gps_Alt; // QTH gps OM lat, lon, alt
|
float gps_Lat,gps_Lon, gps_Alt; // QTH gps OM lat, lon, alt
|
||||||
bool gps_Valid;
|
|
||||||
// software configuration
|
// software configuration
|
||||||
int debug; // show port and config options after reboot
|
int debug; // show port and config options after reboot
|
||||||
int wifi; // connect to known WLAN 0=skip
|
int wifi; // connect to known WLAN 0=skip
|
||||||
@@ -230,7 +207,6 @@ typedef struct st_rdzconfig {
|
|||||||
struct st_feedinfo udpfeed; // target for AXUDP messages
|
struct st_feedinfo udpfeed; // target for AXUDP messages
|
||||||
struct st_feedinfo tcpfeed; // target for APRS-IS TCP connections
|
struct st_feedinfo tcpfeed; // target for APRS-IS TCP connections
|
||||||
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_sondehub sondehub;
|
|
||||||
} RDZConfig;
|
} RDZConfig;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user