This commit is contained in:
Yuri Trikoz
2020-06-25 07:08:09 +03:00
parent b50e1c9791
commit 5ed1c23c62
3 changed files with 8 additions and 6 deletions

View File

@@ -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() {

View File

@@ -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";
}

View File

@@ -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);