cleaning up unused

Former-commit-id: 28877253544f45f3037bc5214478df8fb2536ce0
Former-commit-id: c3fef4350543beba9e002116f09124abe67deb2e
This commit is contained in:
nathan 2020-03-02 22:22:35 -08:00
parent c338cb7340
commit e2de0076c2
8 changed files with 19 additions and 119 deletions

View file

@ -16,7 +16,7 @@ battery level (need separate linux/win/android)
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
Platforms

7
font.c
View file

@ -3,7 +3,6 @@
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);
if (font == NULL)
@ -17,9 +16,7 @@ TTF_Font *loadFont(char *name, int size)
}
void closeFont(TTF_Font *font)
{
/* Close the font once we're done with it */
{
if (font != NULL)
{
TTF_CloseFont(font);
@ -44,8 +41,6 @@ void drawString(char * text, int x, int y, TTF_Font *font, SDL_Color color)
return;
}
/* Blit the entire surface to the screen */
dest.x = x;
dest.y = y;
dest.w = surface->w;

2
init.c
View file

@ -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.renderer = SDL_CreateRenderer(appData.window, -1, 0);
appData.renderer = SDL_CreateRenderer(appData.window, -1, SDL_RENDERER_ACCELERATED);
appData.mapTexture = SDL_CreateTexture(appData.renderer,
SDL_PIXELFORMAT_ARGB8888,
SDL_TEXTUREACCESS_TARGET,

View file

@ -4,8 +4,6 @@
float *mapPoints_relative;
int mapPoints_count;
//extern float mapPoints[];
float *mapPoints;
typedef struct Point{

View file

@ -64,21 +64,8 @@ void updateStatus() {
sigAccumulate += signalAverage;
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++;
//}
}
}
totalCount++;
@ -95,22 +82,10 @@ void updateStatus() {
}
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 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 + 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;
*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);
}
// label
//drawString90(label, *left, *top + appData.labelFontWidth/2, appData.labelFont, black);
drawString(label, *left + appData.labelFontWidth/2, *top, appData.labelFont, black);
//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');
drawStatusBox(&left, &top, "loc", strLoc, pink);
// drawBattery(&left, &top, 0.85);
char strPlaneCount[10] = " ";
snprintf(strPlaneCount, 10,"%d/%d", Status.numVisiblePlanes, Status.numPlanes);
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] = " ";
snprintf(strMsgRate, 18,"%.0f/s", Status.msgRate);
drawStatusBox(&left, &top, "rate", strMsgRate, orange);
@ -224,15 +188,4 @@ void drawStatus() {
char strSig[18] = " ";
snprintf(strSig, 18, "%.0f%%", 100.0 * Status.avgSig / 1024.0);
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);
// }
// }
}

View file

@ -74,7 +74,7 @@ struct planeObj {
uint64_t created;
uint64_t msSeen;
uint64_t msSeenLatLon;
int live;
int live;
struct planeObj *next; // Next aircraft in our linked list

View file

@ -1 +1 @@
6bd186af163808be339e2a911a4fbbd324e89f28
ade669691e5258a9db857adaedb879bb3c653d1e

View file

@ -54,9 +54,6 @@ void view1090InitConfig(void) {
Modes.check_crc = 1;
strcpy(View1090.net_input_beast_ipaddr,VIEW1090_NET_OUTPUT_IP_ADDRESS);
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.fUserLon = MODES_USER_LONGITUDE_DFLT;
@ -170,15 +167,15 @@ void showHelp(void) {
"-----------------------------------------------------------------------------\n"
"| view1090 dump1090 Viewer Ver : "MODES_DUMP1090_VERSION " |\n"
"-----------------------------------------------------------------------------\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"
"--lat <latitude> Reference/receiver latitide for surface posn (opt)\n"
"--lon <longitude> Reference/receiver longitude for surface posn (opt)\n"
"--metric Use metric units (meters, km/h, ...)\n"
"--help Show this help\n"
"--uiscale <factor> UI global scaling\n"
"--screensize <width> <height>\n"
"--fullscreen Start fullscreen\n"
"--server <IPv4/hosname> TCP Beast output listen IPv4 (default: 127.0.0.1)\n"
"--port <port> TCP Beast output listen port (default: 30005)\n"
"--lat <latitude> Reference/receiver latitide for surface posn (opt)\n"
"--lon <longitude> Reference/receiver longitude for surface posn (opt)\n"
"--metric Use metric units (meters, km/h, ...)\n"
"--help Show this help\n"
"--uiscale <factor> UI global scaling (default: 1)\n"
"--screensize <width> <height> Set frame buffer resolution (default: screen resolution)\n"
"--fullscreen Start fullscreen\n"
);
}
@ -193,6 +190,7 @@ void showCopyright(void) {
"\n"
" Copyright (C) 2012 by Salvatore Sanfilippo <antirez@gmail.com>\n"
" Copyright (C) 2014 by Malcolm Robb <support@attavionics.com>\n"
" Copyright (C) 2020 by Nathan Matsuda <info@nathanmatsuda.com>\n"
"\n"
" All rights reserved.\n"
"\n"
@ -236,21 +234,12 @@ int main(int argc, char **argv) {
if (!strcmp(argv[j],"--net-bo-port") && more) {
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) {
strcpy(View1090.net_input_beast_ipaddr, argv[++j]);
} else if (!strcmp(argv[j],"--server") && more) {
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) {
Modes.fUserLat = atof(argv[++j]);
appData.centerLat = Modes.fUserLat;
@ -259,14 +248,6 @@ int main(int argc, char **argv) {
appData.centerLon = Modes.fUserLon;
} else if (!strcmp(argv[j],"--metric")) {
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")) {
appData.fullscreen = 1;
} 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;
#ifdef RPI
fprintf(stderr,"RPI\n");
#endif
/* Start up SDL */
init("sdl1090");
/* Call the cleanup function when the program exits */
atexit(cleanup);
go = 1;
@ -337,8 +292,7 @@ int main(int argc, char **argv) {
getInput();
interactiveRemoveStaleAircrafts();
// interactiveShowData();
draw();
if ((fd == ANET_ERR) || (recv(c->fd, pk_buf, sizeof(pk_buf), MSG_PEEK | MSG_DONTWAIT) == 0)) {