Skip to content

Commit 1adb8b8

Browse files
authored
[no ci] Update wifibroadcast-ng (#1730)
1 parent 0822a26 commit 1adb8b8

File tree

5 files changed

+64
-60
lines changed

5 files changed

+64
-60
lines changed

general/package/wifibroadcast-ng/files/wfb.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
wireless:
22
txpower: 1
33
channel: 161
4-
mode: HT20
4+
width: HT20
55
broadcast:
6-
wfb_index: 2
6+
mcs_index: 2
77
tun_index: 1
88
fec_k: 8
99
fec_n: 12
10+
stbc: 0
11+
ldpc: 0
1012
link_id: 7669206
1113
telemetry:
1214
router: msposd

general/package/wifibroadcast-ng/files/wifibroadcast

+8-8
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,25 @@ load_modules() {
5555

5656
load_interface() {
5757
iw "$wfb_dev" set monitor none
58-
iw "$wfb_dev" set channel "$channel" "$mode"
58+
iw "$wfb_dev" set channel "$channel" "$width"
5959
iw reg set 00
6060

61-
[ "$driver" = "88XXau" ] && wfb_pwr=$((txpower * -100)) || wfb_pwr=$((txpower * 50))
62-
iw "$wfb_dev" set txpower fixed "$wfb_pwr"
63-
[ "$mode" = "HT20" ] && bandwidth=20 || bandwidth=40
61+
[ "$driver" = "88XXau" ] && wfb_power=$((txpower * -100)) || wfb_power=$((txpower * 50))
62+
iw "$wfb_dev" set txpower fixed "$wfb_power"
63+
[ "$width" = "HT20" ] && wfb_width=20 || wfb_width=40
6464
}
6565

6666
start_broadcast() {
6767
echo_log "Starting wfb_tx"
68-
wfb_tx -K "$wfb_key" -M "$wfb_index" -B "$bandwidth" -C 8000 -G short \
69-
-k "$fec_k" -n "$fec_n" -i "$link_id" "$wfb_dev" &> /dev/null &
68+
wfb_tx -K "$wfb_key" -M "$mcs_index" -B "$wfb_width" -k "$fec_k" -n "$fec_n" \
69+
-S "$stbc" -L "$ldpc" -i "$link_id" -C 8000 -G short "$wfb_dev" &> /dev/null &
7070
}
7171

7272
start_tunnel() {
7373
echo_log "Starting wfb_tun"
7474
wfb_rx -p 160 -u 5800 -K "$wfb_key" -i "$link_id" "$wfb_dev" &> /dev/null &
75-
wfb_tx -p 32 -u 5801 -K "$wfb_key" -M "$tun_index" \
76-
-k "$fec_k" -n "$fec_n" -i "$link_id" "$wfb_dev" &> /dev/null &
75+
wfb_tx -p 32 -u 5801 -K "$wfb_key" -M "$tun_index" -k "$fec_k" -n "$fec_n" \
76+
-S "$stbc" -L "$ldpc" -i "$link_id" "$wfb_dev" &> /dev/null &
7777
wfb_tun -a 10.5.0.10/24 > /dev/null &
7878
}
7979

general/package/wifibroadcast-ng/www/index.html

+12-12
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
<a href="javascript:location.reload()"><img src="logo.webp" width="220dp"></a>
1313
</header>
1414

15-
<div class="container">
16-
<section class="video-section">
17-
<video id="preview" poster="/mjpeg"></video>
18-
</section>
15+
<section class="video-section">
16+
<video id="preview" poster="/mjpeg"></video>
17+
</section>
1918

19+
<div class="container">
2020
<section class="form-section">
2121
<form id="majestic-form">
2222
<h3>Video</h3>
@@ -41,7 +41,7 @@ <h3>Video</h3>
4141
<select id="bitrate" name="majestic.video0.bitrate"></select>
4242
</div>
4343
<div class="row">
44-
<label for="records">Recording:</label>
44+
<label for="records">Record:</label>
4545
<input type="checkbox" id="records" name="majestic.records.enabled">
4646
</div>
4747

@@ -53,14 +53,16 @@ <h3>Audio</h3>
5353
<input type="checkbox" id="audio" name="majestic.audio.enabled">
5454
</div>
5555
<div class="row">
56-
<label for="srate">Samplerate:</label>
56+
<label for="srate">Sample:</label>
5757
<select id="srate" name="majestic.audio.srate">
5858
<option value="8000">8000</option>
5959
<option value="48000">48000</option>
6060
</select>
6161
</div>
6262
</form>
6363

64+
<hr class="divider">
65+
6466
<div class="button-container">
6567
<button id="apply-video-button">Apply</button>
6668
<button id="reset-video-button">Reset</button>
@@ -115,12 +117,8 @@ <h3>Wireless</h3>
115117

116118
<h3>Broadcast</h3>
117119
<div class="row">
118-
<label for="wfb_index">WFB Index:</label>
119-
<select id="wfb_index" name="wfb.broadcast.wfb_index"></select>
120-
</div>
121-
<div class="row">
122-
<label for="tun_index">TUN Index:</label>
123-
<select id="tun_index" name="wfb.broadcast.tun_index"></select>
120+
<label for="wfb_index">MCS Index:</label>
121+
<select id="wfb_index" name="wfb.broadcast.mcs_index"></select>
124122
</div>
125123

126124
<hr class="divider">
@@ -142,6 +140,8 @@ <h3>Telemetry</h3>
142140
</div>
143141
</form>
144142

143+
<hr class="divider">
144+
145145
<div class="button-container">
146146
<button id="apply-wfb-button">Apply</button>
147147
<button id="reset-wfb-button">Reset</button>

general/package/wifibroadcast-ng/www/script.js

+7-14
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ async function runCommand(command) {
2222
});
2323
}
2424

25+
if (navigator.userAgent.includes("Android")) {
26+
document.querySelector('.video-section').style.display = 'none';
27+
}
28+
2529
function syncForm(data, formPrefix, mode) {
2630
Object.keys(data).forEach((section) => {
2731
Object.keys(data[section]).forEach((key) => {
@@ -34,17 +38,10 @@ function syncForm(data, formPrefix, mode) {
3438
const value = data[section][key];
3539

3640
if (mode === "setup") {
37-
if (isCheckbox) {
38-
field.checked = value === true;
39-
} else {
40-
field.value = value;
41-
}
41+
isCheckbox ? field.checked = value === true : field.value = value;
4242
} else if (mode === "update") {
43-
if (isCheckbox) {
44-
data[section][key] = field.checked;
45-
} else {
46-
data[section][key] = field.value;
47-
}
43+
data[section][key] = isCheckbox ?
44+
field.checked : (isNaN(field.value) ? field.value : Number(field.value));
4845
}
4946
});
5047
});
@@ -99,7 +96,3 @@ loadYAML('/etc/wfb.yaml', (data) => {
9996
configData.wfb = data;
10097
syncForm(configData.wfb, 'wfb', "setup");
10198
});
102-
103-
if (navigator.userAgent.includes("Android")) {
104-
document.querySelector('.video-section').style.display = 'none';
105-
}

general/package/wifibroadcast-ng/www/style.css

+33-24
Original file line numberDiff line numberDiff line change
@@ -19,69 +19,78 @@ h3 {
1919
color: #dee2e6bf;
2020
}
2121

22-
.row {
23-
margin: 20px;
22+
.container {
23+
display: flex;
24+
justify-content: space-evenly;
25+
width: 100%;
26+
}
27+
28+
.form-section .row {
29+
display: flex;
30+
justify-content: space-between;
31+
margin: 10px 40px;
2432
}
2533

2634
.form-section {
35+
width: 45%;
36+
margin: 20px 0;
37+
padding-top: 20px;
2738
background-color: #2d2d2d;
2839
border-radius: 4px;
2940
box-shadow: 0 2px 10px #00000080;
30-
max-width: 60%;
31-
padding: 20px;
32-
margin: 20px auto;
3341
}
3442

3543
.form-section label {
44+
width: 10vw;
45+
margin: 10px 0 5px;
3646
display: inline-block;
3747
font-weight: bold;
38-
margin: 10px 0 5px;
39-
width: 150px;
40-
vertical-align: top;
4148
color: #dee2e6;
49+
font-size: 0.9rem;
4250
}
4351

4452
.form-section select {
45-
width: 120px;
53+
width: 16vw;
4654
padding: 10px;
4755
margin-bottom: 15px;
56+
background-color: #3c3c3c;
4857
border-radius: 4px;
4958
border: 1px solid #555;
50-
background-color: #3c3c3c;
5159
color: #dcdcdc;
52-
display: inline-block;
53-
box-sizing: border-box;
60+
font-size: 0.9rem;
5461
}
5562

5663
.form-section input {
57-
width: 120px;
58-
height: 25px;
59-
}
60-
61-
.button-container {
62-
display: flex;
63-
flex-direction: column;
64-
align-items: center;
64+
width: 16vw;
65+
height: 26px;
66+
margin-bottom: 25px;
6567
}
6668

6769
.form-section button {
68-
width: 160px;
70+
width: 20vw;
6971
padding: 10px;
7072
margin: 10px;
7173
border: none;
72-
border-radius: 4px;
7374
cursor: pointer;
7475
font-size: 1rem;
7576
color: white;
77+
border-radius: 4px;
7678
box-shadow: 0 2px 10px #00000040;
7779
}
7880

81+
.button-container {
82+
display: flex;
83+
flex-direction: column;
84+
align-items: center;
85+
margin: 25px;
86+
}
87+
7988
#preview {
8089
width: 100%;
81-
max-width: 80%;
90+
max-width: 75%;
8291
background-color: #000;
83-
box-shadow: 0 2px 10px #00000080;
8492
border-radius: 4px;
93+
box-shadow: 0 2px 10px #00000080;
8594
}
8695

8796
#apply-video-button, #apply-wfb-button {

0 commit comments

Comments
 (0)