[no ci] Update wifibroadcast-ng (#1721)

pull/1722/head
viktorxda 2025-02-21 18:42:13 +01:00 committed by GitHub
parent 096d3fb40d
commit f46e846ad5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 76 additions and 46 deletions

View File

@ -1,5 +1,5 @@
wireless: wireless:
txpower: 1 txpower: 10
channel: 161 channel: 161
mode: HT20 mode: HT20
broadcast: broadcast:
@ -10,5 +10,5 @@ broadcast:
link_id: 7669206 link_id: 7669206
telemetry: telemetry:
router: msposd router: msposd
serial: /dev/ttyS2 serial: ttyS2
osd_fps: 20 osd_fps: 20

View File

@ -13,7 +13,6 @@ wfb_yaml() {
} }
load_config() { load_config() {
wfb_yaml /rom/etc/wfb.yaml
wfb_yaml /etc/wfb.yaml wfb_yaml /etc/wfb.yaml
[ ! -e "$wfb_key" ] && wfb_key=/rom/etc/drone.key [ ! -e "$wfb_key" ] && wfb_key=/rom/etc/drone.key
} }
@ -84,10 +83,10 @@ start_telemetry() {
config=$(curl -s localhost/api/v1/config.json) config=$(curl -s localhost/api/v1/config.json)
[ -n "$config" ] && size=$(echo "$config" | jsonfilter -e "@.video0.size") [ -n "$config" ] && size=$(echo "$config" | jsonfilter -e "@.video0.size")
msposd -b 115200 -c 8 -d -r "$osd_fps" -z "${size:-1280x720}" \ msposd -b 115200 -c 8 -d -r "$osd_fps" -z "${size:-1280x720}" \
-m "$serial" -o 10.5.0.1:14551 > /dev/null & -m /dev/"$serial" -o 10.5.0.1:14551 > /dev/null &
elif [ "$router" = "mavfwd" ]; then elif [ "$router" = "mavfwd" ]; then
mavfwd --baudrate 115200 --channels 8 -p 100 -a 15 -t \ mavfwd -b 115200 -c 8 -p 100 -a 15 -t \
--master "$serial" --in 0.0.0.0:14550 --out 10.5.0.1:14551 > /dev/null & -m /dev/"$serial" -i 0.0.0.0:14550 -o 10.5.0.1:14551 > /dev/null &
fi fi
} }
@ -95,14 +94,16 @@ video_settings() {
sensor=$(ipcinfo -s) sensor=$(ipcinfo -s)
cli -s .isp.sensorConfig /etc/sensors/"$sensor"_fpv.bin cli -s .isp.sensorConfig /etc/sensors/"$sensor"_fpv.bin
cli -s .isp.exposure 5 cli -s .isp.exposure 5
cli -s .video0.fps 60 cli -s .video0.fps 90
cli -s .video0.bitrate 10240 cli -s .video0.bitrate 8192
cli -s .video0.codec h265 cli -s .video0.codec h265
cli -s .video0.rcMode cbr cli -s .video0.rcMode cbr
cli -s .outgoing.enabled true cli -s .outgoing.enabled true
cli -s .outgoing.server udp://0.0.0.0:5600 cli -s .outgoing.server udp://0.0.0.0:5600
cli -s .fpv.enabled true cli -s .fpv.enabled true
cli -s .fpv.noiseLevel 1 cli -s .fpv.noiseLevel 1
killall -1 majestic
} }
start() { start() {
@ -114,7 +115,6 @@ start() {
sleep 1 sleep 1
video_settings video_settings
touch /etc/system.ok touch /etc/system.ok
killall -1 majestic
fi fi
stop stop
@ -137,14 +137,18 @@ case "$1" in
$1 $1
;; ;;
reset) resetv)
cp -f /rom/etc/majestic.yaml /etc/majestic.yaml cp -f /rom/etc/majestic.yaml /etc/majestic.yaml
cp -f /rom/etc/wfb.yaml /etc/wfb.yaml
video_settings video_settings
;; ;;
resetw)
cp -f /rom/etc/wfb.yaml /etc/wfb.yaml
start
;;
*) *)
echo "Usage: $0 {start|stop|reset}" echo "Usage: $0 {start|stop|resetv|resetw}"
exit 1 exit 1
;; ;;
esac esac

View File

@ -11,6 +11,7 @@
color: #dcdcdc; color: #dcdcdc;
text-align: center; text-align: center;
} }
header { header {
background-color: #252526; background-color: #252526;
border-radius: 4px; border-radius: 4px;
@ -18,14 +19,17 @@
color: white; color: white;
padding: 15px 0; padding: 15px 0;
} }
h3 { h3 {
font-size: 1.5rem; font-size: 1.5rem;
margin-top: 1rem; margin-top: 1rem;
color: #dee2e6bf; color: #dee2e6bf;
} }
.container { .container {
padding: 20px; padding: 20px;
} }
.form-section { .form-section {
background-color: #2d2d2d; background-color: #2d2d2d;
border-radius: 4px; border-radius: 4px;
@ -34,6 +38,7 @@
padding: 20px; padding: 20px;
margin: 20px auto; margin: 20px auto;
} }
.form-section label { .form-section label {
display: inline-block; display: inline-block;
font-weight: bold; font-weight: bold;
@ -42,6 +47,7 @@
vertical-align: top; vertical-align: top;
color: #dee2e6; color: #dee2e6;
} }
.form-section select { .form-section select {
width: 120px; width: 120px;
padding: 10px; padding: 10px;
@ -53,23 +59,46 @@
display: inline-block; display: inline-block;
box-sizing: border-box; box-sizing: border-box;
} }
.form-section input { .form-section input {
width: 120px; width: 120px;
height: 25px; height: 25px;
} }
.button-container {
display: flex;
flex-direction: column;
align-items: center;
}
.form-section button { .form-section button {
background-color: #0d6efd80; width: 160px;
box-shadow: 0 2px 10px #00000040; padding: 10px;
color: white; margin: 10px;
padding: 10px 60px;
border: none; border: none;
border-radius: 4px; border-radius: 4px;
cursor: pointer; cursor: pointer;
font-size: 1rem; font-size: 1rem;
color: white;
box-shadow: 0 2px 10px #00000040;
} }
.form-section button:hover {
background-color: #0b5ed7; #apply-video-button, #apply-wfb-button {
background-color: #0d4aa5;
} }
#apply-video-button:hover, #apply-wfb-button:hover {
background-color: #115fd4;
}
#reset-video-button, #reset-wfb-button {
background-color: #b81414;
}
#reset-video-button:hover, #reset-wfb-button:hover {
background-color: #e61919;
}
#preview { #preview {
width: 100%; width: 100%;
max-width: 1200px; max-width: 1200px;
@ -77,6 +106,7 @@
box-shadow: 0 2px 10px #00000080; box-shadow: 0 2px 10px #00000080;
border-radius: 4px; border-radius: 4px;
} }
.row { .row {
margin-bottom: 15px; margin-bottom: 15px;
} }
@ -121,7 +151,10 @@
<input type="checkbox" id="records" name="majestic.records.enabled"> <input type="checkbox" id="records" name="majestic.records.enabled">
</div> </div>
</form> </form>
<button id="apply-majestic-button">Apply</button> <div class="button-container">
<button id="apply-video-button">Apply</button>
<button id="reset-video-button">Reset</button>
</div>
</section> </section>
<section class="form-section"> <section class="form-section">
@ -197,17 +230,15 @@
<div class="row"> <div class="row">
<label for="serial">Serial:</label> <label for="serial">Serial:</label>
<select id="serial" name="wfb.telemetry.serial"> <select id="serial" name="wfb.telemetry.serial">
<option value="/dev/ttyS0">/dev/ttyS0</option> <option value="ttyS0">/dev/ttyS0</option>
<option value="/dev/ttyS2">/dev/ttyS2</option> <option value="ttyS2">/dev/ttyS2</option>
</select> </select>
</div> </div>
</form> </form>
<div class="button-container">
<button id="apply-wfb-button">Apply</button> <button id="apply-wfb-button">Apply</button>
</section> <button id="reset-wfb-button">Reset</button>
</div>
<section class="form-section">
<h3>Configuration</h3>
<button id="reset-button">Reset</button>
</section> </section>
</div> </div>
@ -272,29 +303,24 @@
} }
populateSelect('bitrate', 1024, 20480, 1024); populateSelect('bitrate', 1024, 20480, 1024);
populateSelect('txpower', 1, 50, 1); populateSelect('txpower', 1, 58, 1);
populateSelect('wfb_index', 0, 8, 1); populateSelect('wfb_index', 0, 8, 1);
populateSelect('tun_index', 0, 8, 1); populateSelect('tun_index', 0, 8, 1);
document.getElementById('apply-majestic-button').addEventListener('click', function() { function addClickListener(buttonId, command, configKey, yamlPath) {
if (configData.majestic) { document.getElementById(buttonId).addEventListener('click', function () {
syncForm(configData.majestic, 'majestic', "update"); if (configKey && configData[configKey]) {
uploadYAML(configData.majestic, '/etc/majestic.yaml'); syncForm(configData[configKey], configKey, "update");
executeDelay(this, 'killall -1 majestic'); uploadYAML(configData[configKey], yamlPath);
} }
executeDelay(this, command);
}); });
document.getElementById('apply-wfb-button').addEventListener('click', function() {
if (configData.wfb) {
syncForm(configData.wfb, 'wfb', "update");
uploadYAML(configData.wfb, '/etc/wfb.yaml');
executeDelay(this, 'wifibroadcast start');
} }
});
document.getElementById('reset-button').addEventListener('click', function() { addClickListener('apply-video-button', 'killall -1 majestic', 'majestic', '/etc/majestic.yaml');
executeDelay(this, 'wifibroadcast reset'); addClickListener('apply-wfb-button', 'wifibroadcast start', 'wfb', '/etc/wfb.yaml');
}); addClickListener('reset-wfb-button', 'wifibroadcast resetw');
addClickListener('reset-video-button', 'wifibroadcast resetv');
loadYAML('/etc/majestic.yaml', (data) => { loadYAML('/etc/majestic.yaml', (data) => {
configData.majestic = data; configData.majestic = data;