mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Optimization
This commit is contained in:
@@ -63,8 +63,8 @@ void sensorsInit() {
|
||||
nullptr, true);
|
||||
|
||||
ts.add(
|
||||
SENSORS60SEC, 60000, [&](void *) {
|
||||
String buf = sensorReadingMap60sec;
|
||||
SENSORS30SEC, 30000, [&](void *) {
|
||||
String buf = sensorReadingMap30sec;
|
||||
while (buf.length()) {
|
||||
String tmp = selectToMarker(buf, ",");
|
||||
sCmd.readStr(tmp);
|
||||
@@ -74,8 +74,3 @@ void sensorsInit() {
|
||||
nullptr, true);
|
||||
}
|
||||
|
||||
//void loopSerial() {
|
||||
// if (term) {
|
||||
// term->loop();
|
||||
// }
|
||||
//}
|
||||
|
||||
16
src/Clock.cpp
Normal file
16
src/Clock.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "Clock.h"
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
Clock* timeNow;
|
||||
void clock_init() {
|
||||
timeNow = new Clock;
|
||||
timeNow->setNtpPool(jsonReadStr(configSetupJson, "ntp"));
|
||||
timeNow->setTimezone(jsonReadStr(configSetupJson, "timezone").toInt());
|
||||
|
||||
ts.add(
|
||||
TIME_SYNC, 30000, [&](void*) {
|
||||
timeNow->hasSync();
|
||||
},
|
||||
nullptr, true);
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
AsyncWebSocket ws;
|
||||
//AsyncEventSource events;
|
||||
#endif
|
||||
Clock* timeNow;
|
||||
|
||||
TickerScheduler ts(TEST + 1);
|
||||
WiFiClient espClient;
|
||||
PubSubClient mqtt(espClient);
|
||||
@@ -40,7 +40,7 @@ String itemsLine = "";
|
||||
// Sensors
|
||||
int8_t dallasEnterCounter = -1;
|
||||
String sensorReadingMap10sec;
|
||||
String sensorReadingMap60sec;
|
||||
String sensorReadingMap30sec;
|
||||
|
||||
// Logging
|
||||
String logging_value_names_list;
|
||||
|
||||
@@ -14,8 +14,6 @@ String xmlNode(String tags, String data);
|
||||
|
||||
String decToHex(uint32_t decValue, byte desiredStringLength);
|
||||
|
||||
//39164
|
||||
//457684
|
||||
void SsdpInit() {
|
||||
server.on("/description.xml", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||
String ssdpSend = F("<root xmlns=\"urn:schemas-upnp-org:device-1-0\">");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "Utils/FileUtils.h"
|
||||
#include "Utils/PrintMessage.h"
|
||||
#include "Utils\SerialPrint.h"
|
||||
#include "Utils/StringUtils.h"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "Utils/SysUtils.h"
|
||||
|
||||
#include "Global.h"
|
||||
#include "Utils/PrintMessage.h"
|
||||
|
||||
|
||||
const String getUniqueId(const char* name) {
|
||||
return String(name) + getMacAddress();
|
||||
|
||||
@@ -20,8 +20,6 @@ void inputTimeSet() {
|
||||
void handle_time_init() {
|
||||
ts.add(
|
||||
TIME, 1000, [&](void *) {
|
||||
//jsonWriteStr(configLiveJson, "time", timeNow->getTime());
|
||||
//jsonWriteStr(configLiveJson, "timenow", timeNow->getTimeJson());
|
||||
jsonWriteStr(configLiveJson, "timenow", timeNow->getTime());
|
||||
eventGen("timenow", "");
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@ void sysUptime() {
|
||||
myLineParsing.update();
|
||||
String key = myLineParsing.gkey();
|
||||
sCmd.addCommand(key.c_str(), uptimeReading);
|
||||
sensorReadingMap60sec += key + ",";
|
||||
sensorReadingMap30sec += key + ",";
|
||||
myLineParsing.clear();
|
||||
}
|
||||
|
||||
|
||||
14
src/main.cpp
14
src/main.cpp
@@ -116,16 +116,4 @@ void loop() {
|
||||
|
||||
myNotAsyncActions->loop();
|
||||
ts.update();
|
||||
}
|
||||
|
||||
void clock_init() {
|
||||
timeNow = new Clock();
|
||||
timeNow->setNtpPool(jsonReadStr(configSetupJson, "ntp"));
|
||||
timeNow->setTimezone(jsonReadStr(configSetupJson, "timezone").toInt());
|
||||
|
||||
ts.add(
|
||||
TIME_SYNC, 30000, [&](void*) {
|
||||
timeNow->hasSync();
|
||||
},
|
||||
nullptr, true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user