sync w/ DL2MF: publish uptime (partially)
This commit is contained in:
parent
ca976d7a01
commit
ef82ae9da2
|
|
@ -108,7 +108,7 @@ extern float calcLatLonDist(float lat1, float lon1, float lat2, float lon2);
|
|||
// KISS over TCP for communicating with APRSdroid
|
||||
WiFiServer tncserver(14580);
|
||||
WiFiClient tncclient;
|
||||
// JSON over TCP for communicating with my kotlin andoird test stuff
|
||||
// JSON over TCP for communicating with the rdzSonde (rdzwx-go) Android app
|
||||
WiFiServer rdzserver(14570);
|
||||
WiFiClient rdzclient;
|
||||
// APRS over TCP for radiosondy.info etc
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ function prep() {
|
|||
function qrgTable() {
|
||||
var tab=document.getElementById("divTable");
|
||||
|
||||
var table = "<table><tr><th>ID</th><th>Active</th><th>Freq</th><th>Launchsite</th><th>Mode</th></tr>";
|
||||
var table = "<table><tr><th>Ch</th><th>Active</th><th>Frequency</th><th>Launchsite</th><th>Decoder</th></tr>";
|
||||
for(i=0; i<qrgs.length; i++) {
|
||||
var ck = "";
|
||||
if(qrgs[i][0]) ck="checked";
|
||||
|
|
|
|||
|
|
@ -6,11 +6,17 @@
|
|||
#include "RS41.h"
|
||||
#include "json.h"
|
||||
|
||||
TimerHandle_t mqttReconnectTimer;
|
||||
|
||||
extern const int SPIFFS_MAJOR;
|
||||
extern const int SPIFFS_MINOR;
|
||||
extern const char *version_name;
|
||||
extern const char *version_id;
|
||||
|
||||
const int MQTT_VER = SPIFFS_MAJOR;
|
||||
const int MQTT_SUB = SPIFFS_MINOR;
|
||||
|
||||
TimerHandle_t mqttReconnectTimer;
|
||||
|
||||
void mqttCallback(char* topic, byte* payload, unsigned int length) {
|
||||
Serial.print("Message arrived [");
|
||||
Serial.print(topic);
|
||||
|
|
@ -51,12 +57,13 @@ void MQTT::publishUptime()
|
|||
mqttClient.connect(); // ensure we've got connection
|
||||
|
||||
Serial.println("[MQTT] writing");
|
||||
//char payload[128];
|
||||
//snprintf(payload, 12, "%lu", millis());
|
||||
//snprintf(payload, 124, "{\"uptime\": %lu," "\"user\": \"%s\"", millis(), username );
|
||||
char payload[128];
|
||||
snprintf(payload, 128, "{\"uptime\": %ld, \"user\": \"%s\", \"rxlat\": %.5f, \"rxlon\": %.5f, \"ver\": \"%s\", \"sub\": \"%s\"}",
|
||||
millis(), username, sonde.config.rxlat, sonde.config.rxlon, version_name, version_id);
|
||||
char payload[256];
|
||||
// maybe TODO: Use dynamic position if GPS is available?
|
||||
// rxlat, rxlon only if not empty
|
||||
snprintf(payload, 256, "{\"uptime\": %lu, \"user\": \"%s\", ", millis(), username);
|
||||
if( !isnan(sonde.config.rxlat) && !isnan(sonde.config.rxlon) ) {
|
||||
snprintf(payload, 256, "%s\"rxlat\": %.5f, \"rxlon\": %.5f, ", payload, sonde.config.rxlat, sonde.config.rxlon);
|
||||
snprintf(payload, 256, "%s\"sw\": \"%s\", \"ver\": \"%s\"}", version_name, version_id);
|
||||
Serial.println(payload);
|
||||
char topic[128];
|
||||
snprintf(topic, 128, "%s%s", this->prefix, "uptime");
|
||||
|
|
|
|||
Loading…
Reference in New Issue