1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-17 05:15:20 +03:00

Filter out serial ports identified by HEX address only

This commit is contained in:
Pawel Spychalski (DzikuVx) 2023-12-25 13:32:59 +01:00
parent c699dc6318
commit beb0ba8a28
3 changed files with 22 additions and 10 deletions

View file

@ -22,7 +22,16 @@ PortHandler.initialize = function () {
PortHandler.check = function () {
var self = this;
ConnectionSerial.getDevices(function(current_ports) {
ConnectionSerial.getDevices(function(all_ports) {
// filter out ports that are not serial
let current_ports = [];
for (var i = 0; i < all_ports.length; i++) {
if (all_ports[i].indexOf(':') === -1) {
current_ports.push(all_ports[i]);
}
}
// port got removed or initial_ports wasn't initialized yet
if (self.array_difference(self.initial_ports, current_ports).length > 0 || !self.initial_ports) {
var removed_ports = self.array_difference(self.initial_ports, current_ports);