audio tuning and chat optimisation

closes #117
This commit is contained in:
dj2ls 2022-04-02 14:54:43 +02:00
parent 3f35a01b94
commit 04f6c49ac5
8 changed files with 106 additions and 18 deletions

2
.gitignore vendored
View File

@ -4,3 +4,5 @@ tnc/codec2
# temporary test artifacts
**/build
**/Testing
package-lock.json

View File

@ -2,3 +2,5 @@ tnc/__pycache__
tnc/daemon.log
tnc/tnc.log
gui/node_modules
tnc/build
tnc/dist

View File

@ -1,6 +1,6 @@
{
"name": "FreeDATA",
"version": "0.3.0-alpha.8",
"version": "0.3.1-alpha.1",
"description": "FreeDATA ",
"main": "main.js",
"scripts": {

View File

@ -133,11 +133,47 @@ window.addEventListener('DOMContentLoaded', () => {
});
// NEW CHAT
document.getElementById("createNewChatButton").addEventListener("click", () => {
var dxcallsign = document.getElementById('chatModuleNewDxCall').value;
var uuid = uuidv4()
db.post({
_id: uuid,
timestamp: Math.floor(Date.now() / 1000),
dxcallsign: dxcallsign.toUpperCase(),
dxgrid: '---',
msg: 'NULL',
checksum: 'NULL',
type: 'newchat',
status: 'NULL',
uuid: uuid
}).then(function(response) {
// handle response
console.log("new database entry");
console.log(response);
}).catch(function(err) {
console.log(err);
});
db.get(uuid, [{
attachments: true
}]).then(function(doc) {
// handle doc
update_chat(doc)
}).catch(function(err) {
console.log(err);
});
});
// SEND MSG
document.getElementById("sendMessage").addEventListener("click", () => {
document.getElementById('emojipickercontainer').style.display = "none";
var dxcallsign = document.getElementById('chatModuleDxCall').value;
dxcallsign = dxcallsign.toUpperCase();
var dxcallsign = selected_callsign.toUpperCase();
var chatmessage = document.getElementById('chatModuleMessage').value;
console.log(file);
console.log(filename);
@ -261,6 +297,7 @@ ipcRenderer.on('action-new-msg-received', (event, arg) => {
obj.status = item.status;
obj.snr = item.snr;
obj.type = item.type;
db.put({
_id: obj.uuid,
timestamp: obj.timestamp,
@ -279,6 +316,7 @@ ipcRenderer.on('action-new-msg-received', (event, arg) => {
}).catch(function(err) {
console.log(err);
});
db.get(item.uuid, {
attachments: true
}).then(function(doc) {
@ -299,6 +337,7 @@ ipcRenderer.on('action-new-msg-received', (event, arg) => {
obj.status = item.status;
obj.snr = item.snr;
obj.type = item.type;
db.put({
_id: obj.uuid,
timestamp: obj.timestamp,
@ -317,6 +356,7 @@ ipcRenderer.on('action-new-msg-received', (event, arg) => {
}).catch(function(err) {
console.log(err);
});
db.get(item.uuid, {
attachments: true
}).then(function(doc) {
@ -366,6 +406,7 @@ ipcRenderer.on('action-new-msg-received', (event, arg) => {
}).catch(function(err) {
console.log(err);
});
db.get(obj.uuid, {
attachments: true
}).then(function(doc) {
@ -415,12 +456,18 @@ update_chat = function(obj) {
callsign_counter++;
if (callsign_counter == 1) {
var callsign_selected = 'active show'
document.getElementById('chatModuleDxCall').value = dxcallsign;
//document.getElementById('chatModuleDxCall').value = dxcallsign;
selected_callsign = dxcallsign;
}
var new_callsign = `
<a class="list-group-item list-group-item-action rounded-4 rounded-top rounded-bottom border-1 mb-2 ${callsign_selected}" id="chat-${dxcallsign}-list" data-bs-toggle="list" href="#chat-${dxcallsign}" role="tab" aria-controls="chat-${dxcallsign}">
<div class="d-flex w-100 justify-content-between">
<div class="rounded-circle p-0">
<i class="bi bi-person-circle p-1" style="font-size:2rem;"></i>
</div>
<h5 class="mb-1">${dxcallsign}</h5>
<small>${dxgrid}</small>
</div>
@ -435,7 +482,7 @@ update_chat = function(obj) {
document.getElementById('nav-tabContent').insertAdjacentHTML("beforeend", message_area);
// create eventlistener for listening on clicking on a callsign
document.getElementById('chat-' + dxcallsign + '-list').addEventListener('click', function() {
document.getElementById('chatModuleDxCall').value = dxcallsign;
//document.getElementById('chatModuleDxCall').value = dxcallsign;
selected_callsign = dxcallsign;
// scroll to bottom
var element = document.getElementById("message-container");
@ -457,18 +504,30 @@ update_chat = function(obj) {
if (!(document.getElementById('msg-' + obj._id))) {
if (obj.type == 'ping') {
var new_message = `
<div class="m-1 p-0 rounded-pill w-100 bg-secondary" id="msg-${obj._id}">
<p class="font-monospace text-small text-white mb-0 text-break"><i class="m-3 bi bi-arrow-left-right"></i>snr: ${obj.snr} - ${timestampShort} </p>
<div class="m-1 p-0 rounded-pill w-100 bg-secondary bg-gradient" id="msg-${obj._id}">
<p class="text-small text-white mb-0 text-break"><i class="m-3 bi bi-arrow-left-right"></i>snr: ${obj.snr} - ${timestamp} </p>
</div>
`;
}
if (obj.type == 'beacon') {
var new_message = `
<div class="m-1 p-0 rounded-pill w-100 bg-info" id="msg-${obj._id}">
<p class="font-monospace text-small text-white text-break"><i class="m-3 bi bi-broadcast"></i>snr: ${obj.snr} - ${timestampShort} </p>
<div class="m-1 p-0 rounded-pill w-100 bg-info bg-gradient" id="msg-${obj._id}">
<p class="text-small text-white text-break"><i class="m-3 bi bi-broadcast"></i>snr: ${obj.snr} - ${timestamp} </p>
</div>
`;
}
if (obj.type == 'newchat') {
var new_message = `
<div class="m-1 p-0 rounded-pill w-100 bg-light bg-gradient" id="msg-${obj._id}">
<p class="text-small text-dark text-break"><i class="m-3 bi bi-file-earmark-plus"></i> new chat openend - ${timestamp} </p>
</div>
`;
}
if (obj.type == 'received') {
var new_message = `
<div class="mt-3 rounded-3 mb-0 w-75" id="msg-${obj._id}">
@ -510,14 +569,20 @@ update_chat = function(obj) {
// CHECK CHECK CHECK --> This could be done better
var id = "chat-" + obj.dxcallsign
document.getElementById(id).insertAdjacentHTML("beforeend", new_message);
var element = document.getElementById("message-container");
element.scrollTo(0, element.scrollHeight);
} else if (document.getElementById('msg-' + obj._id)) {
id = "msg-" + obj._id;
//document.getElementById(id).className = message_class;
}
// CREATE SAVE TO FOLDER EVENT LISTENER
if ((document.getElementById('save-file-msg-' + obj._id))) {
if (document.getElementById('save-file-msg-' + obj._id) && !document.getElementById('save-file-msg-' + obj._id).hasAttribute('listenerOnClick')) {
// set Attribute to determine if we already created an EventListener for this element
document.getElementById('save-file-msg-' + obj._id).setAttribute('listenerOnClick', 'true');
document.getElementById('save-file-msg-' + obj._id).addEventListener("click", () => {
saveFileToFolder(obj._id)
});

View File

@ -287,9 +287,9 @@ document.getElementById('openReceivedFilesFolder').addEventListener('click', ()
// direct
document.getElementById("radio-control-switch1").addEventListener("click", () => {
document.getElementById("radio-control-rigctl").style.visibility = 'hidden';
//document.getElementById("radio-control-rigctl").style.visibility = 'hidden';
document.getElementById("radio-control-rigctld").style.visibility = 'hidden';
document.getElementById("radio-control-rigctl").style.display = 'none';
//document.getElementById("radio-control-rigctl").style.display = 'none';
document.getElementById("radio-control-rigctld").style.display = 'none';
document.getElementById("radio-control-direct").style.display = 'block';

View File

@ -33,8 +33,25 @@
<div class="container-fluid">
<div class="row h-100">
<div class="col-4 p-2 bg-light">
<! ------Chats area ---------------------------------------------------------------------->
<! ------Chats area ---------------------------------------------------------------------->
<div class="container-fluid m-0 p-0">
<div class="input-group bottom-0 m-0 w-100">
<input class="form-control w-50" maxlength="9" style="text-transform:uppercase;" id="chatModuleNewDxCall" placeholder="DX CALL"></input>
<button class="btn btn-sm btn-success w-50" id="createNewChatButton" type="button">Open a new chat</button>
</div>
</div>
<hr class="m-2">
<div class="list-group" id="list-tab" role="tablist">
</div>
@ -63,6 +80,8 @@
</div>
<hr class="m-0">
<! ------messages area ---------------------------------------------------------------------->
<div class="container overflow-auto" id="message-container" style="height: calc(100% - 105px);">
@ -87,7 +106,7 @@
<div class="container-fluid mt-2 p-0">
<div class="input-group bottom-0 w-100">
<input class="form-control" maxlength="8" style="max-width: 6rem; text-transform:uppercase; display:none" id="chatModuleDxCall" placeholder="DX CALL"></input>
<!--<input class="form-control" maxlength="8" style="max-width: 6rem; text-transform:uppercase; display:none" id="chatModuleDxCall" placeholder="DX CALL"></input>-->
<input class="form-control" id="chatModuleMessage" placeholder="Message"></input>
<button class="btn btn-sm btn-primary me-2" id="emojipickerbutton" type="button"><i class="bi bi-emoji-smile"></i></button>

View File

@ -1186,7 +1186,7 @@
<span class="input-group-text" id="basic-addon1">TX Level</span>
<span class="input-group-text" id="audioLevelTXvalue">---</span>
<span class="input-group-text w-75" id="basic-addon1">
<input type="range" class="form-range" min="0" max="200" step="1" id="audioLevelTX"></span>
<input type="range" class="form-range" min="0" max="250" step="1" id="audioLevelTX"></span>
</div>

View File

@ -61,7 +61,7 @@ class DATA():
self.data_frame_bof = b'BOF' # 2 bytes for the BOF End of File indicator in a data frame
self.data_frame_eof = b'EOF' # 2 bytes for the EOF End of File indicator in a data frame
self.rx_n_max_retries_per_burst = 30
self.rx_n_max_retries_per_burst = 50
self.n_retries_per_burst = 0
self.received_low_bandwith_mode = False # indicator if we recevied a low bandwith mode channel ope ner
@ -94,7 +94,7 @@ class DATA():
self.rx_frame_bof_received = False
self.rx_frame_eof_received = False
self.transmission_timeout = 90 # transmission timeout in seconds
self.transmission_timeout = 360 # transmission timeout in seconds
worker_thread_transmit = threading.Thread(target=self.worker_transmit, name="worker thread transmit",daemon=True)
worker_thread_transmit.start()
@ -1626,7 +1626,7 @@ class DATA():
if static.ENABLE_FSK:
modem.MODEM_TRANSMIT_QUEUE.put(['FSK_LDPC_0',2,500,txbuffer])
else:
modem.MODEM_TRANSMIT_QUEUE.put([14,1,0,txbuffer])
modem.MODEM_TRANSMIT_QUEUE.put([14,2,500,txbuffer])
# wait while transmitting
while static.TRANSMITTING:
time.sleep(0.01)