commit
832fe1d15c
|
|
@ -26,7 +26,8 @@ lib_deps =
|
||||||
Adafruit GFX Library
|
Adafruit GFX Library
|
||||||
Adafruit Unified Sensor
|
Adafruit Unified Sensor
|
||||||
https://github.com/SQ9MDD/AXP202X_Library.git
|
https://github.com/SQ9MDD/AXP202X_Library.git
|
||||||
SparkFun u-blox Arduino Library
|
SparkFun u-blox Arduino Library
|
||||||
|
bblanchon/ArduinoJson
|
||||||
build_flags =
|
build_flags =
|
||||||
-Wl,--gc-sections,--relax
|
-Wl,--gc-sections,--relax
|
||||||
-D 'KISS_PROTOCOL'
|
-D 'KISS_PROTOCOL'
|
||||||
|
|
@ -118,6 +119,7 @@ build_flags =
|
||||||
-D ENABLE_BLUETOOTH
|
-D ENABLE_BLUETOOTH
|
||||||
-D ENABLE_SYSLOG
|
-D ENABLE_SYSLOG
|
||||||
-D 'SYSLOG_IP="192.168.0.102"'
|
-D 'SYSLOG_IP="192.168.0.102"'
|
||||||
|
-D DEVELOPMENT_DEBUG
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${env.lib_deps}
|
${env.lib_deps}
|
||||||
arcao/Syslog
|
arcao/Syslog
|
||||||
|
|
|
||||||
|
|
@ -733,7 +733,7 @@ void setup(){
|
||||||
|
|
||||||
#ifdef ENABLE_WIFI
|
#ifdef ENABLE_WIFI
|
||||||
webServerCfg = {.callsign = Tcall};
|
webServerCfg = {.callsign = Tcall};
|
||||||
xTaskCreate(taskWebServer, "taskWebServer", 42000, (void*)(&webServerCfg), 1, nullptr);
|
xTaskCreate(taskWebServer, "taskWebServer", 12000, (void*)(&webServerCfg), 1, nullptr);
|
||||||
writedisplaytext("LoRa-APRS","","Init:","WiFi task started"," =:-) ","");
|
writedisplaytext("LoRa-APRS","","Init:","WiFi task started"," =:-) ","");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
#include "preference_storage.h"
|
#include "preference_storage.h"
|
||||||
#include "syslog_log.h"
|
#include "syslog_log.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <ArduinoJson.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see board_build.embed_txtfiles in platformio.ini
|
* @see board_build.embed_txtfiles in platformio.ini
|
||||||
*/
|
*/
|
||||||
|
|
@ -15,7 +17,7 @@ extern const char web_js_js_end[] asm("_binary_data_embed_js_js_out_end");
|
||||||
|
|
||||||
QueueHandle_t webListReceivedQueue = nullptr;
|
QueueHandle_t webListReceivedQueue = nullptr;
|
||||||
std::list <tReceivedPacketData*> receivedPackets;
|
std::list <tReceivedPacketData*> receivedPackets;
|
||||||
const int MAX_RECEIVED_LIST_SIZE = 50;
|
const int MAX_RECEIVED_LIST_SIZE = 10;
|
||||||
|
|
||||||
String apSSID = "";
|
String apSSID = "";
|
||||||
String apPassword = "xxxxxxxxxx";
|
String apPassword = "xxxxxxxxxx";
|
||||||
|
|
@ -36,8 +38,12 @@ void sendCacheHeader() { server.sendHeader("Cache-Control", "max-age=3600"); }
|
||||||
void sendGzipHeader() { server.sendHeader("Content-Encoding", "gzip"); }
|
void sendGzipHeader() { server.sendHeader("Content-Encoding", "gzip"); }
|
||||||
|
|
||||||
String jsonEscape(String s){
|
String jsonEscape(String s){
|
||||||
s.replace("\"", "\\\"");
|
s.replace("\\", "\\\\");
|
||||||
s.replace("\\", "\\\\");
|
s.replace("\"", "\\\"");
|
||||||
|
s.replace("\x7f", "\\\x7f");
|
||||||
|
for(char i = 0; i < 0x1f; i++){
|
||||||
|
s.replace(String(i), "\\" + String((char)i));
|
||||||
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -151,24 +157,20 @@ void handle_Cfg() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_ReceivedList() {
|
void handle_ReceivedList() {
|
||||||
String jsonData = "{\"received\": [";
|
DynamicJsonDocument doc(MAX_RECEIVED_LIST_SIZE * 500);
|
||||||
auto count = receivedPackets.size();
|
JsonObject root = doc.to<JsonObject>();
|
||||||
|
auto received = root.createNestedArray("received");
|
||||||
for (auto element: receivedPackets){
|
for (auto element: receivedPackets){
|
||||||
jsonData += "{";
|
|
||||||
char buf[64];
|
char buf[64];
|
||||||
strftime(buf, 64, "%Y.%m.%d %H:%M:%S", &element->rxTime);
|
strftime(buf, 64, "%Y.%m.%d %H:%M:%S", &element->rxTime);
|
||||||
jsonData += jsonLineFromString("time", buf);
|
auto packet_data = received.createNestedObject();
|
||||||
jsonData += jsonLineFromString("packet", element->packet->c_str());
|
packet_data["time"] = String(buf);
|
||||||
jsonData += jsonLineFromInt("rssi", element->RSSI);
|
packet_data["packet"] = element->packet->c_str();
|
||||||
jsonData += jsonLineFromInt("snr", element->SNR, true);
|
packet_data["rssi"] = element->RSSI;
|
||||||
jsonData += "}";
|
packet_data["snr"] = element->SNR / 10.0f;
|
||||||
count--;
|
|
||||||
if (count){
|
|
||||||
jsonData += ",";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
jsonData += "]}";
|
|
||||||
server.send(200,"application/json", jsonData);
|
server.send(200,"application/json", doc.as<String>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_SaveAPRSCfg() {
|
void handle_SaveAPRSCfg() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue