misc cleanup
Former-commit-id: 747cd4fac34c15f1c7d404abb90a37ccdda8d208
This commit is contained in:
parent
01bf0bc396
commit
2f8ce3447d
25
AppData.cpp
25
AppData.cpp
|
@ -8,20 +8,8 @@
|
||||||
int AppData::setupConnection(struct client *c) {
|
int AppData::setupConnection(struct client *c) {
|
||||||
int fd;
|
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) {
|
if ((fd = anetTcpConnect(modes.aneterr, server, modes.net_input_beast_port)) != ANET_ERR) {
|
||||||
anetNonBlock(modes.aneterr, fd);
|
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->next = NULL;
|
||||||
c->buflen = 0;
|
c->buflen = 0;
|
||||||
c->fd =
|
c->fd =
|
||||||
|
@ -32,29 +20,18 @@ int AppData::setupConnection(struct client *c) {
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// end view1090.c
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
void AppData::initialize() {
|
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)))
|
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");
|
fprintf(stderr, "Out of memory allocating data buffer.\n");
|
||||||
exit(1);
|
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);
|
memset(modes.icao_cache, 0, sizeof(uint32_t) * MODES_ICAO_CACHE_LEN * 2);
|
||||||
|
|
||||||
// Prepare error correction tables
|
|
||||||
modesInitErrorInfo(&(modes));
|
modesInitErrorInfo(&(modes));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AppData::connect() {
|
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));
|
c = (struct client *) malloc(sizeof(*c));
|
||||||
while(1) {
|
while(1) {
|
||||||
if ((fd = setupConnection(c)) == ANET_ERR) {
|
if ((fd = setupConnection(c)) == ANET_ERR) {
|
||||||
|
@ -133,10 +110,8 @@ void AppData::updateStatus() {
|
||||||
|
|
||||||
|
|
||||||
AppData::AppData(){
|
AppData::AppData(){
|
||||||
// Default everything to zero/NULL
|
|
||||||
memset(&modes, 0, sizeof(Modes));
|
memset(&modes, 0, sizeof(Modes));
|
||||||
|
|
||||||
// Now initialise things that should not be 0/NULL to their defaults
|
|
||||||
modes.check_crc = 1;
|
modes.check_crc = 1;
|
||||||
strcpy(server,VIEW1090_NET_OUTPUT_IP_ADDRESS);
|
strcpy(server,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;
|
||||||
|
|
2
Map.cpp
2
Map.cpp
|
@ -87,6 +87,8 @@ std::list<Polygon> Map::getPolysRecursive(QuadTree *tree, float screen_lat_min,
|
||||||
return retPolys;
|
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->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->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));
|
retPolys.splice(retPolys.end(),getPolysRecursive(tree->ne, screen_lat_min, screen_lat_max, screen_lon_min, screen_lon_max));
|
||||||
|
|
18
README.md
18
README.md
|
@ -72,16 +72,14 @@ viz1090 will open an SDL window set to the resolution of your screen.
|
||||||
|
|
||||||
### RUNTIME OPTIONS
|
### RUNTIME OPTIONS
|
||||||
|
|
||||||
--server [domain name or ip] Specify a dump1090 server. Renamed from the viz1090 "--net-bo-ip-addr" argument
|
| --server [domain name or ip] | Specify a dump1090 server |
|
||||||
--port [port number] Specify dump1090 server port. Renamed from the viz1090 "--net-bo-port" argument
|
| --port [port number] | Specify dump1090 server port |
|
||||||
--metric Display metric units rather than imperial.
|
| --metric | Display metric units |
|
||||||
|
| --lat | Specify your latitude in degrees |
|
||||||
--lat Specify your latitude in degrees
|
| --lon | Specify your longitiude 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 |
|
||||||
--screensize [width] [height] Specify a specific resolution to pass to SDL_RenderSetLogicalSize, otherwise use resolution of display
|
| --fullscreen | Render fullscreen rather than in a window |
|
||||||
--uiscale [scale] Scale up UI elements by integer amounts for high resolution screen
|
|
||||||
--fullscreen Render fullscreen rather than in a window
|
|
||||||
|
|
||||||
### HARDWARE NOTES
|
### HARDWARE NOTES
|
||||||
|
|
||||||
|
|
5
View.cpp
5
View.cpp
|
@ -1,5 +1,6 @@
|
||||||
#include "SDL2/SDL2_rotozoom.h"
|
#include "SDL2/SDL2_rotozoom.h"
|
||||||
#include "SDL2/SDL2_gfxPrimitives.h"
|
#include "SDL2/SDL2_gfxPrimitives.h"
|
||||||
|
|
||||||
//color schemes
|
//color schemes
|
||||||
#include "parula.h"
|
#include "parula.h"
|
||||||
#include "monokai.h"
|
#include "monokai.h"
|
||||||
|
@ -88,7 +89,7 @@ SDL_Color hsv2SDLColor(float h, float s, float v)
|
||||||
long i;
|
long i;
|
||||||
SDL_Color out;
|
SDL_Color out;
|
||||||
|
|
||||||
if(s <= 0.0) { // < is bogus, just shuts up warnings
|
if(s <= 0.0) {
|
||||||
out.r = (uint8_t)v;
|
out.r = (uint8_t)v;
|
||||||
out.g = (uint8_t)v;
|
out.g = (uint8_t)v;
|
||||||
out.b = (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;
|
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;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// Adapted from:
|
||||||
// view1090, a Mode S messages viewer for dump1090 devices.
|
// view1090, a Mode S messages viewer for dump1090 devices.
|
||||||
//
|
//
|
||||||
// Copyright (C) 2014 by Malcolm Robb <Support@ATTAvionics.com>
|
// Copyright (C) 2014 by Malcolm Robb <Support@ATTAvionics.com>
|
||||||
|
@ -57,13 +58,13 @@ Style style;
|
||||||
void showHelp(void) {
|
void showHelp(void) {
|
||||||
printf(
|
printf(
|
||||||
"-----------------------------------------------------------------------------\n"
|
"-----------------------------------------------------------------------------\n"
|
||||||
"| view1090 dump1090 Viewer Ver : " MODES_DUMP1090_VERSION " |\n"
|
"| viz1090 ADSB Viewer Ver : "0.1" |\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"
|
||||||
"--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> Latitide in degrees\n"
|
||||||
"--lon <longitude> Reference/receiver longitude for surface posn (opt)\n"
|
"--lon <longitude> Longitude in degrees\n"
|
||||||
"--metric Use metric units (meters, km/h, ...)\n"
|
"--metric Use metric units\n"
|
||||||
"--help Show this help\n"
|
"--help Show this help\n"
|
||||||
"--uiscale <factor> UI global scaling (default: 1)\n"
|
"--uiscale <factor> UI global scaling (default: 1)\n"
|
||||||
"--screensize <width> <height> Set frame buffer resolution (default: screen resolution)\n"
|
"--screensize <width> <height> Set frame buffer resolution (default: screen resolution)\n"
|
||||||
|
|
Loading…
Reference in a new issue