From e8de536829ae5c69b3f8e2e6d13333c5cbeec378 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Fri, 15 Nov 2024 10:45:04 +0100 Subject: [PATCH] add range outline reset via setGain file echo resetRangeOutline > /run/readsb/setGain --- readsb.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/readsb.c b/readsb.c index 217296f2..d79e9a69 100644 --- a/readsb.c +++ b/readsb.c @@ -2634,6 +2634,13 @@ static void checkReplaceState() { checkReplaceStateDir(Modes.json_dir); } +static void writeOutlineJson() { + if (!Modes.json_dir) { + return; + } + free(writeJsonToFile(Modes.json_dir, "outline.json", generateOutlineJson()).buffer); +} + static void checkSetGain() { if (!Modes.json_dir) { return; @@ -2655,6 +2662,12 @@ static void checkSetGain() { tmp[len] = '\0'; + if (strcasestr(tmp, "resetRangeOutline")) { + fprintf(stderr, "resetting range outline\n"); + memset(Modes.rangeDirs, 0, sizeof(Modes.rangeDirs)); + writeOutlineJson(); + return; + } parseGainOpt(tmp); @@ -2670,7 +2683,7 @@ static void miscStuff(int64_t now) { if (Modes.outline_json) { static int64_t nextOutlineWrite; if (now > nextOutlineWrite) { - free(writeJsonToFile(Modes.json_dir, "outline.json", generateOutlineJson()).buffer); + writeOutlineJson(); nextOutlineWrite = now + 15 * SECONDS; }