diff --git a/general/package/wifibroadcast-ng/files/wfb.yaml b/general/package/wifibroadcast-ng/files/wfb.yaml index 4b87d211..fe8e8a59 100644 --- a/general/package/wifibroadcast-ng/files/wfb.yaml +++ b/general/package/wifibroadcast-ng/files/wfb.yaml @@ -1,12 +1,14 @@ wireless: txpower: 1 channel: 161 - mode: HT20 + width: HT20 broadcast: - wfb_index: 2 + mcs_index: 2 tun_index: 1 fec_k: 8 fec_n: 12 + stbc: 0 + ldpc: 0 link_id: 7669206 telemetry: router: msposd diff --git a/general/package/wifibroadcast-ng/files/wifibroadcast b/general/package/wifibroadcast-ng/files/wifibroadcast index fd817bfc..b6a557a5 100755 --- a/general/package/wifibroadcast-ng/files/wifibroadcast +++ b/general/package/wifibroadcast-ng/files/wifibroadcast @@ -55,25 +55,25 @@ load_modules() { load_interface() { iw "$wfb_dev" set monitor none - iw "$wfb_dev" set channel "$channel" "$mode" + iw "$wfb_dev" set channel "$channel" "$width" iw reg set 00 - [ "$driver" = "88XXau" ] && wfb_pwr=$((txpower * -100)) || wfb_pwr=$((txpower * 50)) - iw "$wfb_dev" set txpower fixed "$wfb_pwr" - [ "$mode" = "HT20" ] && bandwidth=20 || bandwidth=40 + [ "$driver" = "88XXau" ] && wfb_power=$((txpower * -100)) || wfb_power=$((txpower * 50)) + iw "$wfb_dev" set txpower fixed "$wfb_power" + [ "$width" = "HT20" ] && wfb_width=20 || wfb_width=40 } start_broadcast() { echo_log "Starting wfb_tx" - wfb_tx -K "$wfb_key" -M "$wfb_index" -B "$bandwidth" -C 8000 -G short \ - -k "$fec_k" -n "$fec_n" -i "$link_id" "$wfb_dev" &> /dev/null & + wfb_tx -K "$wfb_key" -M "$mcs_index" -B "$wfb_width" -k "$fec_k" -n "$fec_n" \ + -S "$stbc" -L "$ldpc" -i "$link_id" -C 8000 -G short "$wfb_dev" &> /dev/null & } start_tunnel() { echo_log "Starting wfb_tun" wfb_rx -p 160 -u 5800 -K "$wfb_key" -i "$link_id" "$wfb_dev" &> /dev/null & - wfb_tx -p 32 -u 5801 -K "$wfb_key" -M "$tun_index" \ - -k "$fec_k" -n "$fec_n" -i "$link_id" "$wfb_dev" &> /dev/null & + wfb_tx -p 32 -u 5801 -K "$wfb_key" -M "$tun_index" -k "$fec_k" -n "$fec_n" \ + -S "$stbc" -L "$ldpc" -i "$link_id" "$wfb_dev" &> /dev/null & wfb_tun -a 10.5.0.10/24 > /dev/null & } diff --git a/general/package/wifibroadcast-ng/www/index.html b/general/package/wifibroadcast-ng/www/index.html index 1d38607e..52552926 100644 --- a/general/package/wifibroadcast-ng/www/index.html +++ b/general/package/wifibroadcast-ng/www/index.html @@ -12,11 +12,11 @@ <a href="javascript:location.reload()"><img src="logo.webp" width="220dp"></a> </header> -<div class="container"> - <section class="video-section"> - <video id="preview" poster="/mjpeg"></video> - </section> +<section class="video-section"> + <video id="preview" poster="/mjpeg"></video> +</section> +<div class="container"> <section class="form-section"> <form id="majestic-form"> <h3>Video</h3> @@ -41,7 +41,7 @@ <select id="bitrate" name="majestic.video0.bitrate"></select> </div> <div class="row"> - <label for="records">Recording:</label> + <label for="records">Record:</label> <input type="checkbox" id="records" name="majestic.records.enabled"> </div> @@ -53,7 +53,7 @@ <input type="checkbox" id="audio" name="majestic.audio.enabled"> </div> <div class="row"> - <label for="srate">Samplerate:</label> + <label for="srate">Sample:</label> <select id="srate" name="majestic.audio.srate"> <option value="8000">8000</option> <option value="48000">48000</option> @@ -61,6 +61,8 @@ </div> </form> + <hr class="divider"> + <div class="button-container"> <button id="apply-video-button">Apply</button> <button id="reset-video-button">Reset</button> @@ -115,12 +117,8 @@ <h3>Broadcast</h3> <div class="row"> - <label for="wfb_index">WFB Index:</label> - <select id="wfb_index" name="wfb.broadcast.wfb_index"></select> - </div> - <div class="row"> - <label for="tun_index">TUN Index:</label> - <select id="tun_index" name="wfb.broadcast.tun_index"></select> + <label for="wfb_index">MCS Index:</label> + <select id="wfb_index" name="wfb.broadcast.mcs_index"></select> </div> <hr class="divider"> @@ -142,6 +140,8 @@ </div> </form> + <hr class="divider"> + <div class="button-container"> <button id="apply-wfb-button">Apply</button> <button id="reset-wfb-button">Reset</button> diff --git a/general/package/wifibroadcast-ng/www/script.js b/general/package/wifibroadcast-ng/www/script.js index ba09b211..e12cb14f 100644 --- a/general/package/wifibroadcast-ng/www/script.js +++ b/general/package/wifibroadcast-ng/www/script.js @@ -22,6 +22,10 @@ async function runCommand(command) { }); } +if (navigator.userAgent.includes("Android")) { + document.querySelector('.video-section').style.display = 'none'; +} + function syncForm(data, formPrefix, mode) { Object.keys(data).forEach((section) => { Object.keys(data[section]).forEach((key) => { @@ -34,17 +38,10 @@ function syncForm(data, formPrefix, mode) { const value = data[section][key]; if (mode === "setup") { - if (isCheckbox) { - field.checked = value === true; - } else { - field.value = value; - } + isCheckbox ? field.checked = value === true : field.value = value; } else if (mode === "update") { - if (isCheckbox) { - data[section][key] = field.checked; - } else { - data[section][key] = field.value; - } + data[section][key] = isCheckbox ? + field.checked : (isNaN(field.value) ? field.value : Number(field.value)); } }); }); @@ -99,7 +96,3 @@ loadYAML('/etc/wfb.yaml', (data) => { configData.wfb = data; syncForm(configData.wfb, 'wfb', "setup"); }); - -if (navigator.userAgent.includes("Android")) { - document.querySelector('.video-section').style.display = 'none'; -} diff --git a/general/package/wifibroadcast-ng/www/style.css b/general/package/wifibroadcast-ng/www/style.css index 0abcaa61..ba936c23 100644 --- a/general/package/wifibroadcast-ng/www/style.css +++ b/general/package/wifibroadcast-ng/www/style.css @@ -19,69 +19,78 @@ h3 { color: #dee2e6bf; } -.row { - margin: 20px; +.container { + display: flex; + justify-content: space-evenly; + width: 100%; +} + +.form-section .row { + display: flex; + justify-content: space-between; + margin: 10px 40px; } .form-section { + width: 45%; + margin: 20px 0; + padding-top: 20px; background-color: #2d2d2d; border-radius: 4px; box-shadow: 0 2px 10px #00000080; - max-width: 60%; - padding: 20px; - margin: 20px auto; } .form-section label { + width: 10vw; + margin: 10px 0 5px; display: inline-block; font-weight: bold; - margin: 10px 0 5px; - width: 150px; - vertical-align: top; color: #dee2e6; + font-size: 0.9rem; } .form-section select { - width: 120px; + width: 16vw; padding: 10px; margin-bottom: 15px; + background-color: #3c3c3c; border-radius: 4px; border: 1px solid #555; - background-color: #3c3c3c; color: #dcdcdc; - display: inline-block; - box-sizing: border-box; + font-size: 0.9rem; } .form-section input { - width: 120px; - height: 25px; + width: 16vw; + height: 26px; + margin-bottom: 25px; +} + +.form-section button { + width: 20vw; + padding: 10px; + margin: 10px; + border: none; + cursor: pointer; + font-size: 1rem; + color: white; + border-radius: 4px; + box-shadow: 0 2px 10px #00000040; } .button-container { display: flex; flex-direction: column; align-items: center; -} - -.form-section button { - width: 160px; - padding: 10px; - margin: 10px; - border: none; - border-radius: 4px; - cursor: pointer; - font-size: 1rem; - color: white; - box-shadow: 0 2px 10px #00000040; + margin: 25px; } #preview { width: 100%; - max-width: 80%; + max-width: 75%; background-color: #000; - box-shadow: 0 2px 10px #00000080; border-radius: 4px; + box-shadow: 0 2px 10px #00000080; } #apply-video-button, #apply-wfb-button {