[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:
txpower: 1
txpower: 10
channel: 161
mode: HT20
broadcast:
@ -10,5 +10,5 @@ broadcast:
link_id: 7669206
telemetry:
router: msposd
serial: /dev/ttyS2
serial: ttyS2
osd_fps: 20

View File

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

View File

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