diff --git a/data_svelte/items.json b/data_svelte/items.json index 9cbf71b7..69bdf142 100644 --- a/data_svelte/items.json +++ b/data_svelte/items.json @@ -15,11 +15,12 @@ "widget": "", "page": "", "descr": "", - "int": "0", + "int": "1", "chipNum": 1, "rst": 16, "clk": 5, - "dat": 4 + "dat": 4, + "defFormat": "d-m-Y" }, { "name": "2. Расширитель портов Mcp23017", diff --git a/src/modules/system/IarduinoRTC/IarduinoRTC.cpp b/src/modules/system/IarduinoRTC/IarduinoRTC.cpp index a53906fd..47b78914 100644 --- a/src/modules/system/IarduinoRTC/IarduinoRTC.cpp +++ b/src/modules/system/IarduinoRTC/IarduinoRTC.cpp @@ -14,6 +14,7 @@ extern IoTRTC *watch; class IarduinoRTC : public IoTItem { private: int _chipNum, _rst, _clk, _dat; + String _defFormat; iarduino_RTC_BASE *RTCDriver; public: @@ -23,6 +24,8 @@ class IarduinoRTC : public IoTItem { jsonRead(parameters, "rst", _rst); jsonRead(parameters, "clk", _clk); jsonRead(parameters, "dat", _dat); + jsonRead(parameters, "defFormat", _defFormat); + _defFormat = _defFormat + " "; // костыль против обрезки последнего символа в библиотеке switch (_chipNum) { case 1: @@ -41,7 +44,10 @@ class IarduinoRTC : public IoTItem { if (RTCDriver) RTCDriver->begin(); } - void doByInterval() { } + void doByInterval() { + value.isDecimal = false; + value.valS = watch->gettime(_defFormat); + } IoTValue execute(String command, std::vector ¶m) { if (command == "getTime") { diff --git a/src/modules/system/IarduinoRTC/items.json b/src/modules/system/IarduinoRTC/items.json index 91de5286..43dc7367 100644 --- a/src/modules/system/IarduinoRTC/items.json +++ b/src/modules/system/IarduinoRTC/items.json @@ -9,10 +9,11 @@ "page": "", "descr": "", - "int": "0", + "int": "1", "chipNum": 1, "rst": 16, "clk": 5, - "dat": 4 + "dat": 4, + "defFormat": "d-m-Y" } ] \ No newline at end of file