Populate serial device dropdown with ports having FCU symlinks

This commit is contained in:
Youssof 2024-10-24 17:11:50 +00:00
parent 0a55ee1fea
commit 8211399c19
3 changed files with 13 additions and 9 deletions

3
cockpitScript.sh Normal file → Executable file
View File

@ -25,7 +25,8 @@ while [[ $# -gt 0 ]]; do
exit 0 exit 0
;; ;;
-s) -s)
ls /dev/ | grep ttyTH | sed -e "s/.*/\/dev\/&/" readlink -f /dev/serial/by-id/*
# ls /dev/ | grep ttyTH | sed -e "s/.*/\/dev\/&/"
exit 0 exit 0
;; ;;
-i) -i)

View File

@ -17,9 +17,18 @@
<div class="col-lg-12 ms-3"><p class="fw-bold fs-2 mt-3 mb-0">MAVLink Telemetry Configuration</p> </div> <div class="col-lg-12 ms-3"><p class="fw-bold fs-2 mt-3 mb-0">MAVLink Telemetry Configuration</p> </div>
<div class="col-lg-12 ms-3"><p class="mt-0 mb-0">Software Version: <I><span id='version'></span></I>, Configuration File: <I><span id='file_location'></span></I></p> </div> <div class="col-lg-12 ms-3"><p class="mt-0 mb-0">Software Version: <I><span id='version'></span></I>, Configuration File: <I><span id='file_location'></span></I></p> </div>
<div class="col-lg-12 ms-3"><p class="mt-1 me-3">Mavlink-router provides network connectivity to/from the autopilot onboard the EchoPilot AI. The settings below can be used to configure the serial port receiving data from the autopilot as well as endpoints on the network. By default, a TCP server is running on port 5760 of the EchoPilot AI. Additional endpoints can be enabled and configured below.</p></div> <div class="col-lg-12 ms-3"><p class="mt-1 me-3">Mavlink-router provides network connectivity to/from the autopilot onboard the EchoPilot AI. The settings below can be used to configure the serial port receiving data from the autopilot as well as endpoints on the network. By default, a TCP server is running on port 5760 of the EchoPilot AI. Additional endpoints can be enabled and configured below.</p></div>
</div>
<div class="row justify-content-start">
<div class="col-2 ms-3 mt-3"><button class="btn btn-primary" id="save">Save/Update</button></div>
<div class="col mt-3"><span id="result"></span></div>
</div>
<pre id="output"></pre>
<div class="row justify-content-start"> <div class="row justify-content-start">
<div class="col ms-3"><p class="fw-bold fs-5 mt-3 mb-0"><img src="assets/icons/settings_ethernet.svg" class="me-2">FMU Setup</p><p class="fw-light fs-6">Please select the serial device and baud rate used for the input of serial telemetry into the Jetson module. Default baud rate is 500000.</p></div> <div class="col ms-3"><p class="fw-bold fs-5 mt-3 mb-0"><img src="assets/icons/settings_ethernet.svg" class="me-2">FMU Setup</p><p class="fw-light fs-6">Please select the serial device and baud rate used for the input of serial telemetry into the Jetson module. Default baud rate is 500000.</p></div>
</div> </div>
<div class="row justify-content-start"> <div class="row justify-content-start">
<div class="col-2 ms-3"><label class="control-label" for="fmuDevice">Linux serial device</label></div> <div class="col-2 ms-3"><label class="control-label" for="fmuDevice">Linux serial device</label></div>
<div class="col"><select id="fmuDevice"></select></div> <div class="col"><select id="fmuDevice"></select></div>
@ -76,13 +85,6 @@
<div class="col mt-3"><input id="tcpPort"></div> <div class="col mt-3"><input id="tcpPort"></div>
</div> </div>
<div class="row justify-content-start">
<div class="col-2 ms-3 mt-3"><button class="btn-primary" id="save">Save/Update</button></div>
<div class="col mt-3"><span id="result"></span></div>
</div>
<pre id="output"></pre>
</section> </section>
</main> </main>
</div> </div>

View File

@ -158,7 +158,7 @@ function SuccessReadFile(content) {
var currentbaudRate = getValueByKey(content, "[UartEndpoint alpha]", 2, "Baud"); var currentbaudRate = getValueByKey(content, "[UartEndpoint alpha]", 2, "Baud");
cockpit.script(scriptLocation + "cockpitScript.sh -s") cockpit.script(scriptLocation + "cockpitScript.sh -s")
.then((content) => AddDropDown(fmuDevice, content.split("\n"), currentfmuDevice)) .then((content) => AddDropDown(fmuDevice, content.split("\n"), currentfmuDevice))
.catch(error => Fail(error)); .catch(error => Fail(error));
AddDropDown(baudrate, baudRateArray, currentbaudRate); AddDropDown(baudrate, baudRateArray, currentbaudRate);
//UDP Telemetry //UDP Telemetry
@ -239,6 +239,7 @@ function AddPathToDeviceFile(incomingArray) {
function AddDropDown(box, theArray, defaultValue) { function AddDropDown(box, theArray, defaultValue) {
try { try {
for(let t = 0; t < theArray.length; t++){ for(let t = 0; t < theArray.length; t++){
if (theArray[t] === "") continue;
var option = document.createElement("option"); var option = document.createElement("option");
option.text = theArray[t]; option.text = theArray[t];
box.add(option); box.add(option);