Skip to content

Commit

Permalink
add range outline reset via setGain file
Browse files Browse the repository at this point in the history
echo resetRangeOutline > /run/readsb/setGain
  • Loading branch information
wiedehopf committed Nov 15, 2024
1 parent 7c34ff3 commit e8de536
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion readsb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand All @@ -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;
}

Expand Down

0 comments on commit e8de536

Please sign in to comment.