diff --git a/compilerProfile.json b/compilerProfile.json index 381f87da..d206a12c 100644 --- a/compilerProfile.json +++ b/compilerProfile.json @@ -144,6 +144,10 @@ "path": "src/modules/virtual/LogingDaily", "active": true }, + { + "path": "src/modules/virtual/Math", + "active": false + }, { "path": "src/modules/virtual/owmWeather", "active": true diff --git a/data_svelte/flashProfile.json b/data_svelte/flashProfile.json index 903e5c8f..79eca748 100644 --- a/data_svelte/flashProfile.json +++ b/data_svelte/flashProfile.json @@ -22,6 +22,10 @@ "path": "src/modules/virtual/LogingDaily", "active": true }, + { + "path": "src/modules/virtual/Math", + "active": false + }, { "path": "src/modules/virtual/owmWeather", "active": true diff --git a/data_svelte/items.json b/data_svelte/items.json index 49d64ed4..6511d60c 100644 --- a/data_svelte/items.json +++ b/data_svelte/items.json @@ -723,10 +723,11 @@ "widget": "rangeServo", "page": "servo", "descr": "угол", - "int": 1, "pin": 12, - "apin": -1, - "amap": "0, 4096, 0, 180", + "minPulseWidth": 544, + "maxPulseWidth": 2400, + "neutralPulseWidth": 1500, + "trackingID": "", "num": 47 }, { diff --git a/myProfile.json b/myProfile.json index 381f87da..d206a12c 100644 --- a/myProfile.json +++ b/myProfile.json @@ -144,6 +144,10 @@ "path": "src/modules/virtual/LogingDaily", "active": true }, + { + "path": "src/modules/virtual/Math", + "active": false + }, { "path": "src/modules/virtual/owmWeather", "active": true diff --git a/src/modules/virtual/Math/Math.cpp b/src/modules/virtual/Math/Math.cpp new file mode 100644 index 00000000..09a4996a --- /dev/null +++ b/src/modules/virtual/Math/Math.cpp @@ -0,0 +1,25 @@ +#include "Global.h" +#include "classes/IoTItem.h" + +class IoTMath : public IoTItem { +private: +public: + IoTMath(String parameters) : IoTItem(parameters) {} + + IoTValue execute(String command, std::vector ¶m) { + if(command == "map" & param.size() == 5) { + IoTValue valTmp; + valTmp.isDecimal = true; + valTmp.valD = map(param[0].valD, param[1].valD, param[2].valD, param[3].valD, param[4].valD); + return valTmp; + } + return {}; + } +}; + +void *getAPI_IoTMath(String subtype, String param) { + if (subtype == F("IoTMath")) { + return new IoTMath(param); + } + return nullptr; +} diff --git a/src/modules/virtual/Math/modinfo.json b/src/modules/virtual/Math/modinfo.json new file mode 100644 index 00000000..c9d1dfe4 --- /dev/null +++ b/src/modules/virtual/Math/modinfo.json @@ -0,0 +1,55 @@ +{ + "menuSection": "virtual_elments", + "configItem": [ + { + "global": 0, + "name": "Math library", + "type": "Reading", + "subtype": "IoTMath", + "id": "math", + "widget": "anydataValue", + "page": "Математика", + "descr": "" + } + ], + "about": { + "authorName": "Berenbaum Maxim", + "authorContact": "https://t.me/Bermax_sys", + "authorGit": "https://github.com/xpohuk8", + "exampleURL": "https://iotmanager.org/wiki", + "specialThanks": "Ilya Belyakov", + "moduleName": "IoTMath", + "moduleVersion": "1.0", + "usedRam": { + "esp32_4mb": 15, + "esp8266_4mb": 15 + }, + "title": "Модуль Math", + "moduleDesc": "Модуль для расчета значений с использованием математических функций. Подходит для коррекции показаний датчиков.", + "propInfo": { + }, + "funcInfo": [ + { + "name": "map", + "descr": "Аналог функции map", + "params": [ + "Значение1", "Значение2", "Значение3", "Значение4" + ] + } + ] + }, + "defActive": false, + "usedLibs": { + "esp32_4mb": [], + "esp32_4mb3f": [], + "esp32cam_4mb": [], + "esp32s2_4mb": [], + "esp8266_4mb": [], + "esp8266_1mb": [], + "esp8266_1mb_ota": [], + "esp8285_1mb": [], + "esp8285_1mb_ota": [], + "esp8266_2mb": [], + "esp8266_2mb_ota": [] + } +}