Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion demod_2400.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ void demodulate2400(struct mag_buf *mag)
int bestscore, bestphase;

// maximum lookahead we use
assert(mag->overlap >= 19 + 1 + 269);
if (mag->overlap < 19 + 1 + 269) {
fprintf(stderr, "insufficient overlap for signal power measurement\n");
return;
}

uint16_t *m = mag->data;
uint32_t mlen = mag->validLength - mag->overlap;
Expand Down
12 changes: 8 additions & 4 deletions net_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2079,6 +2079,7 @@ char *generateStatsJson(const char *url_path, int *len) {
char *generateReceiverJson(const char *url_path, int *len)
{
char *buf = (char *) malloc(1024), *p = buf;
char *end = buf + 1024;
int history_size;

MODES_NOTUSED(url_path);
Expand All @@ -2089,27 +2090,27 @@ char *generateReceiverJson(const char *url_path, int *len)
else
history_size = HISTORY_SIZE;

p += sprintf(p, "{ " \
p = safe_snprintf(p, end, "{ " \
"\"version\" : \"%s\", "
"\"refresh\" : %.0f, "
"\"history\" : %d",
MODES_DUMP1090_VERSION, 1.0*Modes.json_interval, history_size);

if (Modes.json_location_accuracy && (Modes.fUserLat != 0.0 || Modes.fUserLon != 0.0)) {
if (Modes.json_location_accuracy == 1) {
p += sprintf(p, ", " \
p = safe_snprintf(p, end, ", " \
"\"lat\" : %.2f, "
"\"lon\" : %.2f",
Modes.fUserLat, Modes.fUserLon); // round to 2dp - about 0.5-1km accuracy - for privacy reasons
} else {
p += sprintf(p, ", " \
p = safe_snprintf(p, end, ", " \
"\"lat\" : %.6f, "
"\"lon\" : %.6f",
Modes.fUserLat, Modes.fUserLon); // exact location
}
}

p += sprintf(p, " }\n");
p = safe_snprintf(p, end, " }\n");

*len = (p - buf);
return buf;
Expand Down Expand Up @@ -2324,6 +2325,9 @@ static void modesReadFromClient(struct client *c) {
if (0x1A == *p) {
p++;
eom++;
if (eom > eod + MODES_LONG_MSG_BYTES) {
break; // Sanity limit
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions view1090.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ int main(int argc, char **argv) {
}
} else if (!strcmp(argv[j], "--interactive-callsign-filter") && more) {
Modes.interactive_callsign_filter = strdup(argv[++j]);
if (!Modes.interactive_callsign_filter) {
fprintf(stderr, "out of memory\n");
exit(1);
}
} else if (!strcmp(argv[j], "--lat") && more) {
Modes.fUserLat = atof(argv[++j]);
} else if (!strcmp(argv[j],"--lon") && more) {
Expand Down