Merge pull request #276 from DJ2LS/ls-arq

raspberry pi compatibility and other small fixes
This commit is contained in:
DJ2LS 2022-11-08 09:50:31 +01:00 committed by GitHub
commit 3afca6a5ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 12 deletions

View file

@ -832,6 +832,7 @@ ipcMain.on('request-stop-rigctld',(event,data)=>{
// CHECK RIGCTLD
ipcMain.on('request-check-rigctld',(data)=>{
try {
let Data = {
state: "unknown",
@ -843,12 +844,15 @@ ipcMain.on('request-check-rigctld',(data)=>{
} else {
Data["state"] = "unknown/stopped";
}
win.webContents.send('action-check-rigctld', Data);
if (win !== null && win !== ''){
win.webContents.send('action-check-rigctld', Data);
}
})
} catch (e) {
mainLog.error(e)
}
});

View file

@ -1196,7 +1196,7 @@
</label>
</div>
<div class="input-group input-group-sm mb-1">
<label class="input-group-text w-50">Enable 563Hz mode</label>
<label class="input-group-text w-50">Enable 563Hz only mode</label>
<label class="input-group-text bg-white w-50">
<div class="form-check form-switch form-check-inline">
<input class="form-check-input" type="checkbox" id="500HzModeSwitch">
@ -1205,7 +1205,7 @@
</label>
</div>
<div class="input-group input-group-sm mb-1">
<label class="input-group-text w-50">Enable Explorer Publishing</label>
<label class="input-group-text w-50">Enable Explorer Publishing <br> (https://explorer.freedata.app) </label>
<label class="input-group-text bg-white w-50">
<div class="form-check form-switch form-check-inline">
<input class="form-check-input" type="checkbox" id="ExplorerSwitch">

View file

@ -31,7 +31,7 @@ def get_audio_devices():
sd._terminate()
sd._initialize()
log.debug("[AUD] get_audio_devices")
# log.debug("[AUD] get_audio_devices")
with multiprocessing.Manager() as manager:
proxy_input_devices = manager.list()
proxy_output_devices = manager.list()
@ -42,8 +42,9 @@ def get_audio_devices():
proc.start()
proc.join()
log.debug("[AUD] get_audio_devices: input_devices:", list=f"{proxy_input_devices}")
log.debug("[AUD] get_audio_devices: output_devices:", list=f"{proxy_output_devices}")
# additional logging for audio devices
# log.debug("[AUD] get_audio_devices: input_devices:", list=f"{proxy_input_devices}")
# log.debug("[AUD] get_audio_devices: output_devices:", list=f"{proxy_output_devices}")
return list(proxy_input_devices), list(proxy_output_devices)
@ -52,7 +53,10 @@ def device_crc(device) -> str:
crc_hwid = crc_algorithm(bytes(f"{device}", encoding="utf-8"))
crc_hwid = crc_hwid.to_bytes(2, byteorder="big")
crc_hwid = crc_hwid.hex()
return f"{device['name']} [{crc_hwid}]"
hostapi_name = sd.query_hostapis(device['hostapi'])['name']
return f"{device['name']} [{hostapi_name}] [{crc_hwid}]"
def fetch_audio_devices(input_devices, output_devices):

View file

@ -13,7 +13,7 @@ import threading
import time
import uuid
import zlib
from random import randrange, randbytes
from random import randrange# , randbytes
import codec2
import helpers
@ -361,7 +361,7 @@ class DATA:
def enqueue_frame_for_tx(
self,
frame_to_tx: list[bytearray],
frame_to_tx,# : list[bytearray], # this causes a crash on python 3.7
c2_mode=FREEDV_MODE.datac0.value,
copies=1,
repeat_delay=0,
@ -1323,7 +1323,8 @@ class DATA:
static.ARQ_SESSION_STATE = "connecting"
# create a random session id
self.session_id = randbytes(1)
# self.session_id = randbytes(1)
self.session_id = np.random.bytes(1)
print(self.session_id)
connection_frame = bytearray(self.length_sig0_frame)
@ -1615,7 +1616,8 @@ class DATA:
# init a new random session id if we are not in an arq session
if not static.ARQ_SESSION:
self.session_id = randbytes(1)
# self.session_id = randbytes(1)
self.session_id = np.random.bytes(1)
print(self.session_id)
# Update data_channel timestamp

View file

@ -42,11 +42,12 @@ class explorer():
gridsquare = str(static.MYGRID, "utf-8")
version = str(static.VERSION)
bandwidth = str(static.LOW_BANDWIDTH_MODE)
beacon = str(static.BEACON_STATE)
log.info("[EXPLORER] publish", frequency=frequency, band=band, callsign=callsign, gridsquare=gridsquare, version=version, bandwidth=bandwidth)
headers = {"Content-Type": "application/json"}
station_data = {'callsign': callsign, 'gridsquare': gridsquare, 'frequency': frequency, 'band': band, 'version': version, 'bandwidth': bandwidth}
station_data = {'callsign': callsign, 'gridsquare': gridsquare, 'frequency': frequency, 'band': band, 'version': version, 'bandwidth': bandwidth, 'beacon': beacon}
station_data = json.dumps(station_data)
try:
response = requests.post(self.explorer_url, json=station_data, headers=headers)