diff --git a/gui/src/components/grid/grid_active_heard_stations.vue b/gui/src/components/grid/grid_active_heard_stations.vue index a1262e0f..23a136d4 100644 --- a/gui/src/components/grid/grid_active_heard_stations.vue +++ b/gui/src/components/grid/grid_active_heard_stations.vue @@ -61,6 +61,8 @@ function pushToPing(origin) Type SNR + AFK? + @@ -83,6 +85,9 @@ function pushToPing(origin) {{ item.snr }} + + {{ item.away_from_key }} + diff --git a/gui/src/js/api.js b/gui/src/js/api.js index 7e469fac..bca7717d 100644 --- a/gui/src/js/api.js +++ b/gui/src/js/api.js @@ -92,8 +92,8 @@ export async function getSerialDevices() { return await apiGet("/devices/serial"); } -export async function setModemBeacon(enabled = false, afk = false) { - return await apiPost("/modem/beacon", { enabled: enabled, afk: afk}); +export async function setModemBeacon(enabled = false, away_from_key = false) { + return await apiPost("/modem/beacon", { enabled: enabled, away_from_key: away_from_key}); } export async function sendModemCQ() { diff --git a/modem/frame_handler_beacon.py b/modem/frame_handler_beacon.py index 10b79822..6c6fff43 100644 --- a/modem/frame_handler_beacon.py +++ b/modem/frame_handler_beacon.py @@ -14,7 +14,8 @@ class BeaconFrameHandler(frame_handler.FrameHandler): DatabaseManagerBeacon(self.event_manager).add_beacon(datetime.datetime.now(), self.details['frame']["origin"], self.details["snr"], - self.details['frame']["gridsquare"] + self.details['frame']["gridsquare"], + self.details['frame']["flag"]["away_from_key"] ) if self.config["MESSAGES"]["enable_auto_repeat"]: diff --git a/modem/helpers.py b/modem/helpers.py index fc778bba..9ff732de 100644 --- a/modem/helpers.py +++ b/modem/helpers.py @@ -126,7 +126,7 @@ import time def add_to_heard_stations(dxcallsign, dxgrid, datatype, snr, offset, frequency, heard_stations_list, distance_km=None, - distance_miles=None): + distance_miles=None, away_from_key=False): """ Args: dxcallsign (str): The callsign of the DX station. @@ -138,6 +138,7 @@ def add_to_heard_stations(dxcallsign, dxgrid, datatype, snr, offset, frequency, heard_stations_list (list): List containing heard stations. distance_km (float): Distance to the DX station in kilometers. distance_miles (float): Distance to the DX station in miles. + away_from_key (bool): Away from key indicator Returns: Nothing. The function updates the heard_stations_list in-place. @@ -147,7 +148,7 @@ def add_to_heard_stations(dxcallsign, dxgrid, datatype, snr, offset, frequency, # Initialize the new entry new_entry = [ - dxcallsign, dxgrid, current_timestamp, datatype, snr, offset, frequency, distance_km, distance_miles + dxcallsign, dxgrid, current_timestamp, datatype, snr, offset, frequency, distance_km, distance_miles, away_from_key ] # Check if the buffer is empty or if the callsign is not already in the list diff --git a/modem/server.py b/modem/server.py index 409b4de2..c0d8ff2a 100644 --- a/modem/server.py +++ b/modem/server.py @@ -146,14 +146,14 @@ def post_cqcqcq(): def post_beacon(): if request.method not in ['POST']: return api_response({"info": "endpoint for controlling BEACON STATE via POST"}) - if not isinstance(request.json['enabled'], bool) or not isinstance(request.json['afk'], bool): + if not isinstance(request.json['enabled'], bool) or not isinstance(request.json['away_from_key'], bool): api_abort(f"Incorrect value for 'enabled'. Shoud be bool.") if not app.state_manager.is_modem_running: api_abort('Modem not running', 503) if not app.state_manager.is_beacon_running: app.state_manager.set('is_beacon_running', request.json['enabled']) - app.state_manager.set('is_away_from_key', request.json['afk']) + app.state_manager.set('is_away_from_key', request.json['away_from_key']) if not app.state_manager.getARQ(): enqueue_tx_command(command_beacon.BeaconCommand, request.json)