From 8211399c19e7868fc81af1e0b1d0ade66f28a02c Mon Sep 17 00:00:00 2001 From: Youssof Date: Thu, 24 Oct 2024 17:11:50 +0000 Subject: [PATCH] Populate serial device dropdown with ports having FCU symlinks --- cockpitScript.sh | 3 ++- ui/general/mavlink.html | 16 +++++++++------- ui/general/mavlink.js | 3 ++- 3 files changed, 13 insertions(+), 9 deletions(-) mode change 100644 => 100755 cockpitScript.sh diff --git a/cockpitScript.sh b/cockpitScript.sh old mode 100644 new mode 100755 index 45d0343..2a390cf --- a/cockpitScript.sh +++ b/cockpitScript.sh @@ -25,7 +25,8 @@ while [[ $# -gt 0 ]]; do exit 0 ;; -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 ;; -i) diff --git a/ui/general/mavlink.html b/ui/general/mavlink.html index 3ca372f..b638501 100644 --- a/ui/general/mavlink.html +++ b/ui/general/mavlink.html @@ -17,9 +17,18 @@

MAVLink Telemetry Configuration

Software Version: , Configuration File:

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.

+ + +
+
+
+
+

+
                 

FMU Setup

Please select the serial device and baud rate used for the input of serial telemetry into the Jetson module. Default baud rate is 500000.

+
@@ -76,13 +85,6 @@
-
-
-
-
- - -

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