From b6cf6e7c17bc3ca6fa726e2b9f0abf0017e643e0 Mon Sep 17 00:00:00 2001 From: dj2ls Date: Sun, 3 Apr 2022 15:26:24 +0200 Subject: [PATCH] optimized FSK mode and chat --- dj2ls.png | Bin 0 -> 1960 bytes gui/preload-chat.js | 39 +++++-- gui/src/chat-module.html | 230 ++++++++++++--------------------------- gui/src/styles.css | 8 ++ tnc/codec2.py | 4 +- tnc/modem.py | 8 +- 6 files changed, 115 insertions(+), 174 deletions(-) create mode 100644 dj2ls.png diff --git a/dj2ls.png b/dj2ls.png new file mode 100644 index 0000000000000000000000000000000000000000..9db8f82b9103d8f192b85b117dd1981f536fce3f GIT binary patch literal 1960 zcmZ8i_ghoh7DdqcC>B7Gq9B?`N2G`_N}ERuGa?q`*=8t)UPQ`(p-Ksnj-e(LDN>UR zT_C{st@V$+&3nJS?C<90oSS?0K5MVF4s=iWd8v@GT~X9^6%OgRfV;G=Y3M!6jfGLs6%TCKB?7}HN{o6wAkS^ zUS8v{Dmm$8G1_T@p)3pfY!7N%HCIz;#*mXtw{ed14c_yKtm7O6d~LKI-n{kaJiGF6C~LT}^5-4B?n|42Z`{NMWWezOnbN2M(};e}Z9c z{>X_pXh&DhwZFK_<7Q5AA4V?Awf&gO3ADgi#6b-PFppz)D18;Lp~oPn&Uw^gj&eEyQ*Sv{Tv~}GY-8I=5>C>Zbraukz~1}l_rhofx?n)Bf&&=199_ZD zk2#X>2ghJ&(0t}x3`bhhVQk`52@V?3i$iq#*}!lo@EoSj*57Pm_mk^I_SIe`Qpy-R z(2pNCV2Tz9_4wk;AxSzZSr*U{!htLiC=%ES;hwnKP7cokije$6VR8cz_1G} z&h9vZzSZkSxJM9m0)jLgo3uE^V3D&@&ALP{yRgTf-0_U(j8xkTJr_CJ%suQYH2y6( z!3jI5W!LlUZ1xMneIYc`_)eAa2Uj>QSWRP=raYYT#J3D1uAVo9Q483E88cktS}FCV z&u*)HILzUO(m01JFxV#kQG3nFoqhg=G(VR77WVi>Dmb0*?h`G&vT&bfMN||zUx#s! z8`u>rtzk7BE{?(&mpOth+3Qan!`hVCB8}E#%*8Dhy=rb&=l`n#8y?*8l8r1#^kXEY z>Y41Z!vX6Fu;Tk|wqp_I_v{du_1yI+E7Mf)sI}VWtYEHl)0?J8n5*Wogf$>Alnbzw zWlLEWS_{}_r*ic}-z}-lL<9D*DoC2J9VDO*qW5l;5mx zxTUu9id557N^4UybS-uF9H7H`U|=YYs(6Ye_Sv~$MZ+zPti8nvoKys3RAQXNw;oep z#3RhVU{|^H-k8b(n%_5Q5~SSlIO)uEEJj+)G-g6QhC&XZ4u}3H5h1$uA(tfD6kRxO0D6(cOup~8qvtDWC7s! zM$BavseI9gU4anOJQabgaoUN4Pw$4t*|oMN)E3y@mxcPT`6P(->OSO`Hb7EhNQwRc zaZ2l11jO@L;V-iJicKNHe%eDnX?7<%-9p~W^B#T|OVZL%ewG~rcS<;#5h11>qISRc zr&K2@%xSFPOjEFU=(hN)IQ$Y<9mMK&n9t9=?)H|We+7gIRnL4(r{HW;THTXN?1=KJ z{nZ->v6yvry{Y`41r*bA-@z>hW|xR?{_~7S+rwh~>_ zuBUUJJ+`WwSn{>!M2Yy)MpXa?uhx6j2{y~Z9(|BoXoc*tn?s?VXu}xx-eTpYpmri< zcZqo%#60IXhmzU*B25)h;u}L%4=-M*_qr5> zQP;CS7`@Xtg`I2~HSEZAJ`aP?!zf4DoJ%CNaoCDE { + + + // theme selector + if(config.theme != 'default'){ + var theme_path = "../node_modules/bootswatch/dist/"+ config.theme +"/bootstrap.min.css"; + document.getElementById("bootstrap_theme").href = theme_path; + } else { + var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css"; + document.getElementById("bootstrap_theme").href = theme_path; + } + + document.querySelector('emoji-picker').addEventListener("emoji-click", (event) => { document.getElementById('chatModuleMessage').setRangeText(event.detail.emoji.unicode) console.log(event.detail); @@ -130,7 +143,7 @@ window.addEventListener('DOMContentLoaded', () => { document.addEventListener("keyup", function(event) { // Number 13 == Enter - if (event.keyCode === 13) { + if (event.keyCode === 13 && !event.shiftKey) { // Cancel the default action, if needed event.preventDefault(); // Trigger the button element with a click @@ -185,9 +198,9 @@ db.post({ console.log(filename); console.log(filetype); var data_with_attachment = chatmessage + split_char + filename + split_char + filetype + split_char + file; - document.getElementById('selectFilesButton').innerHTML = ` - - `; + + + document.getElementById('selectFilesButton').innerHTML = ``; var uuid = uuidv4(); console.log(data_with_attachment) let Data = { @@ -247,8 +260,7 @@ ipcRenderer.on('return-selected-files', (event, arg) => { file = arg.data; filename = arg.filename; document.getElementById('selectFilesButton').innerHTML = ` - - + New file selected `; @@ -440,7 +452,7 @@ update_chat = function(obj) { var shortmsg = obj.type; } else { var shortmsg = obj.msg; - var maxlength = 45; + var maxlength = 40; var shortmsg = shortmsg.length > maxlength ? shortmsg.substring(0, maxlength - 3) + "..." : shortmsg; @@ -569,6 +581,8 @@ update_chat = function(obj) { } + // CHECK FOR NEW LINE AND REPLACE WITH
+ var message_html = obj.msg.replace('\n', "
"); if (obj.type == 'received') { @@ -578,7 +592,7 @@ update_chat = function(obj) {
${fileheader}
-

${obj.msg}

+

${message_html}

${timestamp} @@ -588,14 +602,17 @@ update_chat = function(obj) {

`; } + + + if (obj.type == 'transmit') { var new_message = ` -
+
-
+
${fileheader}
-

${obj.msg}

+

${message_html}

${timestamp} - ${status} diff --git a/gui/src/chat-module.html b/gui/src/chat-module.html index 1a075251..a0221322 100644 --- a/gui/src/chat-module.html +++ b/gui/src/chat-module.html @@ -1,165 +1,79 @@ - - - - - - - - - - - FreeDATA - CHAT - - - - - - - + + + + + + + + + + + FreeDATA - CHAT + - + + + + + + + + + +

+
+
+
+ +
+
+ + +
+
+
+
+
+
+
+
+ +
+
+ + + +
+
+
+ +
+ +
+ +
+
+ + + + + - - + + + +
+
+
+
+
+ - - - -
-
-
- - - - - - - -
- -
- - - -
- -
- -
- -
-
- -
-
- - -
- -
- - - - - - - -
- - - - -
- -
- - -
- - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - -
- -
- -
-
- - - - - - - - -
- - - - - - diff --git a/gui/src/styles.css b/gui/src/styles.css index b7d24a7f..17112d0c 100644 --- a/gui/src/styles.css +++ b/gui/src/styles.css @@ -2,6 +2,7 @@ body { padding-right: 0px !important; overflow-y: hidden !important; + overflow-x: hidden !important; } /*Progress bars with centered text*/ @@ -15,3 +16,10 @@ body { width: 100%; color: black; } + + +/* hide scrollbar in callsign list */ +#callsignlist::-webkit-scrollbar { + display: none; +} + diff --git a/tnc/codec2.py b/tnc/codec2.py index 47b4f2bb..c1e84c15 100644 --- a/tnc/codec2.py +++ b/tnc/codec2.py @@ -188,8 +188,8 @@ api.FREEDV_MODE_FSK_LDPC_0_ADV.interleave_frames = 0 api.FREEDV_MODE_FSK_LDPC_0_ADV.M = 4 api.FREEDV_MODE_FSK_LDPC_0_ADV.Rs = 100 api.FREEDV_MODE_FSK_LDPC_0_ADV.Fs = 8000 -api.FREEDV_MODE_FSK_LDPC_0_ADV.first_tone = 1150 # 1250 4fsk, 1500 2fsk -api.FREEDV_MODE_FSK_LDPC_0_ADV.tone_spacing = 100 #200 +api.FREEDV_MODE_FSK_LDPC_0_ADV.first_tone = 1400 # 1150 4fsk, 1500 2fsk +api.FREEDV_MODE_FSK_LDPC_0_ADV.tone_spacing = 120 #200 api.FREEDV_MODE_FSK_LDPC_0_ADV.codename = 'H_128_256_5'.encode('utf-8') # code word # --------------- 4 H_256_512_4, 7 bytes diff --git a/tnc/modem.py b/tnc/modem.py index 88fba30b..107afd93 100644 --- a/tnc/modem.py +++ b/tnc/modem.py @@ -386,10 +386,12 @@ class RF(): txbuffer += bytes(mod_out) - + # codec2 fsk preamble may be broken - at least it sounds like that so we are disabling it for testing + if not self.MODE == 'FSK_LDPC_0' or self.MODE == 200 or self.MODE == 'FSK_LDPC_1' or self.MODE == 201: + # write preamble to txbuffer + codec2.api.freedv_rawdatapostambletx(freedv, mod_out_postamble) + txbuffer += bytes(mod_out_postamble) # append postamble to txbuffer - codec2.api.freedv_rawdatapostambletx(freedv, mod_out_postamble) - txbuffer += bytes(mod_out_postamble) # add delay to end of frames samples_delay = int(self.MODEM_SAMPLE_RATE*(repeat_delay/1000)) mod_out_silence = create_string_buffer(samples_delay*2)