mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Новый модуль Math для хранения математических функция для сценариев
This commit is contained in:
@@ -144,6 +144,10 @@
|
|||||||
"path": "src/modules/virtual/LogingDaily",
|
"path": "src/modules/virtual/LogingDaily",
|
||||||
"active": true
|
"active": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "src/modules/virtual/Math",
|
||||||
|
"active": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/virtual/owmWeather",
|
"path": "src/modules/virtual/owmWeather",
|
||||||
"active": true
|
"active": true
|
||||||
|
|||||||
@@ -22,6 +22,10 @@
|
|||||||
"path": "src/modules/virtual/LogingDaily",
|
"path": "src/modules/virtual/LogingDaily",
|
||||||
"active": true
|
"active": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "src/modules/virtual/Math",
|
||||||
|
"active": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/virtual/owmWeather",
|
"path": "src/modules/virtual/owmWeather",
|
||||||
"active": true
|
"active": true
|
||||||
|
|||||||
@@ -723,10 +723,11 @@
|
|||||||
"widget": "rangeServo",
|
"widget": "rangeServo",
|
||||||
"page": "servo",
|
"page": "servo",
|
||||||
"descr": "угол",
|
"descr": "угол",
|
||||||
"int": 1,
|
|
||||||
"pin": 12,
|
"pin": 12,
|
||||||
"apin": -1,
|
"minPulseWidth": 544,
|
||||||
"amap": "0, 4096, 0, 180",
|
"maxPulseWidth": 2400,
|
||||||
|
"neutralPulseWidth": 1500,
|
||||||
|
"trackingID": "",
|
||||||
"num": 47
|
"num": 47
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -144,6 +144,10 @@
|
|||||||
"path": "src/modules/virtual/LogingDaily",
|
"path": "src/modules/virtual/LogingDaily",
|
||||||
"active": true
|
"active": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "src/modules/virtual/Math",
|
||||||
|
"active": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/virtual/owmWeather",
|
"path": "src/modules/virtual/owmWeather",
|
||||||
"active": true
|
"active": true
|
||||||
|
|||||||
25
src/modules/virtual/Math/Math.cpp
Normal file
25
src/modules/virtual/Math/Math.cpp
Normal file
@@ -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<IoTValue> ¶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;
|
||||||
|
}
|
||||||
55
src/modules/virtual/Math/modinfo.json
Normal file
55
src/modules/virtual/Math/modinfo.json
Normal file
@@ -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": []
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user