diff --git a/js/serial_backend.js b/js/serial_backend.js
index ee8530d5..0e325531 100755
--- a/js/serial_backend.js
+++ b/js/serial_backend.js
@@ -199,6 +199,10 @@ function onValidFirmware()
GUI.allowedTabs = GUI.defaultAllowedTabsWhenConnected.slice();
onConnect();
+ if (semver.gte(CONFIG.flightControllerVersion, "2.3.0")) {
+ helper.defaultsDialog.init();
+ }
+
$('#tabs ul.mode-connected .tab_setup a').click();
});
});
diff --git a/manifest.json b/manifest.json
index 538510b8..964be735 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"minimum_chrome_version": "38",
- "version": "2.3.0-RC3",
+ "version": "2.3.1",
"author": "Several",
"name": "INAV - Configurator",
"short_name": "INAV",
diff --git a/package-lock.json b/package-lock.json
index 8e35e544..dfea3c6a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3728,7 +3728,7 @@
"resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
"integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==",
"requires": {
- "is-plain-object": "^2.0.4"
+ "is-plain-object": "2.0.4"
}
}
}
@@ -5130,7 +5130,7 @@
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"requires": {
- "is-extendable": "^0.1.0"
+ "is-extendable": "0.1.1"
}
}
}
@@ -5950,7 +5950,7 @@
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"requires": {
- "is-extendable": "^0.1.0"
+ "is-extendable": "0.1.1"
}
},
"set-value": {
diff --git a/package.json b/package.json
index 9892aedf..81fa67f4 100755
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "inav-configurator",
"description": "INAV Configurator",
- "version": "2.3.0-RC3",
+ "version": "2.3.1",
"main": "main.html",
"default_locale": "en",
"scripts": {
diff --git a/tabs/cli.js b/tabs/cli.js
index b8552a06..1047e3d2 100644
--- a/tabs/cli.js
+++ b/tabs/cli.js
@@ -1,5 +1,5 @@
'use strict';
-/*global chrome*/
+/*global chrome,GUI,TABS,nwdialog,$*/
TABS.cli = {
lineDelayMs: 50,
profileSwitchDelayMs: 100,
@@ -96,13 +96,13 @@ function sendLinesWithDelay(outputArray) {
return (delay, line, index) => {
return new Promise((resolve) => {
helper.timeout.add('CLI_send_slowly', () => {
- var processingDelay = self.lineDelayMs;
+ let processingDelay = TABS.cli.lineDelayMs;
if (line.toLowerCase().startsWith('profile')) {
- processingDelay = self.profileSwitchDelayMs;
+ processingDelay = TABS.cli.profileSwitchDelayMs;
}
const isLastCommand = outputArray.length === index + 1;
- if (isLastCommand && self.cliBuffer) {
- line = getCliCommand(line, self.cliBuffer);
+ if (isLastCommand && TABS.cli.cliBuffer) {
+ line = getCliCommand(line, TABS.cli.cliBuffer);
}
TABS.cli.sendLine(line, () => {
resolve(processingDelay);
@@ -160,40 +160,22 @@ TABS.cli.initialize = function (callback) {
description: suffix.toUpperCase() + ' files', extensions: [suffix],
}];
- chrome.fileSystem.chooseEntry({type: 'saveFile', suggestedName: filename, accepts: accepts}, function(entry) {
- if (chrome.runtime.lastError) {
- if (chrome.runtime.lastError.message === 'User cancelled') {
- GUI.log(chrome.i18n.getMessage('cliSaveToFileAborted'));
- } else {
- GUI.log(chrome.i18n.getMessage('cliSaveToFileFailed'));
- console.error(chrome.runtime.lastError.message);
- }
- return;
- }
-
- if (!entry) {
+ nwdialog.setContext(document);
+ nwdialog.saveFileDialog(filename, accepts, '', function(result) {
+ if (!result) {
GUI.log(chrome.i18n.getMessage('cliSaveToFileAborted'));
return;
}
+ const fs = require('fs');
- entry.createWriter(function (writer) {
- writer.onerror = function (){
- GUI.log(chrome.i18n.getMessage('cliSaveToFileFailed'));
- };
-
- writer.onwriteend = function () {
- if (self.outputHistory.length > 0 && writer.length === 0) {
- writer.write(new Blob([self.outputHistory], {type: 'text/plain'}));
- } else {
- GUI.log(chrome.i18n.getMessage('cliSaveToFileCompleted'));
- }
- };
-
- writer.truncate(0);
- }, function (){
- GUI.log(chrome.i18n.getMessage('cliSaveToFileFailed'));
- console.error('Failed to get file writer');
+ fs.writeFile(result, self.outputHistory, (err) => {
+ if (err) {
+ GUI.log('Error writing file');
+ return console.error(err);
+ }
+ GUI.log('File saved');
});
+
});
});
@@ -211,22 +193,9 @@ TABS.cli.initialize = function (callback) {
}
$('.tab-cli .load').click(function() {
- var accepts = [
- {
- description: 'Config files', extensions: ["txt", "config"],
- },
- {
- description: 'All files',
- },
- ];
-
- chrome.fileSystem.chooseEntry({type: 'openFile', accepts: accepts}, function(entry) {
- if (chrome.runtime.lastError) {
- console.error(chrome.runtime.lastError.message);
- return;
- }
-
- if (!entry) {
+ nwdialog.setContext(document);
+ nwdialog.openFileDialog(".txt", false, '', function(result) {
+ if (!result) {
console.log('No file selected');
return;
}
@@ -257,12 +226,15 @@ TABS.cli.initialize = function (callback) {
self.GUI.snippetPreviewWindow.open();
}
- entry.file((file) => {
- let reader = new FileReader();
- reader.onload =
- () => previewCommands(reader.result);
- reader.onerror = () => console.error(reader.error);
- reader.readAsText(file);
+ const fs = require('fs');
+
+ fs.readFile(result, (err, data) => {
+ if (err) {
+ GUI.log('Error reading file');
+ return console.error(err);
+ }
+
+ previewCommands(data);
});
});
});
diff --git a/tabs/mission_control.js b/tabs/mission_control.js
index 207fd0d5..f61aaf79 100644
--- a/tabs/mission_control.js
+++ b/tabs/mission_control.js
@@ -354,7 +354,9 @@ TABS.mission_control.initialize = function (callback) {
}
});
//reset text position
- textGeom.setCoordinates(map.getCoordinateFromPixel([0,0]));
+ if (textGeom) {
+ textGeom.setCoordinates(map.getCoordinateFromPixel([0,0]));
+ }
}
function paintLine(pos1, pos2) {