et-voacap - Added support to use ETC's location service to user GPS/et-user position if not --tx argument specified

This commit is contained in:
thetechprepper
2025-08-27 13:14:43 -07:00
parent 4a9017d2b2
commit 9b85f9c831
@@ -2,7 +2,7 @@
#
# Author : Gaston Gonzalez
# Date : 23 May 2023
# Updated : 24 August 2025
# Updated : 27 August 2025
# Purpose : Offline HF prediction using voacapl
set -e
set -o pipefail
@@ -17,6 +17,17 @@ lookup_station() {
local json_file="$3"
case "$type" in
gps)
curl -f -s "http://localhost:1981/api/geo/position" | jq .position > "$json_file"
if [[ $? -ne 0 ]]; then
echo -e "${RED}Can't determine your position for use as the transmitting station.${NC}" >&2
echo "Try specifying your callsign, grid or lat,lon." >&2
echo " --tx-call CALLSIGN Transmitting station callsign" >&2
echo " --tx-grid GRID Transmitting station Maidenhead grid" >&2
echo " --tx-latlon LAT,LON Transmitting station coordinates in decimal degrees" >&2
return 1
fi
;;
call)
curl -f -s "http://localhost:1981/api/license?callsign=${value}" > "$json_file"
if [[ $? -ne 0 ]]; then
@@ -128,7 +139,10 @@ usage() {
echo " --rx-grid GRID Receiving station Maidenhead grid"
echo " --rx-latlon LAT,LON Receiving station coordinates in decimal degrees"
echo
echo "Other options:"
echo "If no --tx option is specified, your position will be pulled from a supported"
echo "ETC GPS unit or fallback to the grid square configured by 'et-user'."
echo
echo "Other options (required):"
echo " -p POWER Output power [5|20|100|500|1500]"
echo " -m MODE Mode [AM|CW|JS8|SSB]"
echo
@@ -158,8 +172,13 @@ while [[ $# -gt 0 ]]; do
esac
done
# Use local ETC user position if TX station not defined
if [[ -z $tx_type ]]; then
tx_type="gps"
fi
# Validate required args
[[ -z $tx_type || -z $rx_type || -z $power || -z $mode ]] && usage
[[ -z $rx_type || -z $power || -z $mode ]] && usage
#echo "TX ($tx_type): $tx_value"
#echo "RX ($rx_type): $rx_value"