Skip to content

Commit 0adaebb

Browse files
chrislanzaraclaude
authored andcommitted
Add optional SBS RSSI field (field 23) using --devel=sbs_rssi
Adds signal level (dBFS) as an optional 23rd field in SBS/BaseStation output. Only emitted when invoked with --devel=sbs_rssi; off by default so existing consumers are unaffected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b499ecb commit 0adaebb

4 files changed

Lines changed: 26 additions & 2 deletions

File tree

net_io.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3560,6 +3560,15 @@ static void modesSendSBSOutput(struct modesMessage *mm, struct aircraft *a, stru
35603560
break;
35613561
}
35623562

3563+
if (Modes.sbs_rssi) {
3564+
// Field 23 is the RSSI in dBFS (if we have it)
3565+
if (mm->signalLevel > 0) {
3566+
p += sprintf(p, ",%.1f", 10.0 * log10(mm->signalLevel));
3567+
} else {
3568+
p += sprintf(p, ",");
3569+
}
3570+
}
3571+
35633572
p += sprintf(p, "\r\n");
35643573

35653574
completeWrite(writer, p);

readsb.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,6 +2183,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
21832183
if (strcasecmp(token[0], "ifile_no_synthetic") == 0) {
21842184
Modes.ifile_no_synthetic = 1;
21852185
}
2186+
if (strcasecmp(token[0], "sbs_rssi") == 0) {
2187+
Modes.sbs_rssi = 1;
2188+
}
21862189
if (strcasecmp(token[0], "accept_synthetic") == 0) {
21872190
Modes.dump_accept_synthetic_now = 1;
21882191
}

readsb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,7 @@ struct _Modes
770770
int8_t dump_ignore_synthetic_now;
771771
int8_t syntethic_now_suppress_errors;
772772
int8_t ifile_no_synthetic;
773+
int8_t sbs_rssi;
773774
int8_t tar1090_use_api;
774775
int8_t verbose;
775776

util.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,9 +1130,20 @@ void dump_beast_check(int64_t now) {
11301130
char tstring[100];
11311131
strftime (tstring, 100, "%H%M%S", &utc);
11321132

1133-
11341133
char pathbuf[PATH_MAX];
1135-
snprintf(pathbuf, PATH_MAX, "%s/%sZ.zst", Modes.dump_beast_dir, tstring);
1134+
1135+
if (0) {
1136+
char datestring[20];
1137+
strftime(datestring, sizeof(datestring), "%Y-%m-%d", &utc);
1138+
1139+
char dirpath[PATH_MAX];
1140+
snprintf(dirpath, PATH_MAX, "%s/%s", Modes.dump_beast_dir, datestring);
1141+
mkdir(dirpath, 0755); // creates dated subdir; EEXIST is fine
1142+
1143+
snprintf(pathbuf, PATH_MAX, "%s/%sZ.zst", dirpath, tstring);
1144+
} else {
1145+
snprintf(pathbuf, PATH_MAX, "%s/%sZ.zst", Modes.dump_beast_dir, tstring);
1146+
}
11361147

11371148
// unless we just restarted, delete the file
11381149
if (!startup) {

0 commit comments

Comments
 (0)