mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
esp32 compiling version
This commit is contained in:
@@ -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
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
default_envs = esp8266
|
default_envs = esp32
|
||||||
;=============================================================================================================================================
|
;=============================================================================================================================================
|
||||||
[common_env_data]
|
[common_env_data]
|
||||||
lib_deps_external =
|
lib_deps_external =
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user