начал писать систему формирования виджетов

This commit is contained in:
Dmitry Borisenko
2022-02-01 00:42:31 +01:00
parent c2b2997952
commit 9ec724ccff
4 changed files with 28 additions and 84 deletions

View File

@@ -1,93 +1,14 @@
[
{
"type": "Variable",
"subtype": "ButtonOut",
"id": "btn1",
"widget": "toggle",
"page": "Кнопки",
"descr": "Освещение",
"gpio": 13,
"inv": false
},
{
"type": "Variable",
"subtype": "PwmOut",
"id": "pwm1",
"widget": "range",
"page": "Регуляторы",
"descr": "Освещение",
"gpio": 14,
"inv": false
},
{
"type": "Reading",
"subtype": "ButtonIn",
"id": "btn",
"widget": "toggle",
"page": "Кнопки",
"descr": "Освещение",
"gpio": 12,
"inv": false
},
{
"type": "Reading",
"subtype": "OutputValue",
"id": "txt",
"widget": "anydataRed",
"page": "Предупреждения",
"descr": "Статус"
},
{
"type": "Reading",
"subtype": "InputValue",
"id": "txt",
"widget": "inputDgt",
"page": "Лимиты",
"descr": "Порог"
},
{
"type": "Reading",
"subtype": "Bme280",
"subtype": "AnalogAdc",
"id": "t",
"widget": "anydataTmp",
"page": "Сенсоры",
"descr": "Температура"
},
{
"type": "Reading",
"subtype": "Bme280",
"id": "p",
"widget": "anydataMm",
"page": "Сенсоры",
"descr": "Давление"
},
{
"type": "Reading",
"subtype": "Bme280",
"id": "h",
"widget": "anydataHum",
"page": "Сенсоры",
"descr": "Влажность",
"int": 10,
"addr": "0x78"
},
{
"type": "Reading",
"subtype": "AnalogAdc",
"id": "t1",
"widget": "anydataDef",
"page": "Сенсоры",
"descr": "Температура",
"pin": 0,
"int": 10
},
{
"type": "Reading",
"subtype": "AnalogAdc",
"id": "t2",
"widget": "anydataTmp",
"page": "Сенсоры",
"descr": "Температура",
"map": "1,1024,1,1024",
"plus": 0,
"multiply": 1,
"pin": 0,
"int": 15
}

View File

@@ -70,5 +70,25 @@
"descr": "Влажность",
"int": 10,
"addr": "0x78"
},
{
"type": "Reading",
"subtype": "AnalogAdc",
"id": "t1",
"widget": "anydataDef",
"page": "Сенсоры",
"descr": "Температура",
"pin": 0,
"int": 10
},
{
"type": "Reading",
"subtype": "AnalogAdc",
"id": "t2",
"widget": "anydataTmp",
"page": "Сенсоры",
"descr": "Температура",
"pin": 0,
"int": 15
}
]

View File

@@ -25,7 +25,6 @@ void configure(String path) {
myIoTSensor = (IoTSensor*)getAPI(subtype, jsonArrayElement);
if (myIoTSensor) {
iotSensors.push_back(myIoTSensor);
// createWidget(jsonArrayElement);
}
}
}

View File

@@ -229,6 +229,10 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length)
writeFileUint8tByFrames("config.json", payload, length, headerLenth, 256);
}
if (headerStr == "/tuoyal") {
writeFileUint8tByFrames("layout.json", payload, length, headerLenth, 256);
}
} break;
case WStype_BIN: {