Skip to content

Commit

Permalink
Merge pull request #13 from IQTLabs/geometric-altitude
Browse files Browse the repository at this point in the history
Geometric altitude
  • Loading branch information
luke-iqt committed Mar 22, 2021
2 parents a8cba0e + 152a5df commit 6d9a255
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 2 deletions.
4 changes: 3 additions & 1 deletion adsb-mqtt/sbs1.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from typing import *
from datetime import datetime
import logging
import re
try:
import dateutil.parser
except ImportError as e:
Expand Down Expand Up @@ -124,7 +125,8 @@ def __parseInt(array: List, index: int):
"""Parse int at given index in array
Return int value or None if index is out of bounds or type casting failed"""
try:
return int(array[index])
numbers = re.findall('[0-9]+', array[index])[0]
return int(numbers)
except ValueError as e:
return None
except TypeError as e:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ services:
restart: unless-stopped

piaware:
image: mikenye/piaware:latest
build: ./piaware
tty: true
container_name: piaware
restart: always
Expand Down
9 changes: 9 additions & 0 deletions piaware/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM mikenye/piaware:latest

ADD run /etc/services.d/dump1090/

EXPOSE 80/tcp 30003/tcp 30005/tcp 30105/tcp 30978/tcp 30979/tcp

ENTRYPOINT [ "/init" ]

HEALTHCHECK --start-period=7200s --interval=600s CMD /scripts/healthcheck.sh
51 changes: 51 additions & 0 deletions piaware/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
set -eo pipefail

mkdir -p /run/dump1090-fa

DUMP1090_BIN="/usr/local/bin/dump1090"

# Global settings
DUMP1090_CMD=("--quiet")
DUMP1090_CMD+=("--lat" "$LAT")
DUMP1090_CMD+=("--lon" "$LONG")
DUMP1090_CMD+=("--net")
DUMP1090_CMD+=("--fix")
DUMP1090_CMD+=("--gnss")
DUMP1090_CMD+=("--json-location-accuracy" "2")
DUMP1090_CMD+=("--write-json" "/run/dump1090-fa")
DUMP1090_CMD+=("--net-bind-address" "0.0.0.0")

# Handle "--modeac"
if [[ "$ALLOW_MODEAC" == "yes" ]]; then
DUMP1090_CMD+=("--modeac")
fi

# If a BEASTHOST is specified
if [[ -n "$BEASTHOST" ]]; then
DUMP1090_CMD+=("--net-only")

# Default - rtlsdr mode
else
DUMP1090_CMD+=("--device-type" "rtlsdr")

if [[ -n "$DUMP1090_DEVICE" ]]; then
DUMP1090_CMD+=("--device" "$DUMP1090_DEVICE")
fi

if [[ -n "$RTLSDR_PPM" ]]; then
DUMP1090_CMD+=("--ppm" "$RTLSDR_PPM")
fi

if [[ -n "$RTLSDR_GAIN" ]]; then
DUMP1090_CMD+=("--gain" "$RTLSDR_GAIN")
fi

fi

# shellcheck disable=SC2016
"${DUMP1090_BIN}" "${DUMP1090_CMD[@]}" \
2>&1 | stdbuf -o0 awk '{print "[dump1090] " strftime("%Y/%m/%d %H:%M:%S", systime()) " " $0}'

sleep 5

0 comments on commit 6d9a255

Please sign in to comment.