mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Big changes. Compiling version
This commit is contained in:
@@ -1 +1 @@
|
|||||||
0;button-out;id;toggle;Кнопки;Освещение;order;pin;inv[1];st[1]
|
0;button-out;id;toggle;Кнопки;Освещение;order;pin;inv[1]
|
||||||
@@ -1 +1 @@
|
|||||||
0;button-out;id;toggle;Кнопки;Освещение;order;st[0]
|
0;button-out;id;toggle;Кнопки;Освещение;order
|
||||||
@@ -1 +1 @@
|
|||||||
0;button-out;id;toggle;Кнопки;Освещение;order;pin;st[0]
|
0;button-out;id;toggle;Кнопки;Освещение;order;pin
|
||||||
@@ -1 +1 @@
|
|||||||
0;input-digit;id;inputDigit;Ввод;Введите#цифру;order;st[60]
|
0;input;id;inputDigit;Ввод;Введите#цифру;order
|
||||||
@@ -1 +1 @@
|
|||||||
0;input-time;id;inputTime;Ввод;Введите#время;order;st[10:00]
|
0;input;id;inputTime;Ввод;Введите#время;order
|
||||||
@@ -1 +1 @@
|
|||||||
0;output-text;id;anydata;Вывод;Сигнализация;order;st[Обнаружено#движение]
|
0;output-text;id;anydata;Вывод;Сигнализация;order
|
||||||
@@ -1 +1 @@
|
|||||||
0;pwm-out;id;range;Ползунки;Яркость;order;pin;st[500]
|
0;pwm-out;id;range;Ползунки;Яркость;order;pin
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
0;button-out;button-out-1;toggle;Кнопки;Выключить#все;1;st[0]
|
0;button-out;button-out-1;toggle;Кнопки;Выключить#все;1
|
||||||
0;button-out;button-out-2;toggle;Кнопки;Гостинная;2;pin[12];st[0]
|
0;button-out;button-out-2;toggle;Кнопки;Гостинная;2;pin[12]
|
||||||
0;button-out;button-out-3;toggle;Кнопки;Спальня;3;pin[13];st[0]
|
0;button-out;button-out-3;toggle;Кнопки;Спальня;3;pin[13]
|
||||||
0;button-out;button-out-4;toggle;Кнопки;Прихожая;4;pin[14];st[0]
|
0;button-out;button-out-4;toggle;Кнопки;Прихожая;4;pin[14]
|
||||||
0;pwm-out;pwm-out-5;range;Кнопки;Яркость;5;pin[15];st[500]
|
0;pwm-out;pwm-out-5;range;Кнопки;Яркость;5;pin[15]
|
||||||
0;pwm-out;pwm-out-6;range;Кнопки;Яркость;6;pin[16];st[500]
|
0;pwm-out;pwm-out-6;range;Кнопки;Яркость;6;pin[16]
|
||||||
0;output-text;output-text-7;anydata;Кнопки;Статус;7;st[выключено]
|
0;output-text;output-text-7;anydata;Кнопки;Статус;7
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
0;dallas-temp;temp;anydataTemp;Термостат;Температура;1;pin[2];index[0];int[10]
|
0;dallas-temp;temp;anydataTemp;Термостат;Температура;1;pin[2];index[0];int[10]
|
||||||
0;logging;log;chart;Термостат;История;2;val[temp];int[60];cnt[100]
|
0;logging;log;chart;Термостат;История;2;val[temp];int[60];cnt[100]
|
||||||
0;input-digit;inputU;inputDigit;Термостат;Верхний#порог;3;st[30]
|
0;input;inputU;inputDigit;Термостат;Верхний#порог;3
|
||||||
0;input-digit;inputL;inputDigit;Термостат;Нижний#порог;4;st[20]
|
0;input;inputL;inputDigit;Термостат;Нижний#порог;4
|
||||||
0;button-out;button;toggle;Термостат;Нагрев;5;pin[12];st[0]
|
0;button-out;button;toggle;Термостат;Нагрев;5;pin[12]
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
0;dht-hum;hum;anydataHum;Теплица;Влажность;1;pin[2];type[dht11];c[1]
|
0;dht-hum;hum;anydataHum;Теплица;Влажность;1;pin[2];type[dht11];c[1]
|
||||||
0;logging;log;chart;Теплица;История;2;val[hum];int[60];cnt[100]
|
0;logging;log;chart;Теплица;История;2;val[hum];int[60];cnt[100]
|
||||||
0;input-digit;inputU;inputDigit;Теплица;Верхний#порог;3;st[45]
|
0;input;inputU;inputDigit;Теплица;Верхний#порог;3
|
||||||
0;input-digit;inputL;inputDigit;Теплица;Нижний#порог;4;st[35]
|
0;input;inputL;inputDigit;Теплица;Нижний#порог;4
|
||||||
0;button-out;button;toggle;Теплица;Полив;5;pin[12];st[0]
|
0;button-out;button;toggle;Теплица;Полив;5;pin[12]
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
0;button-out;button1;toggle;Реле;Освещение;1;pin[12];st[0]
|
0;button-out;button1;toggle;Реле;Освещение;1;pin[12]
|
||||||
0;button-out;button2;toggle;Реле;Освещение;2;pin[13];st[0]
|
0;button-out;button2;toggle;Реле;Освещение;2;pin[13]
|
||||||
0;input-time;T1;inputTime;Реле;Введите#время#включения;3;st[10:00]
|
0;input;T1;inputTime;Реле;Введите#время#включения;3
|
||||||
0;input-time;T2;inputTime;Реле;Введите#время#выключения;4;st[11:00]
|
0;input;T2;inputTime;Реле;Введите#время#выключения;4
|
||||||
@@ -56,7 +56,8 @@
|
|||||||
"title": {
|
"title": {
|
||||||
"#": "Выберите элемент из списка<span class=\"caret\"></span>",
|
"#": "Выберите элемент из списка<span class=\"caret\"></span>",
|
||||||
"/set?addItem=button-out.pin": "1.Кнопка управляющая пином",
|
"/set?addItem=button-out.pin": "1.Кнопка управляющая пином",
|
||||||
"/set?addItem=button-out.npin": "2.Кнопка виртуальная",
|
"/set?addItem=button-out.inv": "2.Кнопка управляющая пином (с инверсией)",
|
||||||
|
"/set?addItem=button-out.npin": "3.Кнопка виртуальная",
|
||||||
"/set?addItem=button-in": "4.Кнопка физическая",
|
"/set?addItem=button-in": "4.Кнопка физическая",
|
||||||
"/set?addItem=pwm-out": "3.Широтно импульсная модуляция pwm",
|
"/set?addItem=pwm-out": "3.Широтно импульсная модуляция pwm",
|
||||||
"/set?addItem=input-digit": "5.Окно ввода цифровых значений",
|
"/set?addItem=input-digit": "5.Окно ввода цифровых значений",
|
||||||
@@ -167,7 +168,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "button",
|
"type": "button",
|
||||||
"title": "Очистить логи сенсоров",
|
"title": "Очистить графики и сбросить введенные данные",
|
||||||
"action": "/set?cleanlog",
|
"action": "/set?cleanlog",
|
||||||
"class": "btn btn-block btn-default"
|
"class": "btn btn-block btn-default"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ extern void pwmOutSet();
|
|||||||
extern void buttonIn();
|
extern void buttonIn();
|
||||||
extern void buttonInSet();
|
extern void buttonInSet();
|
||||||
|
|
||||||
extern void inputDigit();
|
extern void input();
|
||||||
extern void inputDigitSet();
|
extern void inputDigitSet();
|
||||||
|
|
||||||
extern void inputTime();
|
extern void inputTime();
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
//#define LAYOUT_IN_RAM
|
//#define LAYOUT_IN_RAM
|
||||||
//#define UDP_ENABLED
|
//#define UDP_ENABLED
|
||||||
//#define SSDP_ENABLED
|
//#define SSDP_ENABLED
|
||||||
|
#define SAVE_SETTINGS_TO_FLASH
|
||||||
|
|
||||||
//=========Sensors enable/disable=================================================================================================================================
|
//=========Sensors enable/disable=================================================================================================================================
|
||||||
#define LEVEL_ENABLED
|
#define LEVEL_ENABLED
|
||||||
|
|||||||
@@ -74,6 +74,9 @@ extern int impuls_EnterCounter;
|
|||||||
extern String buttonOut_KeyList;
|
extern String buttonOut_KeyList;
|
||||||
extern int buttonOut_EnterCounter;
|
extern int buttonOut_EnterCounter;
|
||||||
//=========================================
|
//=========================================
|
||||||
|
extern String input_KeyList;
|
||||||
|
extern int input_EnterCounter;
|
||||||
|
//=========================================
|
||||||
|
|
||||||
// Sensors
|
// Sensors
|
||||||
extern String sensorReadingMap10sec;
|
extern String sensorReadingMap10sec;
|
||||||
|
|||||||
@@ -16,4 +16,6 @@ String jsonWriteFloat(String& json, String name, float value);
|
|||||||
|
|
||||||
String jsonWriteBool(String& json, String name, boolean value);
|
String jsonWriteBool(String& json, String name, boolean value);
|
||||||
|
|
||||||
void saveConfig();
|
void saveConfig();
|
||||||
|
|
||||||
|
void saveLive();
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
//#pragma once
|
|
||||||
//#include <Arduino.h>
|
|
||||||
//
|
|
||||||
//#include "Class/LineParsing.h"
|
|
||||||
//#include "Global.h"
|
|
||||||
//
|
|
||||||
//class ButtonOutClass : public LineParsing {
|
|
||||||
//public:
|
|
||||||
// ButtonOutClass() : LineParsing() {};
|
|
||||||
//
|
|
||||||
// void init() {
|
|
||||||
// if (_pin != "") {
|
|
||||||
// pinMode(_pin.toInt(), OUTPUT);
|
|
||||||
// }
|
|
||||||
// jsonWriteStr(configOptionJson, _key + "_pin", _pin);
|
|
||||||
// jsonWriteStr(configOptionJson, _key + "_inv", _inv);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// void pinStateSetDefault() {
|
|
||||||
// pinChange(_key, _state);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// void pinChange(String key, String state) {
|
|
||||||
// String pin = jsonReadStr(configOptionJson, key + "_pin");
|
|
||||||
// String inv = jsonReadStr(configOptionJson, key + "_inv");
|
|
||||||
// int pinInt = pin.toInt();
|
|
||||||
//
|
|
||||||
// if (inv == "") {
|
|
||||||
// digitalWrite(pinInt, state.toInt());
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// digitalWrite(pinInt, !state.toInt());
|
|
||||||
// }
|
|
||||||
// eventGen2(key, state);
|
|
||||||
// jsonWriteInt(configLiveJson, key, state.toInt());
|
|
||||||
// publishStatus(key, state);
|
|
||||||
// }
|
|
||||||
//};
|
|
||||||
//
|
|
||||||
//extern ButtonOutClass myButtonOut;
|
|
||||||
@@ -3,29 +3,29 @@
|
|||||||
#include "Class/LineParsing.h"
|
#include "Class/LineParsing.h"
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
|
|
||||||
class InputClass : public LineParsing {
|
//class InputClass : public LineParsing {
|
||||||
public:
|
// public:
|
||||||
InputClass() : LineParsing(){};
|
// InputClass() : LineParsing(){};
|
||||||
|
//
|
||||||
void inputSetDefaultFloat() {
|
// void inputSetDefaultFloat() {
|
||||||
inputSetFloat(_key, _state);
|
// inputSetFloat(_key, _state);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
void inputSetDefaultStr() {
|
// void inputSetDefaultStr() {
|
||||||
inputSetStr(_key, _state);
|
// inputSetStr(_key, _state);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
void inputSetFloat(String key, String state) {
|
// void inputSetFloat(String key, String state) {
|
||||||
eventGen2(key, state);
|
// eventGen2(key, state);
|
||||||
jsonWriteFloat(configLiveJson, key, state.toFloat());
|
// jsonWriteFloat(configLiveJson, key, state.toFloat());
|
||||||
publishStatus(key, state);
|
// publishStatus(key, state);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
void inputSetStr(String key, String state) {
|
// void inputSetStr(String key, String state) {
|
||||||
eventGen2(key, state);
|
// eventGen2(key, state);
|
||||||
jsonWriteStr(configLiveJson, key, state);
|
// jsonWriteStr(configLiveJson, key, state);
|
||||||
publishStatus(key, state);
|
// publishStatus(key, state);
|
||||||
}
|
// }
|
||||||
};
|
//};
|
||||||
|
//
|
||||||
extern InputClass myInput;
|
//extern InputClass myInput;
|
||||||
@@ -14,7 +14,6 @@ class ButtonOut {
|
|||||||
|
|
||||||
~ButtonOut();
|
~ButtonOut();
|
||||||
|
|
||||||
void init();
|
|
||||||
void execute(String state);
|
void execute(String state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
29
include/items/vInput.h
Normal file
29
include/items/vInput.h
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
#include "Global.h"
|
||||||
|
|
||||||
|
class Input;
|
||||||
|
|
||||||
|
typedef std::vector<Input> MyInputVector;
|
||||||
|
|
||||||
|
class Input {
|
||||||
|
public:
|
||||||
|
|
||||||
|
Input(String key);
|
||||||
|
|
||||||
|
~Input();
|
||||||
|
|
||||||
|
void execute(String state);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
String _key;
|
||||||
|
|
||||||
|
void addNewDelOldData(const String filename, size_t maxPoints, String payload);
|
||||||
|
};
|
||||||
|
|
||||||
|
extern MyInputVector* myInput;
|
||||||
|
|
||||||
|
extern void input();
|
||||||
|
extern void inputExecute();
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "BufferExecute.h"
|
#include "BufferExecute.h"
|
||||||
//
|
//
|
||||||
#include "items/SensorDallas.h"
|
#include "items/vSensorDallas.h"
|
||||||
#include "items/ButtonOut.h"
|
#include "items/vButtonOut.h"
|
||||||
//
|
//
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "Module/Terminal.h"
|
#include "Module/Terminal.h"
|
||||||
@@ -46,10 +46,10 @@ void csvCmdExecute(String& cmdStr) {
|
|||||||
sCmd.addCommand(order.c_str(), buttonIn);
|
sCmd.addCommand(order.c_str(), buttonIn);
|
||||||
}
|
}
|
||||||
else if (order == F("input-digit")) {
|
else if (order == F("input-digit")) {
|
||||||
sCmd.addCommand(order.c_str(), inputDigit);
|
sCmd.addCommand(order.c_str(), input);
|
||||||
}
|
}
|
||||||
else if (order == F("input-time")) {
|
else if (order == F("input-time")) {
|
||||||
sCmd.addCommand(order.c_str(), inputTime);
|
//sCmd.addCommand(order.c_str(), inputTime);
|
||||||
}
|
}
|
||||||
else if (order == F("output-text")) {
|
else if (order == F("output-text")) {
|
||||||
sCmd.addCommand(order.c_str(), textOut);
|
sCmd.addCommand(order.c_str(), textOut);
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ int impuls_EnterCounter = -1;
|
|||||||
String buttonOut_KeyList = "";
|
String buttonOut_KeyList = "";
|
||||||
int buttonOut_EnterCounter = -1;
|
int buttonOut_EnterCounter = -1;
|
||||||
//=========================================
|
//=========================================
|
||||||
|
String input_KeyList = "";
|
||||||
|
int input_EnterCounter = -1;
|
||||||
|
//=========================================
|
||||||
|
|
||||||
// Sensors
|
// Sensors
|
||||||
String sensorReadingMap10sec;
|
String sensorReadingMap10sec;
|
||||||
|
|||||||
21
src/Init.cpp
21
src/Init.cpp
@@ -2,16 +2,21 @@
|
|||||||
#include "BufferExecute.h"
|
#include "BufferExecute.h"
|
||||||
#include "Cmd.h"
|
#include "Cmd.h"
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "items/Logging.h"
|
#include "items/vLogging.h"
|
||||||
#include "items/ImpulsOutClass.h"
|
#include "items/vImpulsOut.h"
|
||||||
#include "items/ButtonOut.h"
|
#include "items/vButtonOut.h"
|
||||||
#include "items/SensorDallas.h"
|
#include "items/vSensorDallas.h"
|
||||||
|
#include "items/vInput.h"
|
||||||
|
|
||||||
void loadConfig() {
|
void loadConfig() {
|
||||||
configSetupJson = readFile("config.json", 4096);
|
configSetupJson = readFile("config.json", 4096);
|
||||||
//configSetupJson.replace(" ", "");
|
|
||||||
configSetupJson.replace("\r\n", "");
|
configSetupJson.replace("\r\n", "");
|
||||||
|
|
||||||
|
#ifdef SAVE_SETTINGS_TO_FLASH
|
||||||
|
configLiveJson = readFile("live.json", 4096);
|
||||||
|
configLiveJson.replace("\r\n", "");
|
||||||
|
#endif
|
||||||
|
|
||||||
jsonWriteStr(configSetupJson, "chipID", chipId);
|
jsonWriteStr(configSetupJson, "chipID", chipId);
|
||||||
jsonWriteInt(configSetupJson, "firmware_version", FIRMWARE_VERSION);
|
jsonWriteInt(configSetupJson, "firmware_version", FIRMWARE_VERSION);
|
||||||
|
|
||||||
@@ -53,6 +58,12 @@ void Device_init() {
|
|||||||
}
|
}
|
||||||
buttonOut_KeyList = "";
|
buttonOut_KeyList = "";
|
||||||
buttonOut_EnterCounter = -1;
|
buttonOut_EnterCounter = -1;
|
||||||
|
//======clear input params=======
|
||||||
|
if (myInput != nullptr) {
|
||||||
|
myInput->clear();
|
||||||
|
}
|
||||||
|
input_KeyList = "";
|
||||||
|
input_EnterCounter = -1;
|
||||||
//===================================
|
//===================================
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
//#include "Module/Terminal.h"
|
//#include "Module/Terminal.h"
|
||||||
//#include "Servo/Servos.h"
|
//#include "Servo/Servos.h"
|
||||||
//
|
//
|
||||||
//#include "items/SensorDallas.h"
|
//#include "items/vSensorDallas.h"
|
||||||
//
|
//
|
||||||
//Terminal *term = nullptr;
|
//Terminal *term = nullptr;
|
||||||
//
|
//
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
//sCmd.addCommand("pwm-out", pwmOut);
|
//sCmd.addCommand("pwm-out", pwmOut);
|
||||||
//sCmd.addCommand("button-in", buttonIn);
|
//sCmd.addCommand("button-in", buttonIn);
|
||||||
|
|
||||||
//sCmd.addCommand("input-digit", inputDigit);
|
//sCmd.addCommand("input-digit", input);
|
||||||
//sCmd.addCommand("input-time", inputTime);
|
//sCmd.addCommand("input-time", inputTime);
|
||||||
//sCmd.addCommand("output-text", textOut);
|
//sCmd.addCommand("output-text", textOut);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "MqttClient.h"
|
#include "MqttClient.h"
|
||||||
|
|
||||||
#include <LittleFS.h>
|
#include <LittleFS.h>
|
||||||
#include "items/Logging.h"
|
#include "items/vLogging.h"
|
||||||
#include "Class/NotAsync.h"
|
#include "Class/NotAsync.h"
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "Init.h"
|
#include "Init.h"
|
||||||
|
|||||||
@@ -53,4 +53,10 @@ String jsonWriteFloat(String& json, String name, float value) {
|
|||||||
|
|
||||||
void saveConfig() {
|
void saveConfig() {
|
||||||
writeFile(String("config.json"), configSetupJson);
|
writeFile(String("config.json"), configSetupJson);
|
||||||
|
}
|
||||||
|
|
||||||
|
void saveLive() {
|
||||||
|
#ifdef SAVE_SETTINGS_TO_FLASH
|
||||||
|
writeFile(String("live.json"), configLiveJson);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "Init.h"
|
#include "Init.h"
|
||||||
#include "ItemsList.h"
|
#include "ItemsList.h"
|
||||||
#include "items/Logging.h"
|
#include "items/vLogging.h"
|
||||||
#include "Telegram.h"
|
#include "Telegram.h"
|
||||||
|
|
||||||
bool parseRequestForPreset(AsyncWebServerRequest* request, uint8_t& preset) {
|
bool parseRequestForPreset(AsyncWebServerRequest* request, uint8_t& preset) {
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
//#include "items/ButtonOutClass.h"
|
|
||||||
//
|
|
||||||
//#include "BufferExecute.h"
|
|
||||||
////==========================================Модуль кнопок===================================================
|
|
||||||
////button-out light toggle Кнопки Свет 1 pin[12] inv[1] st[1]
|
|
||||||
////==========================================================================================================
|
|
||||||
//ButtonOutClass myButtonOut;
|
|
||||||
//void buttonOut() {
|
|
||||||
// myButtonOut.update();
|
|
||||||
// String key = myButtonOut.gkey();
|
|
||||||
// String pin = myButtonOut.gpin();
|
|
||||||
// String inv = myButtonOut.ginv();
|
|
||||||
// sCmd.addCommand(key.c_str(), buttonOutSet);
|
|
||||||
// myButtonOut.init();
|
|
||||||
// myButtonOut.pinStateSetDefault();
|
|
||||||
// myButtonOut.clear();
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//void buttonOutSet() {
|
|
||||||
// String key = sCmd.order();
|
|
||||||
// String state = sCmd.next();
|
|
||||||
// myButtonOut.pinChange(key, state);
|
|
||||||
//}
|
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
#include "BufferExecute.h"
|
//#include "BufferExecute.h"
|
||||||
#include "items/InputClass.h"
|
//#include "items/InputClass.h"
|
||||||
//==========================================Модуль ввода цифровых значений==================================
|
////==========================================Модуль ввода цифровых значений==================================
|
||||||
//input-digit digit1 inputDigit Ввод Введите.цифру 4 st[60]
|
////input-digit digit1 inputDigit Ввод Введите.цифру 4 st[60]
|
||||||
//==========================================================================================================
|
////==========================================================================================================
|
||||||
InputClass myInputDigit;
|
//InputClass myInputDigit;
|
||||||
void inputDigit() {
|
//void inputDigit() {
|
||||||
myInputDigit.update();
|
// myInputDigit.update();
|
||||||
String key = myInputDigit.gkey();
|
// String key = myInputDigit.gkey();
|
||||||
sCmd.addCommand(key.c_str(), inputDigitSet);
|
// sCmd.addCommand(key.c_str(), inputDigitSet);
|
||||||
myInputDigit.inputSetDefaultFloat();
|
// myInputDigit.inputSetDefaultFloat();
|
||||||
myInputDigit.clear();
|
// myInputDigit.clear();
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void inputDigitSet() {
|
//void inputDigitSet() {
|
||||||
String key = sCmd.order();
|
// String key = sCmd.order();
|
||||||
String state = sCmd.next();
|
// String state = sCmd.next();
|
||||||
myInputDigit.inputSetFloat(key, state);
|
// myInputDigit.inputSetFloat(key, state);
|
||||||
}
|
//}
|
||||||
@@ -2,20 +2,20 @@
|
|||||||
#include "items/InputClass.h"
|
#include "items/InputClass.h"
|
||||||
//==========================================Модуль ввода времени============================================
|
//==========================================Модуль ввода времени============================================
|
||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
InputClass myInputTime;
|
//InputClass myInputTime;
|
||||||
void inputTime() {
|
//void inputTime() {
|
||||||
myInputTime.update();
|
// myInputTime.update();
|
||||||
String key = myInputTime.gkey();
|
// String key = myInputTime.gkey();
|
||||||
sCmd.addCommand(key.c_str(), inputTimeSet);
|
// sCmd.addCommand(key.c_str(), inputTimeSet);
|
||||||
myInputTime.inputSetDefaultStr();
|
// myInputTime.inputSetDefaultStr();
|
||||||
myInputTime.clear();
|
// myInputTime.clear();
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void inputTimeSet() {
|
//void inputTimeSet() {
|
||||||
String key = sCmd.order();
|
// String key = sCmd.order();
|
||||||
String state = sCmd.next();
|
// String state = sCmd.next();
|
||||||
myInputTime.inputSetStr(key, state);
|
// myInputTime.inputSetStr(key, state);
|
||||||
}
|
//}
|
||||||
|
|
||||||
void handle_time_init() {
|
void handle_time_init() {
|
||||||
ts.add(
|
ts.add(
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "items/ButtonOut.h"
|
#include "items/vButtonOut.h"
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
@@ -10,22 +10,28 @@ ButtonOut::ButtonOut(unsigned int pin, boolean inv, String key) {
|
|||||||
_pin = pin;
|
_pin = pin;
|
||||||
_inv = inv;
|
_inv = inv;
|
||||||
_key = key;
|
_key = key;
|
||||||
|
pinMode(_pin, OUTPUT);
|
||||||
|
int state = jsonReadInt(configLiveJson, key);
|
||||||
|
this->execute(String(state));
|
||||||
}
|
}
|
||||||
ButtonOut::~ButtonOut() {}
|
ButtonOut::~ButtonOut() {}
|
||||||
|
|
||||||
void ButtonOut::init() {
|
|
||||||
pinMode(_pin, OUTPUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ButtonOut::execute(String state) {
|
void ButtonOut::execute(String state) {
|
||||||
//if (_inv) {
|
if (state == "change") {
|
||||||
// digitalWrite(_pin, !state.toInt());
|
state = String(!digitalRead(_pin));
|
||||||
//}
|
digitalWrite(_pin, state.toInt());
|
||||||
//else {
|
}
|
||||||
digitalWrite(_pin, state.toInt());
|
else {
|
||||||
//}
|
if (_inv) {
|
||||||
|
digitalWrite(_pin, !state.toInt());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
digitalWrite(_pin, state.toInt());
|
||||||
|
}
|
||||||
|
}
|
||||||
eventGen2(_key, state);
|
eventGen2(_key, state);
|
||||||
jsonWriteInt(configLiveJson, _key, state.toInt());
|
jsonWriteInt(configLiveJson, _key, state.toInt());
|
||||||
|
saveLive();
|
||||||
publishStatus(_key, state);
|
publishStatus(_key, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,6 +42,10 @@ void buttonOut() {
|
|||||||
String key = myLineParsing.gkey();
|
String key = myLineParsing.gkey();
|
||||||
String pin = myLineParsing.gpin();
|
String pin = myLineParsing.gpin();
|
||||||
String inv = myLineParsing.ginv();
|
String inv = myLineParsing.ginv();
|
||||||
|
|
||||||
|
bool invb = false;
|
||||||
|
if (inv.toInt() == 1) invb = true;
|
||||||
|
|
||||||
myLineParsing.clear();
|
myLineParsing.clear();
|
||||||
|
|
||||||
buttonOut_EnterCounter++;
|
buttonOut_EnterCounter++;
|
||||||
@@ -44,7 +54,7 @@ void buttonOut() {
|
|||||||
static bool firstTime = true;
|
static bool firstTime = true;
|
||||||
if (firstTime) myButtonOut = new MyButtonOutVector();
|
if (firstTime) myButtonOut = new MyButtonOutVector();
|
||||||
firstTime = false;
|
firstTime = false;
|
||||||
myButtonOut->push_back(ButtonOut(pin.toInt(), inv.toInt(), key));
|
myButtonOut->push_back(ButtonOut(pin.toInt(), invb, key));
|
||||||
|
|
||||||
sCmd.addCommand(key.c_str(), buttonOutExecute);
|
sCmd.addCommand(key.c_str(), buttonOutExecute);
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "items/ImpulsOutClass.h"
|
#include "items/vImpulsOut.h"
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "BufferExecute.h"
|
#include "BufferExecute.h"
|
||||||
53
src/items/vInput.cpp
Normal file
53
src/items/vInput.cpp
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
#include "items/vInput.h"
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
#include "Class/LineParsing.h"
|
||||||
|
#include "Global.h"
|
||||||
|
#include "BufferExecute.h"
|
||||||
|
|
||||||
|
Input::Input(String key) {
|
||||||
|
_key = key;
|
||||||
|
String value = jsonReadStr(configLiveJson, key);
|
||||||
|
this->execute(value);
|
||||||
|
}
|
||||||
|
Input::~Input() {}
|
||||||
|
|
||||||
|
void Input::execute(String state) {
|
||||||
|
eventGen2(_key, state);
|
||||||
|
jsonWriteInt(configLiveJson, _key, state.toInt());
|
||||||
|
saveLive();
|
||||||
|
publishStatus(_key, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
MyInputVector* myInput = nullptr;
|
||||||
|
|
||||||
|
void input() {
|
||||||
|
myLineParsing.update();
|
||||||
|
String key = myLineParsing.gkey();
|
||||||
|
myLineParsing.clear();
|
||||||
|
|
||||||
|
input_EnterCounter++;
|
||||||
|
addKey(key, input_KeyList, input_EnterCounter);
|
||||||
|
|
||||||
|
static bool firstTime = true;
|
||||||
|
if (firstTime) myInput = new MyInputVector();
|
||||||
|
firstTime = false;
|
||||||
|
myInput->push_back(Input(key));
|
||||||
|
|
||||||
|
sCmd.addCommand(key.c_str(), inputExecute);
|
||||||
|
}
|
||||||
|
|
||||||
|
void inputExecute() {
|
||||||
|
String key = sCmd.order();
|
||||||
|
String state = sCmd.next();
|
||||||
|
|
||||||
|
int number = getKeyNum(key, input_KeyList);
|
||||||
|
|
||||||
|
if (myInput != nullptr) {
|
||||||
|
if (number != -1) {
|
||||||
|
myInput->at(number).execute(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "items/Logging.h"
|
#include "items/vLogging.h"
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
@@ -120,5 +120,6 @@ void clean_log_date() {
|
|||||||
SerialPrint("I", "System", fname);
|
SerialPrint("I", "System", fname);
|
||||||
removeFile("logs/" + fname);
|
removeFile("logs/" + fname);
|
||||||
}
|
}
|
||||||
|
removeFile("live.json");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "items/SensorDallas.h"
|
#include "items/vSensorDallas.h"
|
||||||
#include "Class/LineParsing.h"
|
#include "Class/LineParsing.h"
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "BufferExecute.h"
|
#include "BufferExecute.h"
|
||||||
@@ -15,9 +15,9 @@
|
|||||||
#include "Utils/Timings.h"
|
#include "Utils/Timings.h"
|
||||||
#include "Utils/WebUtils.h"
|
#include "Utils/WebUtils.h"
|
||||||
#include "items/ButtonInClass.h"
|
#include "items/ButtonInClass.h"
|
||||||
#include "items/Logging.h"
|
#include "items/vLogging.h"
|
||||||
#include "items/ImpulsOutClass.h"
|
#include "items/vImpulsOut.h"
|
||||||
#include "items/SensorDallas.h"
|
#include "items/vSensorDallas.h"
|
||||||
#include "Telegram.h"
|
#include "Telegram.h"
|
||||||
|
|
||||||
void not_async_actions();
|
void not_async_actions();
|
||||||
|
|||||||
Reference in New Issue
Block a user