TTGO-T-Beam-LoRa-APRS/src/taskWebServer.cpp

423 wiersze
17 KiB
C++
Czysty Zwykły widok Historia

#include <list>
2021-02-18 16:59:18 +00:00
#include "taskWebServer.h"
#include "preference_storage.h"
#include "syslog_log.h"
2021-06-14 15:46:14 +00:00
#include "PSRAMJsonDocument.h"
2021-04-26 12:45:29 +00:00
#include <time.h>
#include <ArduinoJson.h>
2021-02-18 16:59:18 +00:00
/**
* @see board_build.embed_txtfiles in platformio.ini
*/
extern const char web_index_html[] asm("_binary_data_embed_index_html_out_start");
extern const char web_index_html_end[] asm("_binary_data_embed_index_html_out_end");
extern const char web_style_css[] asm("_binary_data_embed_style_css_out_start");
extern const char web_style_css_end[] asm("_binary_data_embed_style_css_out_end");
extern const char web_js_js[] asm("_binary_data_embed_js_js_out_start");
extern const char web_js_js_end[] asm("_binary_data_embed_js_js_out_end");
QueueHandle_t webListReceivedQueue = nullptr;
std::list <tReceivedPacketData*> receivedPackets;
2021-06-14 15:46:14 +00:00
const int MAX_RECEIVED_LIST_SIZE = 50;
2021-02-18 16:59:18 +00:00
String apSSID = "";
String apPassword = "xxxxxxxxxx";
WebServer server(80);
2021-02-18 18:34:42 +00:00
#ifdef KISS_PROTOCOL
WiFiServer tncServer(NETWORK_TNC_PORT);
#endif
WiFiServer gpsServer(NETWORK_GPS_PORT);
2021-02-18 16:59:18 +00:00
#ifdef ENABLE_SYSLOG
// A UDP instance to let us send and receive packets over UDP
WiFiUDP udpClient;
// Create a new empty syslog instance
Syslog syslog(udpClient, SYSLOG_PROTO_IETF);
#endif
2021-06-14 15:34:34 +00:00
#ifdef T_BEAM_V1_0
#include <axp20x.h>
extern AXP20X_Class axp;
#endif
2021-02-18 16:59:18 +00:00
void sendCacheHeader() { server.sendHeader("Cache-Control", "max-age=3600"); }
void sendGzipHeader() { server.sendHeader("Content-Encoding", "gzip"); }
String jsonEscape(String s){
2021-06-04 18:33:03 +00:00
s.replace("\\", "\\\\");
s.replace("\"", "\\\"");
2021-06-04 18:59:05 +00:00
s.replace("\x7f", "\\\x7f");
for(char i = 0; i < 0x1f; i++){
s.replace(String(i), "\\" + String((char)i));
}
2021-02-18 16:59:18 +00:00
return s;
}
String jsonLineFromPreferenceString(const char *preferenceName, bool last=false){
return String("\"") + preferenceName + "\":\"" + jsonEscape(preferences.getString(preferenceName)) + (last ? + R"(")" : + R"(",)");
}
String jsonLineFromPreferenceBool(const char *preferenceName, bool last=false){
return String("\"") + preferenceName + "\":" + (preferences.getBool(preferenceName) ? "true" : "false") + (last ? + R"()" : + R"(,)");
}
String jsonLineFromPreferenceInt(const char *preferenceName, bool last=false){
return String("\"") + preferenceName + "\":" + (preferences.getInt(preferenceName)) + (last ? + R"()" : + R"(,)");
}
String jsonLineFromPreferenceDouble(const char *preferenceName, bool last=false){
return String("\"") + preferenceName + "\":" + String(preferences.getDouble(preferenceName),3) + (last ? + R"()" : + R"(,)");
}
2021-02-18 19:45:40 +00:00
String jsonLineFromString(const char *name, const char *value, bool last=false){
return String("\"") + name + "\":\"" + jsonEscape(value) + "\"" + (last ? + R"()" : + R"(,)");
}
String jsonLineFromInt(const char *name, const int value, bool last=false){
return String("\"") + name + "\":" + String(value) + (last ? + R"()" : + R"(,)");
2021-02-18 19:45:40 +00:00
}
2021-02-18 16:59:18 +00:00
void handle_NotFound(){
sendCacheHeader();
server.send(404, "text/plain", "Not found");
}
void handle_Index() {
sendGzipHeader();
server.send_P(200, "text/html", web_index_html, web_index_html_end - web_index_html);
}
void handle_Style() {
sendCacheHeader();
sendGzipHeader();
server.send_P(200, "text/css", web_style_css, web_style_css_end - web_style_css);
}
void handle_Js() {
sendCacheHeader();
sendGzipHeader();
server.send_P(200, "text/javascript", web_js_js, web_js_js_end-web_js_js);
}
void handle_ScanWifi() {
String listResponse = R"(<label for="networks_found_list">Networks found:</label><select class="u-full-width" id="networks_found_list">)";
int n = WiFi.scanNetworks();
listResponse += "<option value=\"\">Select Network</option>";
for (int i = 0; i < n; ++i) {
listResponse += "<option value=\""+WiFi.SSID(i)+"\">" + WiFi.SSID(i) + "</option>";
}
listResponse += "</select>";
server.send(200,"text/html", listResponse);
}
void handle_SaveWifiCfg() {
if (!server.hasArg(PREF_WIFI_SSID) || !server.hasArg(PREF_WIFI_PASSWORD)){
2021-02-18 16:59:18 +00:00
server.send(500, "text/plain", "Invalid request");
}
if (!server.arg(PREF_WIFI_SSID).length()){
2021-02-18 16:59:18 +00:00
server.send(403, "text/plain", "Empty SSID or Password");
}
preferences.putString(PREF_WIFI_SSID, server.arg(PREF_WIFI_SSID));
preferences.putString(PREF_WIFI_PASSWORD, server.arg(PREF_WIFI_PASSWORD));
2021-02-18 16:59:18 +00:00
server.sendHeader("Location", "/");
server.send(302,"text/html", "");
}
void handle_Reboot() {
server.sendHeader("Location", "/");
server.send(302,"text/html", "");
2021-06-14 15:34:34 +00:00
server.close();
2021-02-18 16:59:18 +00:00
ESP.restart();
}
2021-06-14 15:34:34 +00:00
void handle_Shutdown() {
#ifdef T_BEAM_V1_0
2021-06-14 15:46:14 +00:00
server.send(200,"text/html", "Shutdown");
2021-06-14 15:34:34 +00:00
axp.shutdown();
#else
2021-06-14 15:46:14 +00:00
server.send(404,"text/html", "Not supported");
2021-06-14 15:34:34 +00:00
#endif
}
2021-02-18 16:59:18 +00:00
void handle_Restore() {
server.sendHeader("Location", "/");
server.send(302,"text/html", "");
preferences.clear();
preferences.end();
ESP.restart();
}
void handle_Cfg() {
String jsonData = "{";
jsonData += String("\"") + PREF_WIFI_PASSWORD + "\": \"" + jsonEscape((preferences.getString(PREF_WIFI_PASSWORD).isEmpty() ? String("") : "*")) + R"(",)";
jsonData += jsonLineFromPreferenceString(PREF_WIFI_SSID);
jsonData += jsonLineFromPreferenceDouble(PREF_LORA_FREQ_PRESET);
jsonData += jsonLineFromPreferenceInt(PREF_LORA_SPEED_PRESET);
2021-02-18 16:59:18 +00:00
jsonData += jsonLineFromPreferenceString(PREF_APRS_CALLSIGN);
jsonData += jsonLineFromPreferenceString(PREF_APRS_RELAY_PATH);
jsonData += jsonLineFromPreferenceString(PREF_APRS_SYMBOL_TABLE);
jsonData += jsonLineFromPreferenceString(PREF_APRS_SYMBOL);
jsonData += jsonLineFromPreferenceString(PREF_APRS_COMMENT);
jsonData += jsonLineFromPreferenceString(PREF_APRS_LATITUDE_PRESET);
jsonData += jsonLineFromPreferenceString(PREF_APRS_LONGITUDE_PRESET);
jsonData += jsonLineFromPreferenceInt(PREF_APRS_FIXED_BEACON_INTERVAL_PRESET);
2021-07-11 09:54:11 +00:00
jsonData += jsonLineFromPreferenceInt(PREF_APRS_SB_MIN_INTERVAL_PRESET);
jsonData += jsonLineFromPreferenceInt(PREF_APRS_SB_MAX_INTERVAL_PRESET);
jsonData += jsonLineFromPreferenceInt(PREF_APRS_SB_MIN_SPEED_PRESET);
jsonData += jsonLineFromPreferenceInt(PREF_APRS_SB_MAX_SPEED_PRESET);
jsonData += jsonLineFromPreferenceDouble(PREF_APRS_SB_ANGLE_PRESET);
2021-02-18 16:59:18 +00:00
jsonData += jsonLineFromPreferenceBool(PREF_APRS_SHOW_BATTERY);
jsonData += jsonLineFromPreferenceBool(PREF_APRS_FIXED_BEACON_PRESET);
2021-02-18 19:45:40 +00:00
jsonData += jsonLineFromPreferenceBool(PREF_APRS_SHOW_ALTITUDE);
2021-03-08 17:55:52 +00:00
jsonData += jsonLineFromPreferenceBool(PREF_APRS_GPS_EN);
jsonData += jsonLineFromPreferenceBool(PREF_ENABLE_TNC_SELF_TELEMETRY);
2021-03-08 22:59:33 +00:00
jsonData += jsonLineFromPreferenceBool(PREF_DEV_OL_EN);
jsonData += jsonLineFromPreferenceBool(PREF_APRS_SHOW_CMT);
2021-03-08 21:47:00 +00:00
jsonData += jsonLineFromPreferenceBool(PREF_DEV_BT_EN);
2021-03-09 09:45:15 +00:00
jsonData += jsonLineFromPreferenceInt(PREF_DEV_SHOW_RX_TIME);
2021-03-13 12:50:04 +00:00
jsonData += jsonLineFromPreferenceBool(PREF_DEV_AUTO_SHUT);
jsonData += jsonLineFromPreferenceInt(PREF_DEV_AUTO_SHUT_PRESET);
jsonData += jsonLineFromInt("FreeHeap", ESP.getFreeHeap());
jsonData += jsonLineFromInt("HeapSize", ESP.getHeapSize());
2021-06-14 15:46:14 +00:00
jsonData += jsonLineFromInt("FreeSketchSpace", ESP.getFreeSketchSpace());
jsonData += jsonLineFromInt("PSRAMSize", ESP.getPsramSize());
jsonData += jsonLineFromInt("PSRAMFree", ESP.getFreePsram(), true);
2021-02-18 19:45:40 +00:00
2021-02-18 16:59:18 +00:00
jsonData += "}";
server.send(200,"application/json", jsonData);
}
void handle_ReceivedList() {
2021-06-14 15:46:14 +00:00
PSRAMJsonDocument doc(MAX_RECEIVED_LIST_SIZE * 1000);
JsonObject root = doc.to<JsonObject>();
auto received = root.createNestedArray("received");
for (auto element: receivedPackets){
2021-04-26 12:45:29 +00:00
char buf[64];
strftime(buf, 64, "%Y.%m.%d %H:%M:%S", &element->rxTime);
auto packet_data = received.createNestedObject();
packet_data["time"] = String(buf);
packet_data["packet"] = element->packet->c_str();
packet_data["rssi"] = element->RSSI;
packet_data["snr"] = element->SNR / 10.0f;
}
server.send(200,"application/json", doc.as<String>());
}
2021-02-18 16:59:18 +00:00
void handle_SaveAPRSCfg() {
// LoRa settings
if (server.hasArg(PREF_LORA_FREQ_PRESET)){
preferences.putDouble(PREF_LORA_FREQ_PRESET, server.arg(PREF_LORA_FREQ_PRESET).toDouble());
Serial.printf("FREQ saved:\t%f\n", server.arg(PREF_LORA_FREQ_PRESET).toDouble());
}
if (server.hasArg(PREF_LORA_SPEED_PRESET)){
preferences.putInt(PREF_LORA_SPEED_PRESET, server.arg(PREF_LORA_SPEED_PRESET).toInt());
}
// APRS station settings
2021-02-18 16:59:18 +00:00
if (server.hasArg(PREF_APRS_CALLSIGN) && !server.arg(PREF_APRS_CALLSIGN).isEmpty()){
preferences.putString(PREF_APRS_CALLSIGN, server.arg(PREF_APRS_CALLSIGN));
}
if (server.hasArg(PREF_APRS_SYMBOL_TABLE) && !server.arg(PREF_APRS_SYMBOL_TABLE).isEmpty()){
preferences.putString(PREF_APRS_SYMBOL_TABLE, server.arg(PREF_APRS_SYMBOL_TABLE));
}
if (server.hasArg(PREF_APRS_SYMBOL) && !server.arg(PREF_APRS_SYMBOL).isEmpty()){
preferences.putString(PREF_APRS_SYMBOL, server.arg(PREF_APRS_SYMBOL));
}
if (server.hasArg(PREF_APRS_RELAY_PATH)){
preferences.putString(PREF_APRS_RELAY_PATH, server.arg(PREF_APRS_RELAY_PATH));
}
if (server.hasArg(PREF_APRS_COMMENT)){
preferences.putString(PREF_APRS_COMMENT, server.arg(PREF_APRS_COMMENT));
}
if (server.hasArg(PREF_APRS_LATITUDE_PRESET)){
preferences.putString(PREF_APRS_LATITUDE_PRESET, server.arg(PREF_APRS_LATITUDE_PRESET));
}
if (server.hasArg(PREF_APRS_LONGITUDE_PRESET)){
preferences.putString(PREF_APRS_LONGITUDE_PRESET, server.arg(PREF_APRS_LONGITUDE_PRESET));
}
// Smart Beaconing settings
2021-02-18 16:59:18 +00:00
if (server.hasArg(PREF_APRS_FIXED_BEACON_INTERVAL_PRESET)){
preferences.putInt(PREF_APRS_FIXED_BEACON_INTERVAL_PRESET, server.arg(PREF_APRS_FIXED_BEACON_INTERVAL_PRESET).toInt());
}
2021-07-11 09:54:11 +00:00
if (server.hasArg(PREF_APRS_SB_MIN_INTERVAL_PRESET)){
preferences.putInt(PREF_APRS_SB_MIN_INTERVAL_PRESET, server.arg(PREF_APRS_SB_MIN_INTERVAL_PRESET).toInt());
}
if (server.hasArg(PREF_APRS_SB_MAX_INTERVAL_PRESET)){
preferences.putInt(PREF_APRS_SB_MAX_INTERVAL_PRESET, server.arg(PREF_APRS_SB_MAX_INTERVAL_PRESET).toInt());
}
if (server.hasArg(PREF_APRS_SB_MIN_SPEED_PRESET)){
preferences.putInt(PREF_APRS_SB_MIN_SPEED_PRESET, server.arg(PREF_APRS_SB_MIN_SPEED_PRESET).toInt());
}
if (server.hasArg(PREF_APRS_SB_MAX_SPEED_PRESET)){
preferences.putInt(PREF_APRS_SB_MAX_SPEED_PRESET, server.arg(PREF_APRS_SB_MAX_SPEED_PRESET).toInt());
}
if (server.hasArg(PREF_APRS_SB_ANGLE_PRESET)){
preferences.putDouble(PREF_APRS_SB_ANGLE_PRESET, server.arg(PREF_APRS_SB_ANGLE_PRESET).toDouble());
2021-02-18 16:59:18 +00:00
}
2021-03-09 09:45:15 +00:00
2021-02-18 16:59:18 +00:00
preferences.putBool(PREF_APRS_SHOW_BATTERY, server.hasArg(PREF_APRS_SHOW_BATTERY));
preferences.putBool(PREF_ENABLE_TNC_SELF_TELEMETRY, server.hasArg(PREF_ENABLE_TNC_SELF_TELEMETRY));
2021-02-18 16:59:18 +00:00
preferences.putBool(PREF_APRS_SHOW_ALTITUDE, server.hasArg(PREF_APRS_SHOW_ALTITUDE));
preferences.putBool(PREF_APRS_FIXED_BEACON_PRESET, server.hasArg(PREF_APRS_FIXED_BEACON_PRESET));
2021-03-08 17:55:52 +00:00
preferences.putBool(PREF_APRS_GPS_EN, server.hasArg(PREF_APRS_GPS_EN));
2021-03-08 22:59:33 +00:00
preferences.putBool(PREF_APRS_SHOW_CMT, server.hasArg(PREF_APRS_SHOW_CMT));
2021-02-18 16:59:18 +00:00
server.sendHeader("Location", "/");
server.send(302,"text/html", "");
2021-03-08 21:47:00 +00:00
}
2021-02-18 16:59:18 +00:00
2021-03-08 21:47:00 +00:00
void handle_saveDeviceCfg(){
preferences.putBool(PREF_DEV_BT_EN, server.hasArg(PREF_DEV_BT_EN));
2021-03-08 22:59:33 +00:00
preferences.putBool(PREF_DEV_OL_EN, server.hasArg(PREF_DEV_OL_EN));
2021-03-09 09:45:15 +00:00
if (server.hasArg(PREF_DEV_SHOW_RX_TIME)){
preferences.putInt(PREF_DEV_SHOW_RX_TIME, server.arg(PREF_DEV_SHOW_RX_TIME).toInt());
}
2021-03-13 12:50:04 +00:00
preferences.putBool(PREF_DEV_AUTO_SHUT, server.hasArg(PREF_DEV_AUTO_SHUT));
if (server.hasArg(PREF_DEV_AUTO_SHUT_PRESET)){
preferences.putInt(PREF_DEV_AUTO_SHUT_PRESET, server.arg(PREF_DEV_AUTO_SHUT_PRESET).toInt());
}
2021-03-08 21:47:00 +00:00
server.sendHeader("Location", "/");
server.send(302,"text/html", "");
2021-02-18 16:59:18 +00:00
}
[[noreturn]] void taskWebServer(void *parameter) {
auto *webServerCfg = (tWebServerCfg*)parameter;
apSSID = webServerCfg->callsign + " AP";
server.on("/", handle_Index);
server.on("/favicon.ico", handle_NotFound);
server.on("/style.css", handle_Style);
server.on("/js.js", handle_Js);
server.on("/scan_wifi", handle_ScanWifi);
server.on("/save_wifi_cfg", handle_SaveWifiCfg);
server.on("/reboot", handle_Reboot);
2021-06-14 15:34:34 +00:00
server.on("/shutdown", handle_Shutdown);
2021-02-18 16:59:18 +00:00
server.on("/cfg", handle_Cfg);
server.on("/received_list", handle_ReceivedList);
2021-02-18 16:59:18 +00:00
server.on("/save_aprs_cfg", handle_SaveAPRSCfg);
2021-03-08 21:47:00 +00:00
server.on("/save_device_cfg", handle_saveDeviceCfg);
2021-02-18 16:59:18 +00:00
server.on("/restore", handle_Restore);
2021-03-01 13:47:34 +00:00
server.on("/update", HTTP_POST, []() {
2021-08-21 20:00:06 +00:00
syslog_log(LOG_WARNING, String("Update finished. Status: ") + (!Update.hasError() ? "Ok" : "Error"));
2021-03-01 13:47:34 +00:00
server.sendHeader("Connection", "close");
server.send(200, "text/plain", (Update.hasError()) ? "FAIL" : "OK");
delay(500);
2021-03-01 13:47:34 +00:00
ESP.restart();
}, []() {
HTTPUpload& upload = server.upload();
if (upload.status == UPLOAD_FILE_START) {
2021-06-10 22:52:49 +00:00
rf95.sleep(); // disable rf95 before update
2021-03-01 13:47:34 +00:00
Serial.printf("Update: %s\n", upload.filename.c_str());
if (!Update.begin(UPDATE_SIZE_UNKNOWN)) { //start with max available size
syslog_log(LOG_ERR, String("Update begin error: ") + Update.errorString());
2021-03-01 13:47:34 +00:00
Update.printError(Serial);
}
} else if (upload.status == UPLOAD_FILE_WRITE) {
/* flashing firmware to ESP*/
if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) {
syslog_log(LOG_ERR, String("Update error: ") + Update.errorString());
2021-03-01 13:47:34 +00:00
Update.printError(Serial);
}
} else if (upload.status == UPLOAD_FILE_END) {
if (Update.end(true)) { //true to set the size to the current progress
Serial.printf("Update Success: %u\nRebooting...\n", upload.totalSize);
syslog_log(LOG_WARNING, String("Update Success: ") + String((int)upload.totalSize));
2021-03-01 13:47:34 +00:00
} else {
syslog_log(LOG_ERR, String("Update error: ") + Update.errorString());
2021-03-01 13:47:34 +00:00
Update.printError(Serial);
}
}
});
2021-02-18 16:59:18 +00:00
server.onNotFound(handle_NotFound);
String wifi_password = preferences.getString(PREF_WIFI_PASSWORD);
String wifi_ssid = preferences.getString(PREF_WIFI_SSID);
if (!wifi_ssid.length()){
2021-02-18 16:59:18 +00:00
WiFi.softAP(apSSID.c_str(), apPassword.c_str());
} else {
int retryWifi = 0;
WiFi.begin(wifi_ssid.c_str(), wifi_password.length() ? wifi_password.c_str() : nullptr);
2021-02-18 20:22:45 +00:00
Serial.println("Connecting to " + wifi_ssid);
2021-02-18 16:59:18 +00:00
while (WiFi.status() != WL_CONNECTED) {
2021-02-22 21:20:43 +00:00
Serial.print("Not connected: ");
Serial.println((int)WiFi.status());
Serial.print("Retry: ");
Serial.println(retryWifi);
2021-02-18 16:59:18 +00:00
vTaskDelay(500/portTICK_PERIOD_MS);
retryWifi += 1;
if (retryWifi > 60) {
WiFi.softAP(apSSID.c_str(), apPassword.c_str());
Serial.println("Unable to connect to to wifi. Starting AP");
break;
}
2021-02-18 16:59:18 +00:00
}
if (WiFi.getMode() == wifi_mode_t::WIFI_MODE_AP){
Serial.println("Running AP. IP: " + WiFi.softAPIP().toString());
} else {
Serial.println("Connected. IP: " + WiFi.localIP().toString());
}
#ifdef ENABLE_SYSLOG
syslog.server(SYSLOG_IP, 514);
syslog.deviceHostname(webServerCfg->callsign.c_str());
syslog.appName("TTGO");
syslog.defaultPriority(LOG_KERN);
syslog_log(LOG_INFO, "Connected. IP: " + WiFi.localIP().toString());
#endif
2021-04-26 12:45:29 +00:00
configTime(0, 0, "pool.ntp.org");
#ifdef ENABLE_SYSLOG
struct tm timeinfo{};
if(!getLocalTime(&timeinfo)){
syslog_log(LOG_WARNING, "Failed to obtain time");
} else {
char buf[64];
strftime(buf, 64, "%A, %B %d %Y %H:%M:%S", &timeinfo);
syslog_log(LOG_INFO, String("Time: ") + String(buf));
}
#endif
2021-02-18 16:59:18 +00:00
}
server.begin();
2021-02-18 18:34:42 +00:00
#ifdef KISS_PROTOCOL
tncServer.begin();
#endif
gpsServer.begin();
2021-02-18 16:59:18 +00:00
if (MDNS.begin(webServerCfg->callsign.c_str())) {
2021-02-18 20:22:45 +00:00
MDNS.setInstanceName(webServerCfg->callsign + " TTGO LoRa APRS TNC " + TXFREQ + "MHz");
2021-02-18 16:59:18 +00:00
MDNS.addService("http", "tcp", 80);
2021-02-18 18:34:42 +00:00
#ifdef KISS_PROTOCOL
MDNS.addService("kiss-tnc", "tcp", NETWORK_TNC_PORT);
#endif
2021-02-18 16:59:18 +00:00
}
webListReceivedQueue = xQueueCreate(4,sizeof(tReceivedPacketData *));
tReceivedPacketData *receivedPacketData = nullptr;
2021-02-18 16:59:18 +00:00
while (true){
server.handleClient();
if (xQueueReceive(webListReceivedQueue, &receivedPacketData, (1 / portTICK_PERIOD_MS)) == pdPASS) {
auto *receivedPacketToQueue = new tReceivedPacketData();
receivedPacketToQueue->packet = new String();
receivedPacketToQueue->packet->concat(*receivedPacketData->packet);
receivedPacketToQueue->RSSI = receivedPacketData->RSSI;
receivedPacketToQueue->SNR = receivedPacketData->SNR;
2021-04-26 12:45:29 +00:00
receivedPacketToQueue->rxTime = receivedPacketData->rxTime;
receivedPackets.push_back(receivedPacketToQueue);
if (receivedPackets.size() > MAX_RECEIVED_LIST_SIZE){
auto *packetDataToDelete = receivedPackets.front();
delete packetDataToDelete->packet;
delete packetDataToDelete;
receivedPackets.pop_front();
}
delete receivedPacketData->packet;
delete receivedPacketData;
}
2021-02-18 16:59:18 +00:00
vTaskDelay(5/portTICK_PERIOD_MS);
}
}