From b7f7beb0497c1b89a7cfca19fef21b8f51b6fa9a Mon Sep 17 00:00:00 2001 From: Indu Prakash <6459774+iprak@users.noreply.github.com> Date: Wed, 15 Feb 2023 13:22:09 -0600 Subject: [PATCH] Accept empty startup command (#672) * Accept empty startup command * Fix to clear only on submit --- src/httpserver/http_fns.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/httpserver/http_fns.c b/src/httpserver/http_fns.c index aaca68b1e..daaa80251 100644 --- a/src/httpserver/http_fns.c +++ b/src/httpserver/http_fns.c @@ -1500,18 +1500,17 @@ int http_fn_startup_command(http_request_t* request) { "You can use them to init peripherals and drivers, like BL0942 energy sensor. " "Use backlog cmd1; cmd2; cmd3; etc to enter multiple commands

"); - if (http_getArg(request->url, "data", tmpA, sizeof(tmpA))) { + if (http_getArg(request->url, "startup_cmd", tmpA, sizeof(tmpA))) { + http_getArg(request->url, "data", tmpA, sizeof(tmpA)); // hprintf255(request,"

Set command to %s!

",tmpA); - // tmpA can be longer than 128 bytes and this would crash + // tmpA can be longer than 128 bytes and this would crash hprintf255(request, "

Command changed!

"); CFG_SetShortStartupCommand(tmpA); - CFG_Save_IfThereArePendingChanges(); } - else { - } add_label_text_field(request, "Startup command", "data", CFG_GetShortStartupCommand(), "
"); + poststr(request, ""); poststr(request, SUBMIT_AND_END_FORM); poststr(request, htmlFooterReturnToCfgLink);