mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Собираем драйер RTC при формировании списка модулей
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
#include "ESPConfiguration.h"
|
#include "ESPConfiguration.h"
|
||||||
#include "classes/IoTGpio.h"
|
#include "classes/IoTGpio.h"
|
||||||
|
#include "classes/IoTRTC.h"
|
||||||
|
|
||||||
extern IoTGpio IoTgpio;
|
extern IoTGpio IoTgpio;
|
||||||
|
extern IoTRTC *watch;
|
||||||
|
|
||||||
std::list<IoTItem*> IoTItems;
|
std::list<IoTItem*> IoTItems;
|
||||||
void* getAPI(String subtype, String params);
|
void* getAPI(String subtype, String params);
|
||||||
@@ -25,8 +27,21 @@ void configure(String path) {
|
|||||||
} else {
|
} else {
|
||||||
myIoTItem = (IoTItem*)getAPI(subtype, jsonArrayElement);
|
myIoTItem = (IoTItem*)getAPI(subtype, jsonArrayElement);
|
||||||
if (myIoTItem) {
|
if (myIoTItem) {
|
||||||
IoTGpio* tmp = myIoTItem->getGpioDriver();
|
// пробуем спросить драйвер GPIO
|
||||||
if (tmp) IoTgpio.regDriver(tmp);
|
IoTGpio* gpiotmp = myIoTItem->getGpioDriver();
|
||||||
|
if (gpiotmp) IoTgpio.regDriver(gpiotmp);
|
||||||
|
|
||||||
|
// пробуем спросить драйвер RTC
|
||||||
|
iarduino_RTC_BASE* rtctmp = myIoTItem->getRtcDriver();
|
||||||
|
if (rtctmp) {
|
||||||
|
delete watch->objClass;
|
||||||
|
watch->objClass = rtctmp;
|
||||||
|
int valPeriod_save = watch->valPeriod;
|
||||||
|
watch->valPeriod = 0;
|
||||||
|
watch->gettime();
|
||||||
|
watch->valPeriod = valPeriod_save;
|
||||||
|
}
|
||||||
|
|
||||||
IoTItems.push_back(myIoTItem);
|
IoTItems.push_back(myIoTItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user