mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Выделяем виртуальную кнопку в отдельный модуль
This commit is contained in:
@@ -22,19 +22,7 @@
|
||||
"num": 1
|
||||
},
|
||||
{
|
||||
"name": "2. Кнопка",
|
||||
"type": "Reading",
|
||||
"subtype": "Variable",
|
||||
"id": "vbtn",
|
||||
"widget": "",
|
||||
"page": "",
|
||||
"descr": "",
|
||||
"int": "0",
|
||||
"val": "0",
|
||||
"num": 2
|
||||
},
|
||||
{
|
||||
"name": "3. Окно ввода цифры",
|
||||
"name": "2. Окно ввода цифры",
|
||||
"type": "Reading",
|
||||
"subtype": "Variable",
|
||||
"id": "dedit",
|
||||
@@ -43,10 +31,10 @@
|
||||
"descr": "",
|
||||
"int": "0",
|
||||
"val": "0",
|
||||
"num": 3
|
||||
"num": 2
|
||||
},
|
||||
{
|
||||
"name": "4. Окно ввода времени",
|
||||
"name": "3. Окно ввода времени",
|
||||
"type": "Reading",
|
||||
"subtype": "Variable",
|
||||
"id": "tedit",
|
||||
@@ -55,10 +43,10 @@
|
||||
"descr": "",
|
||||
"int": "0",
|
||||
"val": "0",
|
||||
"num": 4
|
||||
"num": 3
|
||||
},
|
||||
{
|
||||
"name": "5. Переменная",
|
||||
"name": "4. Переменная",
|
||||
"type": "Reading",
|
||||
"subtype": "Variable",
|
||||
"id": "var",
|
||||
@@ -67,6 +55,18 @@
|
||||
"descr": "",
|
||||
"int": "0",
|
||||
"val": "0",
|
||||
"num": 4
|
||||
},
|
||||
{
|
||||
"name": "5. Кнопка",
|
||||
"type": "Reading",
|
||||
"subtype": "VButton",
|
||||
"id": "vbtn",
|
||||
"widget": "button",
|
||||
"page": "Кнопки",
|
||||
"descr": "",
|
||||
"int": "0",
|
||||
"val": "0",
|
||||
"num": 5
|
||||
},
|
||||
{
|
||||
|
||||
@@ -68,6 +68,7 @@ lib_deps =
|
||||
build_src_filter =
|
||||
+<modules\virtual\Timer>
|
||||
+<modules\virtual\Variable>
|
||||
+<modules\virtual\VButton>
|
||||
+<modules\sensors\Aht20>
|
||||
+<modules\sensors\AnalogAdc>
|
||||
+<modules\sensors\Bme280>
|
||||
@@ -93,9 +94,6 @@ build_src_filter =
|
||||
|
||||
[env:esp32_4mb_fromitems]
|
||||
lib_deps =
|
||||
marcoschwartz/LiquidCrystal_I2C@^1.1.4
|
||||
https://github.com/RoboticsBrno/ServoESP32
|
||||
dfrobot/DFRobotDFPlayerMini @ ^1.0.5
|
||||
Adafruit AHTX0
|
||||
adafruit/Adafruit BME280 Library
|
||||
adafruit/Adafruit BMP280 Library
|
||||
@@ -107,16 +105,14 @@ lib_deps =
|
||||
rc-switch @ ^2.6.4
|
||||
robtillaart/SHT2x@^0.1.1
|
||||
WEMOS SHT3x@1.0.0
|
||||
https://github.com/RoboticsBrno/ServoESP32
|
||||
adafruit/Adafruit MCP23017 Arduino Library@^2.0.2
|
||||
adafruit/Adafruit BusIO @ ^1.13.0
|
||||
dfrobot/DFRobotDFPlayerMini @ ^1.0.5
|
||||
marcoschwartz/LiquidCrystal_I2C@^1.1.4
|
||||
build_src_filter =
|
||||
+<modules\display\Lcd2004>
|
||||
+<modules\exec\ButtonIn>
|
||||
+<modules\exec\ButtonOut>
|
||||
+<modules\exec\IoTServo>
|
||||
+<modules\exec\Mp3>
|
||||
+<modules\exec\Pwm32>
|
||||
+<modules\exec\Timer>
|
||||
+<modules\virtual\Timer>
|
||||
+<modules\virtual\Variable>
|
||||
+<modules\sensors\Aht20>
|
||||
+<modules\sensors\AnalogAdc>
|
||||
+<modules\sensors\Bme280>
|
||||
@@ -130,8 +126,13 @@ build_src_filter =
|
||||
+<modules\sensors\Sht20>
|
||||
+<modules\sensors\Sht30>
|
||||
+<modules\sensors\Sonar>
|
||||
+<modules\system\IarduinoRTC>
|
||||
+<modules\system\Mcp23017>
|
||||
+<modules\system\SysExt>
|
||||
+<modules\system\Variable>
|
||||
+<modules\exec\ButtonIn>
|
||||
+<modules\exec\ButtonOut>
|
||||
+<modules\exec\IarduinoRTC>
|
||||
+<modules\exec\IoTServo>
|
||||
+<modules\exec\Mcp23017>
|
||||
+<modules\exec\Mp3>
|
||||
+<modules\exec\Pwm32>
|
||||
+<modules\exec\SysExt>
|
||||
+<modules\display\Lcd2004>
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
void* getAPI_Timer(String subtype, String params);
|
||||
void* getAPI_Variable(String subtype, String params);
|
||||
void* getAPI_VButton(String subtype, String params);
|
||||
void* getAPI_Aht20(String subtype, String params);
|
||||
void* getAPI_AnalogAdc(String subtype, String params);
|
||||
void* getAPI_Bme280(String subtype, String params);
|
||||
@@ -29,6 +30,7 @@ void* getAPI(String subtype, String params) {
|
||||
void* tmpAPI;
|
||||
if ((tmpAPI = getAPI_Timer(subtype, params)) != nullptr) return tmpAPI;
|
||||
if ((tmpAPI = getAPI_Variable(subtype, params)) != nullptr) return tmpAPI;
|
||||
if ((tmpAPI = getAPI_VButton(subtype, params)) != nullptr) return tmpAPI;
|
||||
if ((tmpAPI = getAPI_Aht20(subtype, params)) != nullptr) return tmpAPI;
|
||||
if ((tmpAPI = getAPI_AnalogAdc(subtype, params)) != nullptr) return tmpAPI;
|
||||
if ((tmpAPI = getAPI_Bme280(subtype, params)) != nullptr) return tmpAPI;
|
||||
|
||||
23
src/modules/virtual/VButton/VButton.cpp
Normal file
23
src/modules/virtual/VButton/VButton.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "Global.h"
|
||||
#include "classes/IoTItem.h"
|
||||
|
||||
|
||||
class VButton : public IoTItem {
|
||||
public:
|
||||
VButton(String parameters): IoTItem(parameters) { }
|
||||
|
||||
void setValue(IoTValue Value) {
|
||||
value = Value;
|
||||
regEvent((String)(int)value.valD, "");
|
||||
}
|
||||
|
||||
void doByInterval() { }
|
||||
};
|
||||
|
||||
void* getAPI_VButton(String subtype, String param) {
|
||||
if (subtype == F("VButton")) {
|
||||
return new VButton(param);
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
37
src/modules/virtual/VButton/modinfo.json
Normal file
37
src/modules/virtual/VButton/modinfo.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"menuSection": "Виртуальные элементы",
|
||||
|
||||
"configItem": [{
|
||||
"name": "Кнопка",
|
||||
"type": "Reading",
|
||||
"subtype": "VButton",
|
||||
"id": "vbtn",
|
||||
"widget": "button",
|
||||
"page": "Кнопки",
|
||||
"descr": "Кнопка1",
|
||||
|
||||
"int": "0",
|
||||
"val": "0"
|
||||
}],
|
||||
|
||||
"about": {
|
||||
"authorName": "Ilya Belyakov",
|
||||
"authorContact": "https://t.me/Biveraxe",
|
||||
"authorGit": "https://github.com/biveraxe",
|
||||
"specialThanks": "",
|
||||
"moduleName": "VButton",
|
||||
"moduleVersion": "1.0",
|
||||
"moduleDesc": "Специальный системный модуль для добавления виртуальной кнопки.",
|
||||
"propInfo": {
|
||||
"int": "Не используется",
|
||||
"val": "Значение при старте"
|
||||
}
|
||||
},
|
||||
|
||||
"defActive": true,
|
||||
|
||||
"devices": {
|
||||
"esp32_4mb": [],
|
||||
"esp8266_4mb": []
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,7 @@
|
||||
{
|
||||
"menuSection": "Виртуальные элементы",
|
||||
|
||||
"configItem": [{
|
||||
"name": "Кнопка",
|
||||
"type": "Reading",
|
||||
"subtype": "Variable",
|
||||
"id": "vbtn",
|
||||
"widget": "",
|
||||
"page": "",
|
||||
"descr": "",
|
||||
|
||||
"int": "0",
|
||||
"val": "0"
|
||||
},
|
||||
"configItem": [
|
||||
{
|
||||
"name": "Окно ввода цифры",
|
||||
"type": "Reading",
|
||||
|
||||
Reference in New Issue
Block a user