mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Merge branch 'main' into ls-gui-single-pager
This commit is contained in:
commit
c4ce7d4e82
3 changed files with 44 additions and 38 deletions
|
@ -831,6 +831,10 @@ ipcRenderer.on("action-new-msg-received", (event, arg) => {
|
||||||
|
|
||||||
add_obj_to_database(obj);
|
add_obj_to_database(obj);
|
||||||
update_chat_obj_by_uuid(obj.uuid);
|
update_chat_obj_by_uuid(obj.uuid);
|
||||||
|
// check for messages which failed and try to transmit them
|
||||||
|
if (config.enable_auto_retry.toUpperCase() == "TRUE") {
|
||||||
|
checkForWaitingMessages(obj.dxcallsign);
|
||||||
|
}
|
||||||
|
|
||||||
// handle ping-ack
|
// handle ping-ack
|
||||||
} else if (item.ping == "acknowledge") {
|
} else if (item.ping == "acknowledge") {
|
||||||
|
@ -869,7 +873,10 @@ ipcRenderer.on("action-new-msg-received", (event, arg) => {
|
||||||
obj.new = 0;
|
obj.new = 0;
|
||||||
add_obj_to_database(obj);
|
add_obj_to_database(obj);
|
||||||
update_chat_obj_by_uuid(obj.uuid);
|
update_chat_obj_by_uuid(obj.uuid);
|
||||||
|
// check for messages which failed and try to transmit them
|
||||||
|
if (config.enable_auto_retry.toUpperCase() == "TRUE") {
|
||||||
|
checkForWaitingMessages(obj.dxcallsign);
|
||||||
|
}
|
||||||
// handle ARQ transmission
|
// handle ARQ transmission
|
||||||
} else if (item.arq == "transmission" && item.status == "received") {
|
} else if (item.arq == "transmission" && item.status == "received") {
|
||||||
//var encoded_data = atob(item.data);
|
//var encoded_data = atob(item.data);
|
||||||
|
@ -1068,7 +1075,7 @@ update_chat = function (obj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if wrong status message
|
// check if wrong status message
|
||||||
if (obj.status == "transmit" && obj.type == "transmit" && obj.percent < 100) {
|
if (obj.status == "transmitting" && obj.type == "transmit" && obj.percent < 100) {
|
||||||
var TimeDifference = new Date().getTime() / 1000 - obj.timestamp;
|
var TimeDifference = new Date().getTime() / 1000 - obj.timestamp;
|
||||||
if (TimeDifference > 21600) {
|
if (TimeDifference > 21600) {
|
||||||
//Six hours
|
//Six hours
|
||||||
|
@ -1291,6 +1298,17 @@ update_chat = function (obj) {
|
||||||
//get user information
|
//get user information
|
||||||
getSetUserInformation(selected_callsign);
|
getSetUserInformation(selected_callsign);
|
||||||
getSetUserSharedFolder(selected_callsign);
|
getSetUserSharedFolder(selected_callsign);
|
||||||
|
if (selected_callsign.startsWith("BC-")) {
|
||||||
|
document
|
||||||
|
.getElementById("chatModuleMessage")
|
||||||
|
.setAttribute("maxlength", 16);
|
||||||
|
//console.log("Setting max message size to 16")
|
||||||
|
} else {
|
||||||
|
document
|
||||||
|
.getElementById("chatModuleMessage")
|
||||||
|
.setAttribute("maxlength", 524288);
|
||||||
|
//console.log("Setting max message size to big#")
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// if callsign entry already exists - update
|
// if callsign entry already exists - update
|
||||||
|
@ -1319,10 +1337,6 @@ update_chat = function (obj) {
|
||||||
|
|
||||||
if (!document.getElementById("msg-" + obj._id)) {
|
if (!document.getElementById("msg-" + obj._id)) {
|
||||||
if (obj.type == "ping") {
|
if (obj.type == "ping") {
|
||||||
// check for messages which failed and try to transmit them
|
|
||||||
if (config.enable_auto_retry.toUpperCase() == "TRUE") {
|
|
||||||
checkForWaitingMessages(obj.dxcallsign);
|
|
||||||
}
|
|
||||||
//if (obj.new == 1)
|
//if (obj.new == 1)
|
||||||
//{
|
//{
|
||||||
// showOsPopUp("Ping from " + obj.dxcallsign,"You've been ping'd!");
|
// showOsPopUp("Ping from " + obj.dxcallsign,"You've been ping'd!");
|
||||||
|
@ -1341,10 +1355,6 @@ update_chat = function (obj) {
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
if (obj.type == "beacon") {
|
if (obj.type == "beacon") {
|
||||||
// check for messages which failed and try to transmit them
|
|
||||||
if (config.enable_auto_retry.toUpperCase() == "TRUE") {
|
|
||||||
checkForWaitingMessages(obj.dxcallsign);
|
|
||||||
}
|
|
||||||
var new_message = `
|
var new_message = `
|
||||||
<div class="p-0 rounded m-auto mt-1 w-50 bg-info bg-gradient" id="msg-${obj._id}">
|
<div class="p-0 rounded m-auto mt-1 w-50 bg-info bg-gradient" id="msg-${obj._id}">
|
||||||
<p class="text-small text-white text-break" style="font-size: 0.7rem;"><i class="m-3 bi bi-broadcast"></i>snr: ${obj.snr} - ${timestamp} </p>
|
<p class="text-small text-white text-break" style="font-size: 0.7rem;"><i class="m-3 bi bi-broadcast"></i>snr: ${obj.snr} - ${timestamp} </p>
|
||||||
|
@ -2500,14 +2510,8 @@ function getSetUserInformation(selected_callsign) {
|
||||||
|
|
||||||
if (selected_callsign.startsWith("BC-")) {
|
if (selected_callsign.startsWith("BC-")) {
|
||||||
var userIcon = defaultGroupIcon;
|
var userIcon = defaultGroupIcon;
|
||||||
document
|
|
||||||
.getElementById("chatModuleMessage")
|
|
||||||
.setAttribute("maxlength", 16);
|
|
||||||
} else {
|
} else {
|
||||||
var userIcon = defaultUserIcon;
|
var userIcon = defaultUserIcon;
|
||||||
document
|
|
||||||
.getElementById("chatModuleMessage")
|
|
||||||
.setAttribute("maxlength", 524288);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById("user-image-" + selected_callsign).src =
|
document.getElementById("user-image-" + selected_callsign).src =
|
||||||
|
@ -2569,15 +2573,9 @@ function getSetUserInformation(selected_callsign) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
|
||||||
if (selected_callsign.startsWith("BC-")) {
|
if (selected_callsign.startsWith("BC-")) {
|
||||||
document
|
|
||||||
.getElementById("chatModuleMessage")
|
|
||||||
.setAttribute("maxlength", 16);
|
|
||||||
var userIcon = defaultGroupIcon;
|
var userIcon = defaultGroupIcon;
|
||||||
} else {
|
} else {
|
||||||
var userIcon = defaultUserIcon;
|
var userIcon = defaultUserIcon;
|
||||||
document
|
|
||||||
.getElementById("chatModuleMessage")
|
|
||||||
.setAttribute("maxlength", 524288);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callsign list elements
|
// Callsign list elements
|
||||||
|
@ -2810,7 +2808,6 @@ function changeGuiDesign(design) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkForWaitingMessages(dxcall) {
|
function checkForWaitingMessages(dxcall) {
|
||||||
console.log(dxcall);
|
|
||||||
db.find({
|
db.find({
|
||||||
selector: {
|
selector: {
|
||||||
dxcallsign: dxcall,
|
dxcallsign: dxcall,
|
||||||
|
@ -2820,6 +2817,7 @@ function checkForWaitingMessages(dxcall) {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(function (result) {
|
.then(function (result) {
|
||||||
|
console.log("Found " + result.docs.length + " messages waiting for " + dxcall)
|
||||||
// handle result
|
// handle result
|
||||||
if (result.docs.length > 0) {
|
if (result.docs.length > 0) {
|
||||||
// only want to process the first available item object, then return
|
// only want to process the first available item object, then return
|
||||||
|
@ -2854,7 +2852,7 @@ function checkForWaitingMessages(dxcall) {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
console.log("nope");
|
//console.log("nope");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(function (err) {
|
.catch(function (err) {
|
||||||
|
|
33
tnc/modem.py
33
tnc/modem.py
|
@ -875,7 +875,10 @@ class RF:
|
||||||
# we need to disable this if in testmode as its causing problems with FIFO it seems
|
# we need to disable this if in testmode as its causing problems with FIFO it seems
|
||||||
if not TESTMODE:
|
if not TESTMODE:
|
||||||
ModemParam.is_codec2_traffic = True
|
ModemParam.is_codec2_traffic = True
|
||||||
|
if not ModemParam.channel_busy:
|
||||||
|
self.log.debug("[MDM] Setting channel_busy since codec2 data detected")
|
||||||
|
ModemParam.channel_busy=True
|
||||||
|
ModemParam.channel_busy_delay+=10
|
||||||
self.log.debug(
|
self.log.debug(
|
||||||
"[MDM] [demod_audio] modem state", mode=mode_name, rx_status=rx_status,
|
"[MDM] [demod_audio] modem state", mode=mode_name, rx_status=rx_status,
|
||||||
sync_flag=codec2.api.rx_sync_flags_to_text[rx_status]
|
sync_flag=codec2.api.rx_sync_flags_to_text[rx_status]
|
||||||
|
@ -1261,7 +1264,7 @@ class RF:
|
||||||
whether the channel is "busy."
|
whether the channel is "busy."
|
||||||
"""
|
"""
|
||||||
# Initialize channel_busy_delay counter
|
# Initialize channel_busy_delay counter
|
||||||
channel_busy_delay = 0
|
#channel_busy_delay = 0
|
||||||
|
|
||||||
# Initialize dbfs counter
|
# Initialize dbfs counter
|
||||||
rms_counter = 0
|
rms_counter = 0
|
||||||
|
@ -1343,6 +1346,9 @@ class RF:
|
||||||
slot3 = [120, 176]
|
slot3 = [120, 176]
|
||||||
slot4 = [176, 231]
|
slot4 = [176, 231]
|
||||||
slot5 = [231, len(dfftlist)]
|
slot5 = [231, len(dfftlist)]
|
||||||
|
|
||||||
|
# Set to true if we should increment delay count; else false to decrement
|
||||||
|
addDelay=False
|
||||||
for range in [slot1, slot2, slot3, slot4, slot5]:
|
for range in [slot1, slot2, slot3, slot4, slot5]:
|
||||||
|
|
||||||
range_start = range[0]
|
range_start = range[0]
|
||||||
|
@ -1354,22 +1360,23 @@ class RF:
|
||||||
# If we have a signal, increment our channel_busy delay counter
|
# If we have a signal, increment our channel_busy delay counter
|
||||||
# so we have a smoother state toggle
|
# so we have a smoother state toggle
|
||||||
if np.sum(slotdfft[slotdfft > avg + 15]) >= 200 and not TNC.transmitting:
|
if np.sum(slotdfft[slotdfft > avg + 15]) >= 200 and not TNC.transmitting:
|
||||||
ModemParam.channel_busy = True
|
addDelay=True
|
||||||
ModemParam.channel_busy_slot[slot] = True
|
ModemParam.channel_busy_slot[slot] = True
|
||||||
# Limit delay counter to a maximum of 200. The higher this value,
|
|
||||||
# the longer we will wait until releasing state
|
|
||||||
channel_busy_delay = min(channel_busy_delay + 10, 200)
|
|
||||||
else:
|
else:
|
||||||
# Decrement channel busy counter if no signal has been detected.
|
|
||||||
channel_busy_delay = max(channel_busy_delay - 1, 0)
|
|
||||||
# When our channel busy counter reaches 0, toggle state to False
|
|
||||||
if channel_busy_delay == 0:
|
|
||||||
ModemParam.channel_busy = False
|
|
||||||
ModemParam.channel_busy_slot[slot] = False
|
ModemParam.channel_busy_slot[slot] = False
|
||||||
|
|
||||||
# increment slot
|
# increment slot
|
||||||
slot += 1
|
slot += 1
|
||||||
|
if (addDelay):
|
||||||
|
# Limit delay counter to a maximum of 200. The higher this value,
|
||||||
|
# the longer we will wait until releasing state
|
||||||
|
ModemParam.channel_busy = True
|
||||||
|
ModemParam.channel_busy_delay = min(ModemParam.channel_busy_delay + 10, 200)
|
||||||
|
else:
|
||||||
|
# Decrement channel busy counter if no signal has been detected.
|
||||||
|
ModemParam.channel_busy_delay = max(ModemParam.channel_busy_delay - 1, 0)
|
||||||
|
# When our channel busy counter reaches 0, toggle state to False
|
||||||
|
if ModemParam.channel_busy_delay == 0:
|
||||||
|
ModemParam.channel_busy = False
|
||||||
AudioParam.fft = dfftlist[:315] # 315 --> bandwidth 3200
|
AudioParam.fft = dfftlist[:315] # 315 --> bandwidth 3200
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
self.log.error(f"[MDM] calculate_fft: Exception: {err}")
|
self.log.error(f"[MDM] calculate_fft: Exception: {err}")
|
||||||
|
|
|
@ -106,6 +106,7 @@ class ModemParam:
|
||||||
tx_delay: int = 0 # delay in ms before sending modulation for triggering VOX for example or slow PTT radios
|
tx_delay: int = 0 # delay in ms before sending modulation for triggering VOX for example or slow PTT radios
|
||||||
enable_scatter: bool = False
|
enable_scatter: bool = False
|
||||||
scatter = []
|
scatter = []
|
||||||
|
channel_busy_delay = 0
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Station:
|
class Station:
|
||||||
|
|
Loading…
Reference in a new issue