From 65eb81ed812872cece81bd75136d013d8a7683dd Mon Sep 17 00:00:00 2001 From: biver Date: Sun, 24 Apr 2022 23:32:06 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B1=D0=B8=D1=80=D0=B0=D0=B5?= =?UTF-8?q?=D0=BC=20=D0=B4=D1=80=D0=B0=D0=B9=D0=B5=D1=80=20RTC=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=20=D1=84=D0=BE=D1=80=D0=BC=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B8=20=D1=81=D0=BF=D0=B8=D1=81=D0=BA=D0=B0?= =?UTF-8?q?=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ESPConfiguration.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/ESPConfiguration.cpp b/src/ESPConfiguration.cpp index de80d564..04fdc809 100644 --- a/src/ESPConfiguration.cpp +++ b/src/ESPConfiguration.cpp @@ -1,7 +1,9 @@ #include "ESPConfiguration.h" #include "classes/IoTGpio.h" +#include "classes/IoTRTC.h" extern IoTGpio IoTgpio; +extern IoTRTC *watch; std::list IoTItems; void* getAPI(String subtype, String params); @@ -25,8 +27,21 @@ void configure(String path) { } else { myIoTItem = (IoTItem*)getAPI(subtype, jsonArrayElement); if (myIoTItem) { - IoTGpio* tmp = myIoTItem->getGpioDriver(); - if (tmp) IoTgpio.regDriver(tmp); + // пробуем спросить драйвер GPIO + 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); } }