mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
82 lines
1.9 KiB
C++
82 lines
1.9 KiB
C++
#include "set.h"
|
|
|
|
void setup() {
|
|
|
|
Serial.begin(115200);
|
|
Serial.setDebugOutput(true);
|
|
Serial.println("--------------started----------------");
|
|
//--------------------------------------------------------------
|
|
SPIFFS.begin();
|
|
configSetup = readFile("config.json", 4096);
|
|
Serial.println(configSetup);
|
|
jsonWrite(configJson, "SSDP", jsonRead(configSetup, "SSDP"));
|
|
jsonWrite(configJson, "lang", jsonRead(configSetup, "lang"));
|
|
Serial.println("SPIFFS_init");
|
|
|
|
#ifdef ESP32
|
|
uint32_t chipID_u = ESP.getEfuseMac();
|
|
chipID = String(chipID_u);
|
|
jsonWrite(configSetup, "chipID", chipID);
|
|
#endif
|
|
|
|
#ifdef ESP8266
|
|
chipID = String( ESP.getChipId() ) + "-" + String( ESP.getFlashChipId());
|
|
jsonWrite(configSetup, "chipID", chipID);
|
|
Serial.setDebugOutput(0);
|
|
#endif
|
|
|
|
prex = prefix + "/" + chipID;
|
|
Serial.println(chipID);
|
|
//--------------------------------------------------------------
|
|
CMD_init();
|
|
Serial.println("[V] CMD_init");
|
|
//--------------------------------------------------------------
|
|
All_init();
|
|
Serial.println("[V] All_init");
|
|
//--------------------------------------------------------------
|
|
WIFI_init();
|
|
Serial.println("[V] WIFI_init");
|
|
//--------------------------------------------------------------
|
|
Web_server_init();
|
|
Serial.println("[V] Web_server_init");
|
|
//--------------------------------------------------------------
|
|
Time_Init();
|
|
Serial.println("[V] Time_Init");
|
|
//--------------------------------------------------------------
|
|
MQTT_init();
|
|
Serial.println("[V] MQTT_init");
|
|
//--------------------------------------------------------------
|
|
Push_init();
|
|
Serial.println("[V] Push_init");
|
|
|
|
|
|
getMemoryLoad("[i] After loading");
|
|
|
|
|
|
ts.add(TEST, 5000, [&](void*) {
|
|
|
|
up_time();
|
|
|
|
}, nullptr, true);
|
|
|
|
}
|
|
|
|
void loop() {
|
|
|
|
#ifdef OTA_enable
|
|
ArduinoOTA.handle();
|
|
#endif
|
|
|
|
#ifdef WS_enable
|
|
ws.cleanupClients();
|
|
#endif
|
|
|
|
handleMQTT();
|
|
|
|
handleCMD_loop();
|
|
handleButton();
|
|
handleScenario();
|
|
|
|
ts.update();
|
|
}
|