mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 14:42:18 +03:00
удаление часов реального времени
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
#include "ESPConfiguration.h"
|
||||
#include "classes/IoTGpio.h"
|
||||
#include "classes/IoTRTC.h"
|
||||
|
||||
extern IoTGpio IoTgpio;
|
||||
extern IoTRTC *watch;
|
||||
|
||||
std::list<IoTItem*> IoTItems;
|
||||
void* getAPI(String subtype, String params);
|
||||
@@ -25,24 +23,12 @@ void configure(String path) {
|
||||
SerialPrint(F("E"), F("Config"), "json error " + subtype);
|
||||
continue;
|
||||
} else {
|
||||
//(IoTItem*) - getAPI вернула ссылку, что бы ее привести к классу IoTItem используем
|
||||
myIoTItem = (IoTItem*)getAPI(subtype, jsonArrayElement);
|
||||
if (myIoTItem) {
|
||||
// пробуем спросить драйвер GPIO
|
||||
IoTGpio* gpiotmp = myIoTItem->getGpioDriver();
|
||||
if (gpiotmp) IoTgpio.regDriver(gpiotmp);
|
||||
|
||||
// пробуем спросить драйвер RTC
|
||||
iarduino_RTC_BASE* rtctmp = myIoTItem->getRtcDriver();
|
||||
if (rtctmp) {
|
||||
Serial.println("Start delete watch objClass");
|
||||
delete watch->objClass;
|
||||
watch->objClass = rtctmp;
|
||||
int valPeriod_save = watch->valPeriod;
|
||||
watch->valPeriod = 0;
|
||||
watch->gettime();
|
||||
watch->valPeriod = valPeriod_save;
|
||||
}
|
||||
|
||||
if (myIoTItem->isGpioDriver()) IoTgpio.regDriver((IoTGpio*)myIoTItem);
|
||||
|
||||
IoTItems.push_back(myIoTItem);
|
||||
}
|
||||
}
|
||||
@@ -54,7 +40,7 @@ void configure(String path) {
|
||||
|
||||
void clearConfigure() {
|
||||
Serial.printf("Start clearing config\n");
|
||||
for (std::list<IoTItem*>::iterator it=IoTItems.begin(); it != IoTItems.end(); ++it) {
|
||||
for (std::list<IoTItem*>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) {
|
||||
Serial.printf("Start delete iotitem %s \n", (*it)->getID().c_str());
|
||||
if (*it) delete *it;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user