mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Добавляем релоад конфигурации при нажатии соответсвующей кнопки в интерфейсе
This commit is contained in:
@@ -5,4 +5,5 @@
|
||||
extern std::vector<IoTItem*> IoTItems; // вектор ссылок базового класса IoTItem - список всех запущенных сенсоров
|
||||
|
||||
extern void configure(String path);
|
||||
void clearConfigure();
|
||||
extern IoTItem* myIoTItem;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "Global.h"
|
||||
#include "Utils/WiFiUtils.h"
|
||||
#include "DeviceList.h"
|
||||
#include "ESPConfiguration.h"
|
||||
|
||||
#ifdef STANDARD_WEB_SOCKETS
|
||||
extern void standWebSocketsInit();
|
||||
|
||||
@@ -30,3 +30,11 @@ void configure(String path) {
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
|
||||
void clearConfigure() {
|
||||
Serial.printf("Start clearing config\n");
|
||||
for (unsigned int i = 0; i < IoTItems.size(); i++) {
|
||||
if (IoTItems[i]) delete IoTItems[i];
|
||||
}
|
||||
IoTItems.clear();
|
||||
}
|
||||
@@ -71,6 +71,8 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length)
|
||||
//**сохранение**//
|
||||
if (headerStr == "/gifnoc|") {
|
||||
writeFileUint8tByFrames("config.json", payload, length, headerLenth, 256);
|
||||
clearConfigure();
|
||||
configure("/config.json");
|
||||
}
|
||||
// page connection===================================================================
|
||||
//**отправка**//
|
||||
|
||||
Reference in New Issue
Block a user