diff --git a/README.md b/README.md index 8c59661..bccced9 100644 --- a/README.md +++ b/README.md @@ -49,3 +49,14 @@ secrets = { "opensky_password": "YOUR_OPENSKY_PASSWORD" } ``` + +### Constants +A collection of functionality-related constants is specified in `constants.py`, which can be adjusted to suit your needs: + +| Variable Name | Description | Default | +|----------------------------|-----------------------------------------------|----------| +| `MAP_CENTER_LAT` | Map center latitude, decimal degrees | `42.41` | +| `MAP_CENTER_LON` | Map center longitude, deimal degrees | `-71.17` | +| `GRID_WIDTH_MI` | Map grid width, miles | `15` | +| `SKIP_GROUND` | Skip drawing aircraft on the ground | `True` | +| `GEO_ALTITUDE_THRESHOLD_M` | Skip drawing aircraft below this GPS altitude | `20` | diff --git a/constants.py b/constants.py index b517a75..1db86c8 100644 --- a/constants.py +++ b/constants.py @@ -1,3 +1,8 @@ +# Mapping information MAP_CENTER_LAT = 42.41 MAP_CENTER_LON = -71.17 GRID_WIDTH_MI = 15 + +# Aircraft plotting +SKIP_GROUND = True +GEO_ALTITUDE_THRESHOLD_M = 20 diff --git a/skyportal/displaylib.py b/skyportal/displaylib.py index ce21ede..c97da2a 100644 --- a/skyportal/displaylib.py +++ b/skyportal/displaylib.py @@ -7,6 +7,7 @@ from adafruit_bitmapsaver import save_pixels from adafruit_display_text import label +from constants import GEO_ALTITUDE_THRESHOLD_M, SKIP_GROUND from skyportal.aircraftlib import ( AIRCRAFT_ICONS, AircraftIcon, @@ -170,7 +171,8 @@ def draw_aircraft( aircraft: list[AircraftState], default_icon: AircraftIcon = BASE_ICON, custom_icons: dict[int, AircraftIcon] = AIRCRAFT_ICONS, - skip_ground: bool = True, + skip_ground: bool = SKIP_GROUND, + geo_altitude_threshold_m: float = GEO_ALTITUDE_THRESHOLD_M, ) -> None: """ Clear the currently plotted aircraft icons & redraw from the provided list of aircraft. @@ -192,6 +194,10 @@ def draw_aircraft( n_ground += 1 continue + if ap.geo_altitude_m is None or ap.geo_altitude_m < geo_altitude_threshold_m: + n_ground += 1 + continue + # If we've gotten here then lat/lon can't be None icon_x, icon_y = calculate_pixel_position( lat=ap.lat, # type: ignore[arg-type]