mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 06:32:19 +03:00
output text module added
This commit is contained in:
1
data/items/button-out-np.txt
Normal file
1
data/items/button-out-np.txt
Normal file
@@ -0,0 +1 @@
|
||||
button-out;id;toggle;Кнопки;Освещение;order;st[0]
|
||||
@@ -1 +1 @@
|
||||
input-digit;id;inputDigit;Ввод;Введите.цифру;order;st[60]
|
||||
input-digit;id;inputDigit;Ввод;Введите#цифру;order;st[60]
|
||||
@@ -1 +1 @@
|
||||
input-time;id;inputTime;Ввод;Введите.время;order;st[10-00-00]
|
||||
input-time;id;inputTime;Ввод;Введите#время;order;st[10-00-00]
|
||||
1
data/items/output-text.txt
Normal file
1
data/items/output-text.txt
Normal file
@@ -0,0 +1 @@
|
||||
output-text;id;anydata;Вывод;Сигнализация;order;st[Обнаружено#движение]
|
||||
@@ -55,11 +55,13 @@
|
||||
"style": "display:inline",
|
||||
"title": {
|
||||
"#": "Выберите элемент из списка<span class=\"caret\"></span>",
|
||||
"/set?addItem=button-out": "1.Кнопка управляющая пином",
|
||||
"/set?addItem=pwm-out": "2.Широтно импульсная модуляция(pwm)",
|
||||
"/set?addItem=button-in": "3.Физическая кнопка",
|
||||
"/set?addItem=input-digit": "4.Окно ввода цифровых значений",
|
||||
"/set?addItem=input-time": "5.Окно ввода времени"
|
||||
"/set?addItem=button-out-p": "1.Кнопка управляющая пином",
|
||||
"/set?addItem=button-out-np": "2.Кнопка не привязанная к пину",
|
||||
"/set?addItem=pwm-out": "3.Широтно импульсная модуляция(pwm)",
|
||||
"/set?addItem=button-in": "4.Физическая кнопка",
|
||||
"/set?addItem=input-digit": "5.Окно ввода цифровых значений",
|
||||
"/set?addItem=input-time": "6.Окно ввода времени",
|
||||
"/set?addItem=output-text": "7.Окно вывода любого текста, предупреждения, цифры"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -23,4 +23,4 @@ class CallBackTest {
|
||||
void setCallback(AsyncActionCb cb);
|
||||
void setCallback(AsyncParamActionCb pcb);
|
||||
};
|
||||
extern CallBackTest* CB;
|
||||
//extern CallBackTest* CB;
|
||||
@@ -66,10 +66,11 @@ class LineParsing {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_page.replace("#", " ");
|
||||
_descr.replace("#", " ");
|
||||
_page.replace(".", " ");
|
||||
_descr.replace(".", " ");
|
||||
|
||||
_descr.replace("#", " ");
|
||||
|
||||
createWidgetClass(_descr, _page, _order, _file, _key);
|
||||
}
|
||||
|
||||
@@ -124,8 +125,6 @@ class LineParsing {
|
||||
if (!loadWidgetClass(filename, buf)) {
|
||||
return;
|
||||
}
|
||||
descr.replace("#", " ");
|
||||
page.replace("#", " ");
|
||||
|
||||
jsonWriteStr(buf, "page", page);
|
||||
jsonWriteStr(buf, "order", order);
|
||||
|
||||
24
include/Class/OutputModule.h
Normal file
24
include/Class/OutputModule.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "Class/LineParsing.h"
|
||||
#include "Global.h"
|
||||
|
||||
class OutputModule : public LineParsing {
|
||||
public:
|
||||
OutputModule() : LineParsing(){};
|
||||
|
||||
void OutputModuleStateSetDefault() {
|
||||
if (_state != "") {
|
||||
OutputModuleChange(_key, _state);
|
||||
}
|
||||
}
|
||||
|
||||
void OutputModuleChange(String key, String state) {
|
||||
state.replace("#", " ");
|
||||
eventGen(key, "");
|
||||
jsonWriteStr(configLiveJson, key, state);
|
||||
MqttClient::publishStatus(key, state);
|
||||
}
|
||||
};
|
||||
extern OutputModule* myText;
|
||||
@@ -19,8 +19,8 @@ extern void inputDigitSet();
|
||||
extern void inputTime();
|
||||
extern void inputTimeSet();
|
||||
|
||||
extern void text();
|
||||
extern void textSet();
|
||||
extern void textOut();
|
||||
extern void textOutSet();
|
||||
|
||||
extern void handle_time_init();
|
||||
extern void stepper();
|
||||
|
||||
@@ -37,7 +37,7 @@ void CallBackTest::setCallback(AsyncActionCb cb) {
|
||||
void CallBackTest::setCallback(AsyncParamActionCb pcb) {
|
||||
_pcb = pcb;
|
||||
}
|
||||
CallBackTest* CB;
|
||||
//CallBackTest* CB;
|
||||
|
||||
//CB->setCallback([]() {
|
||||
// Serial.println("123");
|
||||
|
||||
2
src/Class/OutputModule.cpp
Normal file
2
src/Class/OutputModule.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "Class/OutputModule.h"
|
||||
OutputModule* myText;
|
||||
60
src/Cmd.cpp
60
src/Cmd.cpp
@@ -5,6 +5,7 @@
|
||||
#include "Class/LineParsing.h"
|
||||
#include "Class/Pwm.h"
|
||||
#include "Class/Switch.h"
|
||||
#include "Class/OutputModule.h"
|
||||
//-----------------------------
|
||||
#include "Class/NotAsinc.h"
|
||||
#include "Global.h"
|
||||
@@ -32,9 +33,8 @@ void cmd_init() {
|
||||
sCmd.addCommand("button-in", buttonIn);
|
||||
sCmd.addCommand("input-digit", inputDigit);
|
||||
sCmd.addCommand("input-time", inputTime);
|
||||
sCmd.addCommand("output-text", textOut);
|
||||
|
||||
sCmd.addCommand("text", text);
|
||||
sCmd.addCommand("textSet", textSet);
|
||||
|
||||
|
||||
|
||||
@@ -235,29 +235,45 @@ void handle_time_init() {
|
||||
//===============================================Модуль вывода текста============================================
|
||||
//output-text;id;anydata;Вывод;Сигнализация;order;st[Обнаружено.движение]
|
||||
//===============================================================================================================
|
||||
void text() {
|
||||
String number = sCmd.next();
|
||||
String widget_name = sCmd.next();
|
||||
String page_name = sCmd.next();
|
||||
String page_number = sCmd.next();
|
||||
|
||||
createWidget(widget_name, page_name, page_number, "anydata", "text" + number);
|
||||
void textOut() {
|
||||
myText = new OutputModule();
|
||||
myText->update();
|
||||
String key = myText->gkey();
|
||||
sCmd.addCommand(key.c_str(), textOutSet);
|
||||
myText->OutputModuleStateSetDefault();
|
||||
myText->clear();
|
||||
}
|
||||
|
||||
void textSet() {
|
||||
String number = sCmd.next();
|
||||
String text = sCmd.next();
|
||||
text.replace("_", " ");
|
||||
|
||||
if (text.indexOf("-time") >= 0) {
|
||||
text.replace("-time", "");
|
||||
text.replace("#", " ");
|
||||
text = text + " " + timeNow->getDateTimeDotFormated();
|
||||
}
|
||||
|
||||
jsonWriteStr(configLiveJson, "text" + number, text);
|
||||
MqttClient::publishStatus("text" + number, text);
|
||||
void textOutSet() {
|
||||
String key = sCmd.order();
|
||||
String state = sCmd.next();
|
||||
myText->OutputModuleChange(key, state);
|
||||
}
|
||||
|
||||
|
||||
//void text() {
|
||||
// String number = sCmd.next();
|
||||
// String widget_name = sCmd.next();
|
||||
// String page_name = sCmd.next();
|
||||
// String page_number = sCmd.next();
|
||||
//
|
||||
// createWidget(widget_name, page_name, page_number, "anydata", "text" + number);
|
||||
//}
|
||||
//
|
||||
//void textSet() {
|
||||
// String number = sCmd.next();
|
||||
// String text = sCmd.next();
|
||||
// text.replace("_", " ");
|
||||
//
|
||||
// if (text.indexOf("-time") >= 0) {
|
||||
// text.replace("-time", "");
|
||||
// text.replace("#", " ");
|
||||
// text = text + " " + timeNow->getDateTimeDotFormated();
|
||||
// }
|
||||
//
|
||||
// jsonWriteStr(configLiveJson, "text" + number, text);
|
||||
// MqttClient::publishStatus("text" + number, text);
|
||||
//}
|
||||
//=====================================================================================================================================
|
||||
//=========================================Модуль шагового мотора======================================================================
|
||||
#ifdef STEPPER_ENABLED
|
||||
|
||||
Reference in New Issue
Block a user