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

Migrate chrome storage API to window.localStorage

Add remove function

Remove callback from set and remove

Rebased

Rebased
This commit is contained in:
Mark Haslinghuis 2021-10-18 01:45:30 +02:00
parent c86348b4db
commit f41e135333
17 changed files with 597 additions and 636 deletions

View file

@ -32,9 +32,12 @@ PortHandler.initialize = function () {
PortHandler.check = function () {
const self = this;
let result;
ConfigStorage.get('showVirtualMode', res => self.showVirtualMode = res.showVirtualMode);
ConfigStorage.get('showAllSerialDevices', res => self.showAllSerialDevices = res.showAllSerialDevices);
result = ConfigStorage.get('showVirtualMode');
self.showVirtualMode = result.showVirtualMode;
result = ConfigStorage.get('showAllSerialDevices');
self.showAllSerialDevices = result.showAllSerialDevices;
self.check_usb_devices();
self.check_serial_devices();
@ -168,17 +171,16 @@ PortHandler.detectPort = function(currentPorts) {
currentPorts = self.updatePortSelect(currentPorts);
console.log(`PortHandler - Found: ${JSON.stringify(newPorts)}`);
ConfigStorage.get('last_used_port', function (result) {
if (result.last_used_port) {
if (result.last_used_port.includes('tcp')) {
self.portPickerElement.val('manual');
} else if (newPorts.length === 1) {
self.portPickerElement.val(newPorts[0].path);
} else if (newPorts.length > 1) {
self.selectPort(currentPorts);
}
const result = ConfigStorage.get('last_used_port');
if (result.last_used_port) {
if (result.last_used_port.includes('tcp')) {
self.portPickerElement.val('manual');
} else if (newPorts.length === 1) {
self.portPickerElement.val(newPorts[0].path);
} else if (newPorts.length > 1) {
self.selectPort(currentPorts);
}
});
}
self.port_available = true;
// Signal board verification