From 5490fac28dd57cdaf31cb218b431298aa8fcbefa Mon Sep 17 00:00:00 2001 From: Tester23 Date: Mon, 2 Dec 2024 00:31:56 +0100 Subject: [PATCH] extend Ch command so that it can also force an index to send... --- src/httpserver/json_interface.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/httpserver/json_interface.c b/src/httpserver/json_interface.c index d3993e21b..e92a50159 100644 --- a/src/httpserver/json_interface.c +++ b/src/httpserver/json_interface.c @@ -505,14 +505,14 @@ static int http_tasmota_json_status_FWR(void* request, jsonCb_t printer) { printer(request, "}"); return 0; } -static int http_obk_json_channels(void* request, jsonCb_t printer) { +static int http_obk_json_channels(void* request, jsonCb_t printer, int includeIndex) { int i; int iCnt = 0; char tmp[8]; printer(request, "{"); for (i = 0; i < CHANNEL_MAX; i++) { - if (CHANNEL_IsInUse(i)) { + if (CHANNEL_IsInUse(i) || i == includeIndex) { if (iCnt) { printer(request, ","); } @@ -1057,7 +1057,11 @@ int JSON_ProcessCommandReply(const char* cmd, const char* arg, void* request, js printer(request, "}"); } else if (!wal_strnicmp(cmd, "Ch", 2)) { - http_obk_json_channels(request, printer); + int includeIndex = -1; + if (cmd[2]) { + includeIndex = atoi(cmd + 2); + } + http_obk_json_channels(request, printer, includeIndex); } #ifndef OBK_DISABLE_ALL_DRIVERS #if ENABLE_DRIVER_TUYAMCU