1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-18 13:55:14 +03:00

Add option for manufacturers and developers

This commit is contained in:
Mark Haslinghuis 2021-12-03 22:12:58 +01:00
parent 3562ed9d3a
commit 706a239044
No known key found for this signature in database
GPG key ID: 198B0F616296A584
4 changed files with 28 additions and 3 deletions

View file

@ -105,6 +105,10 @@
"message": "Set connection timeout to allow longer initialisation on device plugin or reboot",
"description": "Change timeout on auto-connect and reboot so the bus has more time to initialize after being detected by the system"
},
"showAllSerialDevices": {
"message": "Show all serial devices (for manufacturers or development)",
"description": "Do not filter serial devices using VID/PID values (for manufacturers or development)"
},
"cordovaForceComputerUI": {
"message": "Use computers interface instead of phones interface"
},

View file

@ -270,10 +270,13 @@ const serial = {
chrome.serial.getDevices(function (devices_array) {
const devices = [];
devices_array.forEach(function (device) {
const isFC = self.serialDevices.some(el => el.vendorId === device.vendorId) && self.serialDevices.some(el => el.productId === device.productId);
let showAllSerialDevices = false;
if (isFC) {
devices_array.forEach(function (device) {
ConfigStorage.get('showAllSerialDevices', res => showAllSerialDevices = res.showAllSerialDevices);
const isKnownSerialDevice = self.serialDevices.some(el => el.vendorId === device.vendorId) && self.serialDevices.some(el => el.productId === device.productId);
if (isKnownSerialDevice || showAllSerialDevices) {
devices.push({
path: device.path,
displayName: device.displayName,

View file

@ -15,6 +15,7 @@ options.initialize = function (callback) {
TABS.options.initAnalyticsOptOut();
TABS.options.initCliAutoComplete();
TABS.options.initAutoConnectConnectionTimeout();
TABS.options.initShowAllSerialDevices();
TABS.options.initCordovaForceComputerUI();
TABS.options.initDarkTheme();
@ -133,6 +134,17 @@ options.initAutoConnectConnectionTimeout = function () {
});
};
options.initShowAllSerialDevices = function() {
const showAllSerialDevicesElement = $('div.showAllSerialDevices input');
ConfigStorage.get('showAllSerialDevices', result => {
showAllSerialDevicesElement
.prop('checked', !!result.showAllSerialDevices)
.on('change', () => ConfigStorage.set({ showAllSerialDevices: showAllSerialDevicesElement.is(':checked') }))
.trigger('change');
});
};
options.initCordovaForceComputerUI = function () {
if (GUI.isCordova() && cordovaUI.canChangeUI) {
ConfigStorage.get('cordovaForceComputerUI', function (result) {

View file

@ -46,6 +46,12 @@
</select>
<span i18n="connectionTimeout"></span>
</div>
<div class="showAllSerialDevices margin-bottom">
<div>
<input type="checkbox" class="toggle" />
</div>
<span class="freelabel" i18n="showAllSerialDevices"></span>
</div>
<div class="cordovaForceComputerUI margin-bottom">
<div>
<input type="checkbox" class="toggle" />