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() {
|
||||
pm.info("create button");
|
||||
String button_number = sCmd.next();
|
||||
String button_param = sCmd.next();
|
||||
String widget_name = sCmd.next();
|
||||
String page_name = sCmd.next();
|
||||
String widget = sCmd.next();
|
||||
String page = 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(configLiveJson, "button" + button_number, start_state);
|
||||
@@ -137,7 +138,7 @@ void button() {
|
||||
str = deleteBeforeDelimiter(str, ",");
|
||||
}
|
||||
}
|
||||
createWidget(widget_name, page_name, page_number, "toggle", "button" + button_number);
|
||||
createWidget(widget, page, pageNumber, "toggle", "button" + button_number);
|
||||
}
|
||||
|
||||
void buttonSet() {
|
||||
|
||||
@@ -118,7 +118,8 @@ const String readFile(const String& filename, size_t max_size) {
|
||||
}
|
||||
|
||||
const String getFileSize(const String filename) {
|
||||
auto file = LittleFS.open(filepath(filename), "r");
|
||||
String filepath(filename);
|
||||
auto file = LittleFS.open(filepath, "r");
|
||||
if (!file) {
|
||||
return "failed";
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ static const char* MODULE = "Widget";
|
||||
const String getWidgetFile(const String& name);
|
||||
|
||||
bool loadWidget(const String& filename, String& buf) {
|
||||
buf = readFile(filename, 2048);
|
||||
buf = readFile(getWidgetFile(filename), 2048);
|
||||
bool res = !(buf == "Failed" || buf == "Large");
|
||||
if (!res) {
|
||||
pm.error("on load" + filename);
|
||||
|
||||
Reference in New Issue
Block a user