RTC time. Received time on rx list

pull/33/head
Łukasz Nidecki 1 year ago
parent 5ff9a350d2
commit bd6a99373c
  1. 1
      data_embed/index.html
  2. 3
      data_embed/js.js
  3. 1
      include/taskWebServer.h
  4. 1
      src/TTGO_T-Beam_LoRa_APRS.ino
  5. 17
      src/taskWebServer.cpp

@ -167,6 +167,7 @@
<table class="u-full-width">
<thead>
<tr>
<th>Time (UTC)</th>
<th>Frame</th>
<th>RSSI</th>
<th>SNR</th>

@ -47,6 +47,9 @@ window.onload = function () {
tbody.innerHTML = '';
for (const frameInfo of response['received']) {
let tr = document.createElement('tr');
let td_t = document.createElement('td');
td_t.innerHTML = frameInfo['time'];
tr.appendChild(td_t);
let td_p = document.createElement('td');
td_p.innerHTML = frameInfo['packet'];
tr.appendChild(td_p);

@ -16,6 +16,7 @@ typedef struct {
} tWebServerCfg;
typedef struct {
struct tm rxTime;
String *packet;
int RSSI;
int SNR;

@ -441,6 +441,7 @@ void sendToWebList(const String& TNC2FormatedFrame, const int RSSI, const int SN
receivedPacketData->packet->concat(TNC2FormatedFrame);
receivedPacketData->RSSI = RSSI;
receivedPacketData->SNR = SNR;
getLocalTime(&receivedPacketData->rxTime);
if (xQueueSend(webListReceivedQueue, &receivedPacketData, (1000 / portTICK_PERIOD_MS)) != pdPASS){
// remove buffer on error

@ -2,6 +2,7 @@
#include "taskWebServer.h"
#include "preference_storage.h"
#include "syslog_log.h"
#include <time.h>
/**
* @see board_build.embed_txtfiles in platformio.ini
*/
@ -154,6 +155,9 @@ void handle_ReceivedList() {
auto count = receivedPackets.size();
for (auto element: receivedPackets){
jsonData += "{";
char buf[64];
strftime(buf, 64, "%Y.%m.%d %H:%M:%S", &element->rxTime);
jsonData += jsonLineFromString("time", buf);
jsonData += jsonLineFromString("packet", element->packet->c_str());
jsonData += jsonLineFromInt("rssi", element->RSSI);
jsonData += jsonLineFromInt("snr", element->SNR, true);
@ -285,7 +289,17 @@ void handle_saveDeviceCfg(){
syslog.defaultPriority(LOG_KERN);
syslog_log(LOG_INFO, "Connected. IP: " + WiFi.localIP().toString());
#endif
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
}
server.begin();
@ -313,6 +327,7 @@ void handle_saveDeviceCfg(){
receivedPacketToQueue->packet->concat(*receivedPacketData->packet);
receivedPacketToQueue->RSSI = receivedPacketData->RSSI;
receivedPacketToQueue->SNR = receivedPacketData->SNR;
receivedPacketToQueue->rxTime = receivedPacketData->rxTime;
receivedPackets.push_back(receivedPacketToQueue);
if (receivedPackets.size() > MAX_RECEIVED_LIST_SIZE){
auto *packetDataToDelete = receivedPackets.front();

Loading…
Cancel
Save