cleaning up unused
Former-commit-id: 28877253544f45f3037bc5214478df8fb2536ce0 Former-commit-id: c3fef4350543beba9e002116f09124abe67deb2e
This commit is contained in:
parent
c338cb7340
commit
e2de0076c2
2
TODO.md
2
TODO.md
|
@ -16,7 +16,7 @@ battery level (need separate linux/win/android)
|
||||||
|
|
||||||
|
|
||||||
Utility stuff
|
Utility stuff
|
||||||
zipped map load (and write from python) --> start by reducing lat/lon precision to 4 or 5 decimal places and change storage to float instead of double
|
+map load (and write from python) --> start by reducing lat/lon precision to 4 or 5 decimal places and change storage to float instead of double
|
||||||
libconfig load settings
|
libconfig load settings
|
||||||
|
|
||||||
Platforms
|
Platforms
|
||||||
|
|
7
font.c
7
font.c
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
TTF_Font *loadFont(char *name, int size)
|
TTF_Font *loadFont(char *name, int size)
|
||||||
{
|
{
|
||||||
/* Use SDL_TTF to load the font at the specified size */
|
|
||||||
TTF_Font *font = TTF_OpenFont(name, size);
|
TTF_Font *font = TTF_OpenFont(name, size);
|
||||||
|
|
||||||
if (font == NULL)
|
if (font == NULL)
|
||||||
|
@ -17,9 +16,7 @@ TTF_Font *loadFont(char *name, int size)
|
||||||
}
|
}
|
||||||
|
|
||||||
void closeFont(TTF_Font *font)
|
void closeFont(TTF_Font *font)
|
||||||
{
|
{
|
||||||
/* Close the font once we're done with it */
|
|
||||||
|
|
||||||
if (font != NULL)
|
if (font != NULL)
|
||||||
{
|
{
|
||||||
TTF_CloseFont(font);
|
TTF_CloseFont(font);
|
||||||
|
@ -44,8 +41,6 @@ void drawString(char * text, int x, int y, TTF_Font *font, SDL_Color color)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Blit the entire surface to the screen */
|
|
||||||
|
|
||||||
dest.x = x;
|
dest.x = x;
|
||||||
dest.y = y;
|
dest.y = y;
|
||||||
dest.w = surface->w;
|
dest.w = surface->w;
|
||||||
|
|
2
init.c
2
init.c
|
@ -36,7 +36,7 @@ void init(char *title) {
|
||||||
}
|
}
|
||||||
|
|
||||||
appData.window = SDL_CreateWindow(title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, appData.screen_width, appData.screen_height, flags);
|
appData.window = SDL_CreateWindow(title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, appData.screen_width, appData.screen_height, flags);
|
||||||
appData.renderer = SDL_CreateRenderer(appData.window, -1, 0);
|
appData.renderer = SDL_CreateRenderer(appData.window, -1, SDL_RENDERER_ACCELERATED);
|
||||||
appData.mapTexture = SDL_CreateTexture(appData.renderer,
|
appData.mapTexture = SDL_CreateTexture(appData.renderer,
|
||||||
SDL_PIXELFORMAT_ARGB8888,
|
SDL_PIXELFORMAT_ARGB8888,
|
||||||
SDL_TEXTUREACCESS_TARGET,
|
SDL_TEXTUREACCESS_TARGET,
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
float *mapPoints_relative;
|
float *mapPoints_relative;
|
||||||
int mapPoints_count;
|
int mapPoints_count;
|
||||||
|
|
||||||
//extern float mapPoints[];
|
|
||||||
|
|
||||||
float *mapPoints;
|
float *mapPoints;
|
||||||
|
|
||||||
typedef struct Point{
|
typedef struct Point{
|
||||||
|
|
49
status.c
49
status.c
|
@ -64,21 +64,8 @@ void updateStatus() {
|
||||||
sigAccumulate += signalAverage;
|
sigAccumulate += signalAverage;
|
||||||
|
|
||||||
if (p->lon && p->lat) {
|
if (p->lon && p->lat) {
|
||||||
|
|
||||||
|
|
||||||
//distance measurements got borked during refactor - need to redo here
|
|
||||||
/*
|
|
||||||
double d = sqrt(p->dx * a->dx + a->dy * a->dy);
|
|
||||||
|
|
||||||
if(d < appData.maxDist) {
|
|
||||||
if(d > maxDist) {
|
|
||||||
maxDist = d;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
numVisiblePlanes++;
|
numVisiblePlanes++;
|
||||||
//}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
totalCount++;
|
totalCount++;
|
||||||
|
|
||||||
|
@ -95,22 +82,10 @@ void updateStatus() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawStatusBox(int *left, int *top, char *label, char *message, SDL_Color color) {
|
void drawStatusBox(int *left, int *top, char *label, char *message, SDL_Color color) {
|
||||||
//int labelWidth = ((strlen(label) > 0 ) ? 1.5 : 0) * appData.labelFont;
|
|
||||||
int labelWidth = (strlen(label) + ((strlen(label) > 0 ) ? 1 : 0)) * appData.labelFontWidth;
|
int labelWidth = (strlen(label) + ((strlen(label) > 0 ) ? 1 : 0)) * appData.labelFontWidth;
|
||||||
int messageWidth = (strlen(message) + ((strlen(message) > 0 ) ? 1 : 0)) * appData.messageFontWidth;
|
int messageWidth = (strlen(message) + ((strlen(message) > 0 ) ? 1 : 0)) * appData.messageFontWidth;
|
||||||
|
|
||||||
//newline if no message or label
|
|
||||||
// if(strlen(label) == 0 && strlen(message) == 0 ) {
|
|
||||||
// boxRGBA(appData.renderer, *left, *top, appData.screen_width - PAD, *top + appData.messageFontHeight,0, 0, 0, 0);
|
|
||||||
// *left = PAD;
|
|
||||||
// *top = *top - appData.messageFontHeight - PAD;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if(*left + labelWidth + messageWidth + PAD > appData.screen_width) {
|
if(*left + labelWidth + messageWidth + PAD > appData.screen_width) {
|
||||||
// if(*left + PAD < appData.screen_width) {
|
|
||||||
// boxRGBA(appData.screen, *left, *top, appData.screen_width - PAD, *top + appData.messageFontHeight, darkGrey.r, darkGrey.g, darkGrey.b, SDL_ALPHA_OPAQUE);
|
|
||||||
// }
|
|
||||||
*left = PAD;
|
*left = PAD;
|
||||||
*top = *top - appData.messageFontHeight - PAD;
|
*top = *top - appData.messageFontHeight - PAD;
|
||||||
}
|
}
|
||||||
|
@ -130,9 +105,6 @@ void drawStatusBox(int *left, int *top, char *label, char *message, SDL_Color co
|
||||||
roundedRectangleRGBA(appData.renderer, *left, *top, *left + labelWidth + messageWidth, *top + appData.messageFontHeight, ROUND_RADIUS,color.r, color.g, color.b, SDL_ALPHA_OPAQUE);
|
roundedRectangleRGBA(appData.renderer, *left, *top, *left + labelWidth + messageWidth, *top + appData.messageFontHeight, ROUND_RADIUS,color.r, color.g, color.b, SDL_ALPHA_OPAQUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// label
|
|
||||||
//drawString90(label, *left, *top + appData.labelFontWidth/2, appData.labelFont, black);
|
|
||||||
|
|
||||||
drawString(label, *left + appData.labelFontWidth/2, *top, appData.labelFont, black);
|
drawString(label, *left + appData.labelFontWidth/2, *top, appData.labelFont, black);
|
||||||
|
|
||||||
//message
|
//message
|
||||||
|
@ -205,18 +177,10 @@ void drawStatus() {
|
||||||
snprintf(strLoc, 20, "%3.3fN %3.3f%c", appData.centerLat, fabs(appData.centerLon),(appData.centerLon > 0) ? 'E' : 'W');
|
snprintf(strLoc, 20, "%3.3fN %3.3f%c", appData.centerLat, fabs(appData.centerLon),(appData.centerLon > 0) ? 'E' : 'W');
|
||||||
drawStatusBox(&left, &top, "loc", strLoc, pink);
|
drawStatusBox(&left, &top, "loc", strLoc, pink);
|
||||||
|
|
||||||
// drawBattery(&left, &top, 0.85);
|
|
||||||
|
|
||||||
char strPlaneCount[10] = " ";
|
char strPlaneCount[10] = " ";
|
||||||
snprintf(strPlaneCount, 10,"%d/%d", Status.numVisiblePlanes, Status.numPlanes);
|
snprintf(strPlaneCount, 10,"%d/%d", Status.numVisiblePlanes, Status.numPlanes);
|
||||||
drawStatusBox(&left, &top, "disp", strPlaneCount, yellow);
|
drawStatusBox(&left, &top, "disp", strPlaneCount, yellow);
|
||||||
|
|
||||||
//distance measurements got borked during refactor - need to redo here
|
|
||||||
|
|
||||||
// char strDMax[5] = " ";
|
|
||||||
// snprintf(strDMax, 5, "%.0fkm", Status.maxDist);
|
|
||||||
// drawStatusBox(&left, &top, "mDst", strDMax, blue);
|
|
||||||
|
|
||||||
char strMsgRate[18] = " ";
|
char strMsgRate[18] = " ";
|
||||||
snprintf(strMsgRate, 18,"%.0f/s", Status.msgRate);
|
snprintf(strMsgRate, 18,"%.0f/s", Status.msgRate);
|
||||||
drawStatusBox(&left, &top, "rate", strMsgRate, orange);
|
drawStatusBox(&left, &top, "rate", strMsgRate, orange);
|
||||||
|
@ -224,15 +188,4 @@ void drawStatus() {
|
||||||
char strSig[18] = " ";
|
char strSig[18] = " ";
|
||||||
snprintf(strSig, 18, "%.0f%%", 100.0 * Status.avgSig / 1024.0);
|
snprintf(strSig, 18, "%.0f%%", 100.0 * Status.avgSig / 1024.0);
|
||||||
drawStatusBox(&left, &top, "sAvg", strSig, green);
|
drawStatusBox(&left, &top, "sAvg", strSig, green);
|
||||||
|
|
||||||
//drawStatusBox(&left, &top, "x", "exit", grey);
|
|
||||||
|
|
||||||
// if(Status.closeCall != NULL) {
|
|
||||||
// drawStatusBox(&left, &top, "", "", black); //this is effectively a newline
|
|
||||||
// if(strlen(Status.closeCall->flight)) {
|
|
||||||
// drawStatusBox(&left, &top, "near", Status.closeCall->flight, white);
|
|
||||||
// } else {
|
|
||||||
// drawStatusBox(&left, &top, "near", "", white);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ struct planeObj {
|
||||||
uint64_t created;
|
uint64_t created;
|
||||||
uint64_t msSeen;
|
uint64_t msSeen;
|
||||||
uint64_t msSeenLatLon;
|
uint64_t msSeenLatLon;
|
||||||
int live;
|
int live;
|
||||||
|
|
||||||
struct planeObj *next; // Next aircraft in our linked list
|
struct planeObj *next; // Next aircraft in our linked list
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
6bd186af163808be339e2a911a4fbbd324e89f28
|
ade669691e5258a9db857adaedb879bb3c653d1e
|
72
view1090.c
72
view1090.c
|
@ -54,9 +54,6 @@ void view1090InitConfig(void) {
|
||||||
Modes.check_crc = 1;
|
Modes.check_crc = 1;
|
||||||
strcpy(View1090.net_input_beast_ipaddr,VIEW1090_NET_OUTPUT_IP_ADDRESS);
|
strcpy(View1090.net_input_beast_ipaddr,VIEW1090_NET_OUTPUT_IP_ADDRESS);
|
||||||
Modes.net_input_beast_port = MODES_NET_OUTPUT_BEAST_PORT;
|
Modes.net_input_beast_port = MODES_NET_OUTPUT_BEAST_PORT;
|
||||||
Modes.interactive_rows = MODES_INTERACTIVE_ROWS;
|
|
||||||
Modes.interactive_delete_ttl = MODES_INTERACTIVE_DELETE_TTL;
|
|
||||||
Modes.interactive_display_ttl = MODES_INTERACTIVE_DISPLAY_TTL;
|
|
||||||
Modes.fUserLat = MODES_USER_LATITUDE_DFLT;
|
Modes.fUserLat = MODES_USER_LATITUDE_DFLT;
|
||||||
Modes.fUserLon = MODES_USER_LONGITUDE_DFLT;
|
Modes.fUserLon = MODES_USER_LONGITUDE_DFLT;
|
||||||
|
|
||||||
|
@ -170,15 +167,15 @@ void showHelp(void) {
|
||||||
"-----------------------------------------------------------------------------\n"
|
"-----------------------------------------------------------------------------\n"
|
||||||
"| view1090 dump1090 Viewer Ver : "MODES_DUMP1090_VERSION " |\n"
|
"| view1090 dump1090 Viewer Ver : "MODES_DUMP1090_VERSION " |\n"
|
||||||
"-----------------------------------------------------------------------------\n"
|
"-----------------------------------------------------------------------------\n"
|
||||||
"--server <IPv4/hosname> TCP Beast output listen IPv4 (default: 127.0.0.1)\n"
|
"--server <IPv4/hosname> TCP Beast output listen IPv4 (default: 127.0.0.1)\n"
|
||||||
"--net-bo-port <port> TCP Beast output listen port (default: 30005)\n"
|
"--port <port> TCP Beast output listen port (default: 30005)\n"
|
||||||
"--lat <latitude> Reference/receiver latitide for surface posn (opt)\n"
|
"--lat <latitude> Reference/receiver latitide for surface posn (opt)\n"
|
||||||
"--lon <longitude> Reference/receiver longitude for surface posn (opt)\n"
|
"--lon <longitude> Reference/receiver longitude for surface posn (opt)\n"
|
||||||
"--metric Use metric units (meters, km/h, ...)\n"
|
"--metric Use metric units (meters, km/h, ...)\n"
|
||||||
"--help Show this help\n"
|
"--help Show this help\n"
|
||||||
"--uiscale <factor> UI global scaling\n"
|
"--uiscale <factor> UI global scaling (default: 1)\n"
|
||||||
"--screensize <width> <height>\n"
|
"--screensize <width> <height> Set frame buffer resolution (default: screen resolution)\n"
|
||||||
"--fullscreen Start fullscreen\n"
|
"--fullscreen Start fullscreen\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,6 +190,7 @@ void showCopyright(void) {
|
||||||
"\n"
|
"\n"
|
||||||
" Copyright (C) 2012 by Salvatore Sanfilippo <antirez@gmail.com>\n"
|
" Copyright (C) 2012 by Salvatore Sanfilippo <antirez@gmail.com>\n"
|
||||||
" Copyright (C) 2014 by Malcolm Robb <support@attavionics.com>\n"
|
" Copyright (C) 2014 by Malcolm Robb <support@attavionics.com>\n"
|
||||||
|
" Copyright (C) 2020 by Nathan Matsuda <info@nathanmatsuda.com>\n"
|
||||||
"\n"
|
"\n"
|
||||||
" All rights reserved.\n"
|
" All rights reserved.\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -236,21 +234,12 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
if (!strcmp(argv[j],"--net-bo-port") && more) {
|
if (!strcmp(argv[j],"--net-bo-port") && more) {
|
||||||
Modes.net_input_beast_port = atoi(argv[++j]);
|
Modes.net_input_beast_port = atoi(argv[++j]);
|
||||||
|
} else if (!strcmp(argv[j],"--port") && more) {
|
||||||
|
Modes.net_input_beast_port = atoi(argv[++j]);
|
||||||
} else if (!strcmp(argv[j],"--net-bo-ipaddr") && more) {
|
} else if (!strcmp(argv[j],"--net-bo-ipaddr") && more) {
|
||||||
strcpy(View1090.net_input_beast_ipaddr, argv[++j]);
|
strcpy(View1090.net_input_beast_ipaddr, argv[++j]);
|
||||||
} else if (!strcmp(argv[j],"--server") && more) {
|
} else if (!strcmp(argv[j],"--server") && more) {
|
||||||
strcpy(View1090.net_input_beast_ipaddr, argv[++j]);
|
strcpy(View1090.net_input_beast_ipaddr, argv[++j]);
|
||||||
} else if (!strcmp(argv[j],"--modeac")) {
|
|
||||||
Modes.mode_ac = 1;
|
|
||||||
} else if (!strcmp(argv[j],"--interactive-rows") && more) {
|
|
||||||
Modes.interactive_rows = atoi(argv[++j]);
|
|
||||||
} else if (!strcmp(argv[j],"--interactive")) {
|
|
||||||
Modes.interactive = 1;
|
|
||||||
} else if (!strcmp(argv[j],"--interactive-ttl") && more) {
|
|
||||||
Modes.interactive_display_ttl = atoi(argv[++j]);
|
|
||||||
} else if (!strcmp(argv[j],"--interactive-rtl1090")) {
|
|
||||||
Modes.interactive = 1;
|
|
||||||
Modes.interactive_rtl1090 = 1;
|
|
||||||
} else if (!strcmp(argv[j],"--lat") && more) {
|
} else if (!strcmp(argv[j],"--lat") && more) {
|
||||||
Modes.fUserLat = atof(argv[++j]);
|
Modes.fUserLat = atof(argv[++j]);
|
||||||
appData.centerLat = Modes.fUserLat;
|
appData.centerLat = Modes.fUserLat;
|
||||||
|
@ -259,14 +248,6 @@ int main(int argc, char **argv) {
|
||||||
appData.centerLon = Modes.fUserLon;
|
appData.centerLon = Modes.fUserLon;
|
||||||
} else if (!strcmp(argv[j],"--metric")) {
|
} else if (!strcmp(argv[j],"--metric")) {
|
||||||
Modes.metric = 1;
|
Modes.metric = 1;
|
||||||
} else if (!strcmp(argv[j],"--no-crc-check")) {
|
|
||||||
Modes.check_crc = 0;
|
|
||||||
} else if (!strcmp(argv[j],"--fix")) {
|
|
||||||
Modes.nfix_crc = 1;
|
|
||||||
} else if (!strcmp(argv[j],"--no-fix")) {
|
|
||||||
Modes.nfix_crc = 0;
|
|
||||||
} else if (!strcmp(argv[j],"--aggressive")) {
|
|
||||||
Modes.nfix_crc = MODES_MAX_BITERRORS;
|
|
||||||
} else if (!strcmp(argv[j],"--fullscreen")) {
|
} else if (!strcmp(argv[j],"--fullscreen")) {
|
||||||
appData.fullscreen = 1;
|
appData.fullscreen = 1;
|
||||||
} else if (!strcmp(argv[j],"--uiscale") && more) {
|
} else if (!strcmp(argv[j],"--uiscale") && more) {
|
||||||
|
@ -298,36 +279,10 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// Keep going till the user does something that stops us
|
|
||||||
while (!Modes.exit) {
|
|
||||||
interactiveRemoveStaleAircrafts();
|
|
||||||
interactiveShowData();
|
|
||||||
if ((fd == ANET_ERR) || (recv(c->fd, pk_buf, sizeof(pk_buf), MSG_PEEK | MSG_DONTWAIT) == 0)) {
|
|
||||||
free(c);
|
|
||||||
usleep(1000000);
|
|
||||||
c = (struct client *) malloc(sizeof(*c));
|
|
||||||
fd = setupConnection(c);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
modesReadFromClient(c,"",decodeBinMessage);
|
|
||||||
usleep(100000);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
int go;
|
int go;
|
||||||
|
|
||||||
#ifdef RPI
|
|
||||||
fprintf(stderr,"RPI\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Start up SDL */
|
|
||||||
|
|
||||||
init("sdl1090");
|
init("sdl1090");
|
||||||
|
|
||||||
/* Call the cleanup function when the program exits */
|
|
||||||
|
|
||||||
atexit(cleanup);
|
atexit(cleanup);
|
||||||
|
|
||||||
go = 1;
|
go = 1;
|
||||||
|
@ -337,8 +292,7 @@ int main(int argc, char **argv) {
|
||||||
getInput();
|
getInput();
|
||||||
|
|
||||||
interactiveRemoveStaleAircrafts();
|
interactiveRemoveStaleAircrafts();
|
||||||
// interactiveShowData();
|
|
||||||
|
|
||||||
draw();
|
draw();
|
||||||
|
|
||||||
if ((fd == ANET_ERR) || (recv(c->fd, pk_buf, sizeof(pk_buf), MSG_PEEK | MSG_DONTWAIT) == 0)) {
|
if ((fd == ANET_ERR) || (recv(c->fd, pk_buf, sizeof(pk_buf), MSG_PEEK | MSG_DONTWAIT) == 0)) {
|
||||||
|
|
Loading…
Reference in a new issue