esp32 compiling version

This commit is contained in:
Dmitry Borisenko
2020-11-03 22:45:43 +03:00
parent 9845f010fd
commit 8817c532f4
3 changed files with 10 additions and 4 deletions

View File

@@ -1,7 +1,9 @@
#pragma once #pragma once
#ifdef ESP8266
#include "ESPAsyncUDP.h" #include "ESPAsyncUDP.h"
extern AsyncUDP asyncUdp; extern AsyncUDP asyncUdp;
extern void asyncUdpInit(); extern void asyncUdpInit();
extern String uint8tToString(uint8_t* data, size_t len); extern String uint8tToString(uint8_t* data, size_t len);
extern bool udpPacketValidation(String& data); extern bool udpPacketValidation(String& data);
extern void udpPacketParse(String& data); extern void udpPacketParse(String& data);
#endif

View File

@@ -1,6 +1,6 @@
[platformio] [platformio]
default_envs = esp8266 default_envs = esp32
;============================================================================================================================================= ;=============================================================================================================================================
[common_env_data] [common_env_data]
lib_deps_external = lib_deps_external =

View File

@@ -42,7 +42,8 @@ void LoggingClass::addNewDelOldData(const String filename, size_t maxPoints, Str
logData += timeNow->getTimeUnix() + " " + payload + "\r\n"; logData += timeNow->getTimeUnix() + " " + payload + "\r\n";
writeFile(filename, logData); writeFile(filename, logData);
} }
} else { }
else {
if (timeNow->hasTimeSynced()) { if (timeNow->hasTimeSynced()) {
addFileLn(filename, timeNow->getTimeUnix() + " " + payload); addFileLn(filename, timeNow->getTimeUnix() + " " + payload);
} }
@@ -95,7 +96,8 @@ void sendLogData(String file, String topic) {
jsonWriteFloat(buf, "y1", value.toFloat()); jsonWriteFloat(buf, "y1", value.toFloat());
if (log_date.length() < 3) { if (log_date.length() < 3) {
json_array += buf; json_array += buf;
} else { }
else {
json_array += buf + ","; json_array += buf + ",";
} }
buf = "{}"; buf = "{}";
@@ -111,10 +113,12 @@ void sendLogData(String file, String topic) {
} }
void clean_log_date() { void clean_log_date() {
#ifdef ESP8266
auto dir = LittleFS.openDir("logs"); auto dir = LittleFS.openDir("logs");
while (dir.next()) { while (dir.next()) {
String fname = dir.fileName(); String fname = dir.fileName();
SerialPrint("I", "System", fname); SerialPrint("I", "System", fname);
removeFile("logs/" + fname); removeFile("logs/" + fname);
} }
#endif
} }