1
0
Fork 0
mirror of https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder.git synced 2024-11-21 21:30:11 +00:00

update readme for gpsd mlat related vars

enforce limits for gpsd mlat related vars

add readme to change gpsd.socket
This commit is contained in:
Matthias Wirth 2024-06-07 18:16:19 +02:00
parent 04a95b7c5e
commit 6378d30318
2 changed files with 45 additions and 13 deletions

View file

@ -752,7 +752,22 @@ GPSD_OPTIONS="-G"
# Automatically hot add/remove USB GPS devices via gpsdctl
USBAUTO="true"
EOM
sudo systemctl restart gpsd
cat < EOM | sudo tee /lib/systemd/system/gpsd.socket
[Unit]
Description=GPS (Global Positioning System) Daemon Sockets
[Socket]
ListenStream=/run/gpsd.sock
ListenStream=[::]:2947
ListenStream=0.0.0.0:2947
SocketMode=0600
BindIPv6Only=yes
[Install]
WantedBy=sockets.target
EOM
sudo systemctl daemon-reload
sudo systemctl restart gpsd gpsd.socket
```
Then, you can add the following values to `ultrafeeder` service settings in `docker-compose.yml`:
@ -781,13 +796,13 @@ This will:
### Optional parameters regulating the restart of `mlat-client` when the location changes
The following parameters are all optional. You don't need to set them unless you want to change the default behavior:
The following parameters are all optional and are subject to change. You don't need to set them unless you want to change the default behavior:
| Environment Variable | Purpose | Default |
| -------------------- | ------- | ------- |
| `GPSD_INITIAL_WAIT` | The initial wait period (in seconds) for the GPS data to stabilize once the container detects that GPS data is being provided | `60` (seconds) |
| `GPSD_MIN_DISTANCE` | Distance (in meters) that your station must move before the `mlat-client`(s) are restarted with the new latitude/longitude/altitude | `20` (meters) |
| `GPSD_CHECK_INTERVAL` | How often the container checks for updated location information. Please don't make this shorter than 30 seconds to avoid race conditions, which may cause mlat-client to stop feeding some of the aggregators | `30` (seconds) |
| `GPSD_MIN_DISTANCE` | Distance (in meters) that your station must move before it's considered moving (maximum 40 meters) | `20` (meters) |
| `GPSD_MLAT_WAIT` | The wait period (in seconds) your station must be stationary before mlat is started (minimum 90 seconds) | `90` (seconds) |
| `GPSD_CHECK_INTERVAL` | How often the container checks for updated location information. (minimum 5 seconds) | `30` (seconds) |
## Web Pages

View file

@ -52,7 +52,7 @@ then
fi
function check_gpsd() {
if [[ -z "$GPSD" ]] || ! [[ -f /run/readsb/gpsd.json ]]; then
if (( GPSD == 0 )) || ! [[ -f /run/readsb/gpsd.json ]]; then
return 1
fi
if new_lat="$(jq -r .lat /run/readsb/gpsd.json)" \
@ -64,9 +64,6 @@ function check_gpsd() {
then
# yay, vars are set and not null
if ! [[ -f "$LOCATION_PERSIST" ]]; then
echo "$new_lat" "$new_lon" "$new_alt" > "$LOCATION_PERSIST"
fi
return 0
else
new_lat=""
@ -76,6 +73,7 @@ function check_gpsd() {
fi
}
GPSD=0
if grep -qs "gpsd" <<< "$ULTRAFEEDER_CONFIG" || grep -qs "gpsd" <<< "$ULTRAFEEDER_NET_CONNECTOR"; then
GPSD=1
LOCATION_PERSIST=/var/globe_history/gpsd_last_location
@ -88,16 +86,32 @@ if grep -qs "gpsd" <<< "$ULTRAFEEDER_CONFIG" || grep -qs "gpsd" <<< "$ULTRAFEEDE
while ! check_gpsd; do
sleep "${GPSD_CHECK_INTERVAL:-30}" & wait $!
done
"${s6wrap[@]}" --args echo "GPSD has provided location data, starting mlat-clients"
"${s6wrap[@]}" --args echo "GPSD has provided location data"
fi
# initialize "old" location for gpsd movement detection
old_lat="$new_lat"
old_lon="$new_lon"
GPSD_MIN_DISTANCE="${GPSD_MIN_DISTANCE:-20}"
# enforce gpsd min distance is no larger than 40m
if (( GPSD_MIN_DISTANCE > 40 )); then
GPSD_MIN_DISTANCE=40
fi
GPSD_CHECK_INTERVAL="${GPSD_CHECK_INTERVAL:-30}"
if (( GPSD_CHECK_INTERVAL < 5 )); then
GPSD_CHECK_INTERVAL=5
fi
# in seconds
no_movement_required=${GPSD_MLAT_WAIT:-90}
# enforce it to be longer than the checking interval for implementation reasons
if (( no_movement_required < GPSD_CHECK_INTERVAL )); then
no_movement_required="${GPSD_CHECK_INTERVAL}"
fi
# enforce 90 second minimum
if (( no_movement_required < 90 )); then
no_movement_required=90
if (( no_movement_required < "${GPSD_CHECK_INTERVAL:-30}" )); then
no_movement_required="${GPSD_CHECK_INTERVAL:-30}"
fi
# set no_movement to a number higher than the required time of no movement
# this way on startup there is no bogus message printed about starting mlat-clients with a new location
@ -299,6 +313,9 @@ while true
do
if check_gpsd; then
distance="$(distance "$old_lat" "$old_lon" "$new_lat" "$new_lon")"
if ! [[ -f "$LOCATION_PERSIST" ]]; then
echo "$new_lat" "$new_lon" "$new_alt" > "$LOCATION_PERSIST"
fi
if (( ${distance%%.*} > ${GPSD_MIN_DISTANCE:-20} )); then
# kill the mlat-client instances so they get restarted with the new GPS coords