mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
widgets
This commit is contained in:
@@ -103,12 +103,13 @@ void CMD_init() {
|
|||||||
//==========================================================================================================
|
//==========================================================================================================
|
||||||
//==========================================Модуль кнопок===================================================
|
//==========================================Модуль кнопок===================================================
|
||||||
void button() {
|
void button() {
|
||||||
|
pm.info("create button");
|
||||||
String button_number = sCmd.next();
|
String button_number = sCmd.next();
|
||||||
String button_param = sCmd.next();
|
String button_param = sCmd.next();
|
||||||
String widget_name = sCmd.next();
|
String widget = sCmd.next();
|
||||||
String page_name = sCmd.next();
|
String page = sCmd.next();
|
||||||
String start_state = sCmd.next();
|
String start_state = sCmd.next();
|
||||||
String page_number = sCmd.next();
|
String pageNumber = sCmd.next();
|
||||||
|
|
||||||
jsonWriteStr(configOptionJson, "button_param" + button_number, button_param);
|
jsonWriteStr(configOptionJson, "button_param" + button_number, button_param);
|
||||||
jsonWriteStr(configLiveJson, "button" + button_number, start_state);
|
jsonWriteStr(configLiveJson, "button" + button_number, start_state);
|
||||||
@@ -137,7 +138,7 @@ void button() {
|
|||||||
str = deleteBeforeDelimiter(str, ",");
|
str = deleteBeforeDelimiter(str, ",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
createWidget(widget_name, page_name, page_number, "toggle", "button" + button_number);
|
createWidget(widget, page, pageNumber, "toggle", "button" + button_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
void buttonSet() {
|
void buttonSet() {
|
||||||
|
|||||||
@@ -118,7 +118,8 @@ const String readFile(const String& filename, size_t max_size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const String getFileSize(const String filename) {
|
const String getFileSize(const String filename) {
|
||||||
auto file = LittleFS.open(filepath(filename), "r");
|
String filepath(filename);
|
||||||
|
auto file = LittleFS.open(filepath, "r");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
return "failed";
|
return "failed";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ static const char* MODULE = "Widget";
|
|||||||
const String getWidgetFile(const String& name);
|
const String getWidgetFile(const String& name);
|
||||||
|
|
||||||
bool loadWidget(const String& filename, String& buf) {
|
bool loadWidget(const String& filename, String& buf) {
|
||||||
buf = readFile(filename, 2048);
|
buf = readFile(getWidgetFile(filename), 2048);
|
||||||
bool res = !(buf == "Failed" || buf == "Large");
|
bool res = !(buf == "Failed" || buf == "Large");
|
||||||
if (!res) {
|
if (!res) {
|
||||||
pm.error("on load" + filename);
|
pm.error("on load" + filename);
|
||||||
|
|||||||
Reference in New Issue
Block a user