Formatting additional PBEACON details

This commit is contained in:
Ed Sandor 2020-12-09 22:54:06 -07:00
parent 2c04d40c53
commit b2efa81b0d

View File

@ -39,6 +39,7 @@ IGLOGIN {callsign} {password}
)
if pm["aprs_igate_beacon"]:
#Format beacon lat/lon
lat = pm["receiver_gps"]["lat"]
lon = pm["receiver_gps"]["lon"]
direction_ns = "N" if lat > 0 else "S"
@ -48,10 +49,21 @@ IGLOGIN {callsign} {password}
lat = "{0:02d}^{1:05.2f}{2}".format(int(lat), (lat - int(lat)) * 60, direction_ns)
lon = "{0:03d}^{1:05.2f}{2}".format(int(lon), (lon - int(lon)) * 60, direction_we)
#Format beacon details
symbol = str(pm["aprs_igate_symbol"]) if checkKey(pm, "aprs_igate_symbol") else "R&"
power = str(pm["aprs_igate_power"]) if checkKey(pm, "aprs_igate_power") else "0"
height = "HEIGHT=" + str(pm["aprs_igate_height"]) if checkKey(pm, "aprs_igate_height") else ""
gain = "GAIN=" + str(pm["aprs_igate_gain"]) if checkKey(pm, "aprs_igate_gain") else ""
adir = "DIR=" + str(pm["aprs_igate_dir"]) if checkKey(pm, "aprs_igate_dir") else ""
freq = "FREQ=" + str(pm["aprs_igate_freq"]) if checkKey(pm, "aprs_igate_freq") else ""
tone = "TONE=" + str(pm["aprs_igate_tone"]) if checkKey(pm, "aprs_igate_tone") else ""
offset = "OFFSET=" + str(pm["aprs_igate_offset"]) if checkKey(pm, "aprs_igate_offset") else ""
comment = str(pm["aprs_igate_comment"]) if checkKey(pm, "aprs_igate_comment") else "OpenWebRX APRS gateway"
config += """
PBEACON sendto=IG delay=0:30 every=60:00 symbol="igate" overlay=R lat={lat} long={lon} comment="OpenWebRX APRS gateway"
PBEACON sendto=IG delay=0:30 every=60:00 symbol={symbol} lat={lat} long={lon} POWER={power} {height} {gain} {adir} {freq} {tone} {offset} comment={comment}
""".format(
lat=lat, lon=lon
symbol=symbol, lat=lat, lon=lon, power=power, height=height, gain=gain, adir=adir, freq=freq, tone=tone, offset=offset, comment=comment
)
return config