mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
adjusted afk stuff
This commit is contained in:
parent
2c331ecaa4
commit
7ee525f214
5 changed files with 14 additions and 7 deletions
|
@ -61,6 +61,8 @@ function pushToPing(origin)
|
|||
<th scope="col" id="thType">Type</th>
|
||||
<th scope="col" id="thSnr">SNR</th>
|
||||
<!--<th scope="col">Off</th>-->
|
||||
<th scope="col" id="thSnr">AFK?</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="gridHeardStations">
|
||||
|
@ -83,6 +85,9 @@ function pushToPing(origin)
|
|||
<td>
|
||||
{{ item.snr }}
|
||||
</td>
|
||||
<td>
|
||||
{{ item.away_from_key }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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"]:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue