diff --git a/AppData.cpp b/AppData.cpp index 20b7578..577968c 100644 --- a/AppData.cpp +++ b/AppData.cpp @@ -8,20 +8,8 @@ int AppData::setupConnection(struct client *c) { int fd; - // Try to connect to the selected ip address and port. We only support *ONE* input connection which we initiate.here. if ((fd = anetTcpConnect(modes.aneterr, server, modes.net_input_beast_port)) != ANET_ERR) { anetNonBlock(modes.aneterr, fd); - // - // Setup a service callback client structure for a beast binary input (from dump1090) - // This is a bit dodgy under Windows. The fd parameter is a handle to the internet - // socket on which we are receiving data. Under Linux, these seem to start at 0 and - // count upwards. However, Windows uses "HANDLES" and these don't nececeriy start at 0. - // dump1090 limits fd to values less than 1024, and then uses the fd parameter to - // index into an array of clients. This is ok-ish if handles are allocated up from 0. - // However, there is no gaurantee that Windows will behave like this, and if Windows - // allocates a handle greater than 1024, then dump1090 won't like it. On my test machine, - // the first Windows handle is usually in the 0x54 (84 decimal) region. - c->next = NULL; c->buflen = 0; c->fd = @@ -32,29 +20,18 @@ int AppData::setupConnection(struct client *c) { return fd; } -// -// end view1090.c -// - - void AppData::initialize() { - // Allocate the various buffers used by Modes if ( NULL == (modes.icao_cache = (uint32_t *) malloc(sizeof(uint32_t) * MODES_ICAO_CACHE_LEN * 2))) { fprintf(stderr, "Out of memory allocating data buffer.\n"); exit(1); } - - // Clear the buffers that have just been allocated, just in-case memset(modes.icao_cache, 0, sizeof(uint32_t) * MODES_ICAO_CACHE_LEN * 2); - - // Prepare error correction tables modesInitErrorInfo(&(modes)); } void AppData::connect() { - // Try to connect to the selected ip address and port. We only support *ONE* input connection which we initiate.here. c = (struct client *) malloc(sizeof(*c)); while(1) { if ((fd = setupConnection(c)) == ANET_ERR) { @@ -133,10 +110,8 @@ void AppData::updateStatus() { AppData::AppData(){ - // Default everything to zero/NULL memset(&modes, 0, sizeof(Modes)); - // Now initialise things that should not be 0/NULL to their defaults modes.check_crc = 1; strcpy(server,VIEW1090_NET_OUTPUT_IP_ADDRESS); modes.net_input_beast_port = MODES_NET_OUTPUT_BEAST_PORT; diff --git a/Map.cpp b/Map.cpp index 29949e6..229520e 100644 --- a/Map.cpp +++ b/Map.cpp @@ -87,6 +87,8 @@ std::list Map::getPolysRecursive(QuadTree *tree, float screen_lat_min, return retPolys; } + + //for some reason os x clang doesn't like this retPolys.splice(retPolys.end(),getPolysRecursive(tree->nw, screen_lat_min, screen_lat_max, screen_lon_min, screen_lon_max)); retPolys.splice(retPolys.end(),getPolysRecursive(tree->sw, screen_lat_min, screen_lat_max, screen_lon_min, screen_lon_max)); retPolys.splice(retPolys.end(),getPolysRecursive(tree->ne, screen_lat_min, screen_lat_max, screen_lon_min, screen_lon_max)); diff --git a/README.md b/README.md index ed9028e..753130c 100644 --- a/README.md +++ b/README.md @@ -72,16 +72,14 @@ viz1090 will open an SDL window set to the resolution of your screen. ### RUNTIME OPTIONS ---server [domain name or ip] Specify a dump1090 server. Renamed from the viz1090 "--net-bo-ip-addr" argument ---port [port number] Specify dump1090 server port. Renamed from the viz1090 "--net-bo-port" argument ---metric Display metric units rather than imperial. - ---lat Specify your latitude in degrees ---lon Specify your longitiude in degrees - ---screensize [width] [height] Specify a specific resolution to pass to SDL_RenderSetLogicalSize, otherwise use resolution of display ---uiscale [scale] Scale up UI elements by integer amounts for high resolution screen ---fullscreen Render fullscreen rather than in a window +| --server [domain name or ip] | Specify a dump1090 server | +| --port [port number] | Specify dump1090 server port | +| --metric | Display metric units | +| --lat | Specify your latitude in degrees | +| --lon | Specify your longitiude in degrees | +| --screensize [width] [height] | Specify a specific resolution to pass to SDL_RenderSetLogicalSize, otherwise use resolution of display | +| --uiscale [scale] | Scale up UI elements by integer amounts for high resolution screen | +| --fullscreen | Render fullscreen rather than in a window | ### HARDWARE NOTES diff --git a/View.cpp b/View.cpp index 8701742..3920c81 100644 --- a/View.cpp +++ b/View.cpp @@ -1,5 +1,6 @@ #include "SDL2/SDL2_rotozoom.h" #include "SDL2/SDL2_gfxPrimitives.h" + //color schemes #include "parula.h" #include "monokai.h" @@ -88,7 +89,7 @@ SDL_Color hsv2SDLColor(float h, float s, float v) long i; SDL_Color out; - if(s <= 0.0) { // < is bogus, just shuts up warnings + if(s <= 0.0) { out.r = (uint8_t)v; out.g = (uint8_t)v; out.b = (uint8_t)v; @@ -339,8 +340,6 @@ void View::drawStringBG(char * text, int x, int y, TTF_Font *font, SDL_Color col return; } - /* Blit the entire surface to the screen */ - dest.x = x; dest.y = y; dest.w = surface->w; diff --git a/viz1090.cpp b/viz1090.cpp index bf16da5..7118260 100644 --- a/viz1090.cpp +++ b/viz1090.cpp @@ -1,3 +1,4 @@ +// Adapted from: // view1090, a Mode S messages viewer for dump1090 devices. // // Copyright (C) 2014 by Malcolm Robb @@ -57,13 +58,13 @@ Style style; void showHelp(void) { printf( "-----------------------------------------------------------------------------\n" -"| view1090 dump1090 Viewer Ver : " MODES_DUMP1090_VERSION " |\n" +"| viz1090 ADSB Viewer Ver : "0.1" |\n" "-----------------------------------------------------------------------------\n" "--server TCP Beast output listen IPv4 (default: 127.0.0.1)\n" "--port TCP Beast output listen port (default: 30005)\n" - "--lat Reference/receiver latitide for surface posn (opt)\n" - "--lon Reference/receiver longitude for surface posn (opt)\n" - "--metric Use metric units (meters, km/h, ...)\n" + "--lat Latitide in degrees\n" + "--lon Longitude in degrees\n" + "--metric Use metric units\n" "--help Show this help\n" "--uiscale UI global scaling (default: 1)\n" "--screensize Set frame buffer resolution (default: screen resolution)\n"