diff --git a/src/Cmd.cpp b/src/Cmd.cpp index 137af855..c49a60d2 100644 --- a/src/Cmd.cpp +++ b/src/Cmd.cpp @@ -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() { diff --git a/src/Utils/FileUtils.cpp b/src/Utils/FileUtils.cpp index 03a34862..16975564 100644 --- a/src/Utils/FileUtils.cpp +++ b/src/Utils/FileUtils.cpp @@ -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"; } diff --git a/src/Widgets.cpp b/src/Widgets.cpp index 52334cc4..3acad28c 100644 --- a/src/Widgets.cpp +++ b/src/Widgets.cpp @@ -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);