From bad27d3d15e01b61df612e297376d84bb2016f09 Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Mon, 10 Jan 2022 01:22:24 +0100 Subject: [PATCH] Make virtual mode an option using msp backup and restore --- locales/en/messages.json | 4 ++++ src/js/port_handler.js | 30 ++++++++++++++++-------- src/js/serial.js | 4 +--- src/js/tabs/options.js | 13 +++++++++++ src/js/tabs/setup.js | 50 ++++++++++++++++++++-------------------- src/tabs/options.html | 6 +++++ 6 files changed, 69 insertions(+), 38 deletions(-) diff --git a/locales/en/messages.json b/locales/en/messages.json index 5f263e09..faac0797 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -109,6 +109,10 @@ "message": "Show all serial devices (for manufacturers or development)", "description": "Do not filter serial devices using VID/PID values (for manufacturers or development)" }, + "showVirtualMode": { + "message": "Enable virtual connection mode", + "description": "Text for the option to enable or disable the virtual FC" + }, "cordovaForceComputerUI": { "message": "Use computers interface instead of phones interface" }, diff --git a/src/js/port_handler.js b/src/js/port_handler.js index 2b534420..ee01a1f5 100644 --- a/src/js/port_handler.js +++ b/src/js/port_handler.js @@ -13,6 +13,8 @@ const PortHandler = new function () { this.port_removed_callbacks = []; this.dfu_available = false; this.port_available = false; + this.showAllSerialDevices = false; + this.showVirtualMode = false; }; PortHandler.initialize = function () { @@ -31,6 +33,9 @@ PortHandler.initialize = function () { PortHandler.check = function () { const self = this; + ConfigStorage.get('showVirtualMode', res => self.showVirtualMode = res.showVirtualMode); + ConfigStorage.get('showAllSerialDevices', res => self.showAllSerialDevices = res.showAllSerialDevices); + self.check_usb_devices(); self.check_serial_devices(); @@ -79,17 +84,20 @@ PortHandler.check_usb_devices = function (callback) { data: {isDFU: true}, })); - self.portPickerElement.append($('