From daec0e0231cc742bf5e93f6028d2a84f2683e9eb Mon Sep 17 00:00:00 2001 From: bogdan Date: Sun, 7 May 2023 17:24:16 +0200 Subject: [PATCH] implemented front for last action, doxygen added --- HTML/res/cron.js | 6 ++++++ main/src/CronTimers.c | 1 + main/src/HTTPPostCustom.c | 4 +++- main/src/HTTPPrintCustom.c | 3 ++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/HTML/res/cron.js b/HTML/res/cron.js index d7c3d56..0991f1c 100644 --- a/HTML/res/cron.js +++ b/HTML/res/cron.js @@ -214,6 +214,12 @@ function drawtimers(tarr) { var enb = (tarr[i - 1].enab == 1) ? "checked" : ""; content += (""); + content += ("
"); + content +=(""); + enb = (tarr[i - 1].prev == 1) ? "checked" : ""; + content += ("
"); + + content += ("
"); content +=(""); content += ("
"); diff --git a/main/src/CronTimers.c b/main/src/CronTimers.c index ad23fc8..321c031 100644 --- a/main/src/CronTimers.c +++ b/main/src/CronTimers.c @@ -92,6 +92,7 @@ static void ExecuteLastAction() { if (GetAppConf()->Timers[shdl].enab && !GetAppConf()->Timers[shdl].del && + GetAppConf()->Timers[shdl].prev && GetAppConf()->Timers[shdl].obj == obj) { cron_expr cron_exp = { 0 }; diff --git a/main/src/HTTPPostCustom.c b/main/src/HTTPPostCustom.c index a6f00ee..4c779e6 100644 --- a/main/src/HTTPPostCustom.c +++ b/main/src/HTTPPostCustom.c @@ -66,12 +66,14 @@ static HTTP_IO_RESULT HTTPPostApplication(httpd_req_t *req, char *PostData) if (result.dataType == JREAD_OBJECT) { T.num = jRead_int(tmp, "{'num'", NULL); + T.del = jRead_int(tmp, "{'del'", NULL); T.enab = jRead_int(tmp, "{'enab'", NULL); + T.prev = jRead_int(tmp, "{'prev'", NULL); jRead_string(tmp, "{'name'", T.name, sizeof(T.name), NULL); T.obj = jRead_int(tmp, "{'obj'", NULL); T.act = jRead_int(tmp, "{'act'", NULL); jRead_string(tmp, "{'cron'", T.cron, sizeof(T.cron), NULL); - T.del = jRead_int(tmp, "{'del'", NULL); + memcpy(&GetAppConf()->Timers[T.num-1], &T, sizeof(cron_timer_t)); WriteNVSAppConfig(GetAppConf()); ReloadCronSheduler(); diff --git a/main/src/HTTPPrintCustom.c b/main/src/HTTPPrintCustom.c index d278572..119296c 100644 --- a/main/src/HTTPPrintCustom.c +++ b/main/src/HTTPPrintCustom.c @@ -35,12 +35,13 @@ static void HTTPPrint_crontmr(char *VarData, void *arg) memcpy(&T, &GetAppConf()->Timers[idx], sizeof(cron_timer_t)); jwOpen(data, sizeof(data), JW_OBJECT, JW_COMPACT); jwObj_int("num", (unsigned int) T.num); + jwObj_int("del", (T.del)?1:0); jwObj_int("enab", (T.enab)?1:0); + jwObj_int("prev", (T.prev)?1:0); jwObj_string("name", T.name); jwObj_int("obj", (unsigned int) T.obj); jwObj_int("act", (unsigned int) T.act); jwObj_string("cron", T.cron); - jwObj_int("del", (T.del)?1:0); jwEnd(); jwClose(); snprintf(VarData, MAX_DYNVAR_LENGTH, "%s", data);