diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 0513db59..7e5eb163 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2492,7 +2492,10 @@ "message": "Wireless mode" }, "rthConfiguration": { - "message": "RTH and Landing Settings" + "message": "RTH settings" + }, + "autoLandingSettings": { + "message": "Automatic landing settings" }, "minRthDistance": { "message": "Min. RTH distance [cm]" @@ -2542,17 +2545,26 @@ "rthHomeAltitudeHelp": { "message": "Used when not landing at the home point. Upon arriving at home, the plane will loiter and change altitude to the RTH Home Altitude. Default is 0, which is feature disabled." }, - "landMinAltVspd": { - "message": "Vertical descent velocity under min. vertical landing speed altitude [cm/s]" - }, "landMaxAltVspd": { - "message": "Vertical descent velocity above slowdown altitude [cm/s]" + "message": "Initial landing speed until Slow down altitude is reached" }, - "landSlowdownMinAlt": { - "message": "Min. vertical landing speed at altitude [cm]" + "landMaxAltVspdHelp": { + "message": "After RTH if autolanding is enabled the aircraft will start to descend at this speed until reaching Slow down altitude" }, "landSlowdownMaxAlt": { - "message": "Vertical landing speed slowdown at altitude [cm]" + "message": "Slow down altitude. Altitude bellow which the aircraft will start to slow down" + }, + "landSlowdownMaxAltHelp": { + "message": "When the aircraft reaches this altitude it will start to slow down linearly between the Initial landing speed and Final landing speed to reach it at Final approach altitude" + }, + "landMinAltVspd": { + "message": "Final landing speed. Speed the aircraft will take until touchdown when the Final approach altitutde is reached" + }, + "landMinAltVspdHelp": { + "message": "The aircraft vertical speed target will be this value when the aircraft reaches the Final approach altitude after having slowed down linearly from the Slow down altitude at Initial landing speed" + }, + "landSlowdownMinAlt": { + "message": "Final approach altitude. Altitude under which the aircraft will go down at Final landing speed until touchdown" }, "emergencyDescentRate": { "message": "Emergency landing speed [cm/s]" @@ -3532,16 +3544,16 @@ "itermRelaxCutoffHelp": { "message": "Lower values open a longer time window for Iterm Relax to work on and stronger Iterm suppression. Higher values shortens the time windows and reduces suppression." }, - "gyro_lpf_type": { + "gyro_main_lpf_hz": { + "message": "Main gyro filter cutoff frequency" + }, + "gyro_main_lpf_hz_help": { + "message": "Higher values offer lower delay but more noise. Lower values offer less noise, but more dalay on the gyro processing" + }, + "gyro_main_lpf_type": { "message": "Gyro LPF type" }, - "gyro_lpf_type_help": { - "message": "BIQUAD offers better noise attenuation for a price of higher delay. PT1 has lower attenuation but offers lower delay." - }, - "gyro_stage2_lowpass_type": { - "message": "Gyro Stage 2 LPF type" - }, - "gyro_stage2_lowpass_type_help": { + "gyro_main_lpf_type_help": { "message": "BIQUAD offers better noise attenuation for a price of higher delay. PT1 has lower attenuation but offers lower delay." }, "dterm_lpf_type": { diff --git a/js/defaults_dialog.js b/js/defaults_dialog.js index 2917dc11..7a817dc5 100644 --- a/js/defaults_dialog.js +++ b/js/defaults_dialog.js @@ -34,17 +34,13 @@ helper.defaultsDialog = (function() { Filtering */ { - key: "gyro_lpf_hz", + key: "gyro_main_lpf_hz", value: 110 }, { - key: "gyro_lpf_type", + key: "gyro_main_lpf_type", value: "PT1" }, - { - key: "gyro_stage2_lowpass_hz", - value: 0 - }, { key: "dterm_lpf_hz", value: 110 @@ -202,15 +198,15 @@ helper.defaultsDialog = (function() { value: "256HZ" }, { - key: "gyro_lpf_hz", + key: "gyro_main_lpf_hz", value: 25 }, - { + { key: "dterm_lpf_hz", value: 40 }, { - key: "gyro_lpf_type", + key: "gyro_main_lpf_type", value: "BIQUAD" }, { @@ -372,15 +368,15 @@ helper.defaultsDialog = (function() { value: "256HZ" }, { - key: "gyro_lpf_hz", + key: "gyro_main_lpf_hz", value: 25 }, - { + { key: "dterm_lpf_hz", value: 40 }, { - key: "gyro_lpf_type", + key: "gyro_main_lpf_type", value: "BIQUAD" }, { @@ -533,11 +529,11 @@ helper.defaultsDialog = (function() { value: "256HZ" }, { - key: "gyro_lpf_hz", + key: "gyro_main_lpf_hz", value: 10 }, { - key: "gyro_lpf_type", + key: "gyro_main_lpf_type", value: "BIQUAD" }, { diff --git a/js/gui.js b/js/gui.js index 67cb8ebe..46fe85db 100644 --- a/js/gui.js +++ b/js/gui.js @@ -166,7 +166,7 @@ GUI_control.prototype.content_ready = function (callback) { }); // Insert a documentation button next to the tab title - const tabTitle = $('div#content .tab_title'); + const tabTitle = $('div#content .tab_title').first(); const documentationDiv = $('
').addClass('cf_doc_version_bt'); $('').attr('href', 'https://github.com/iNavFlight/inav/wiki') .attr('target', '_blank').attr('id', 'button-documentation') diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index fba34acf..8f78e36f 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -2472,7 +2472,7 @@ var mspHelper = (function (gui) { }; /** - * Send a request to read a block of data from the dataflash at the given address and pass that address and a dataview + * Send a request to read a block of data from the dataflash at the given address and pass that address and a ArrayBuffer * of the returned data to the given callback (or null for the data if an error occured). */ self.dataflashRead = function (address, onDataCallback) { @@ -2496,7 +2496,7 @@ var mspHelper = (function (gui) { /* Strip that address off the front of the reply and deliver it separately so the caller doesn't have to * figure out the reply format: */ - onDataCallback(address, new DataView(response.data.buffer, response.data.byteOffset + 4, response.data.buffer.byteLength - 4)); + onDataCallback(address, response.data.buffer.slice(4)); } else { // Report error onDataCallback(address, null); diff --git a/js/preset_definitions.js b/js/preset_definitions.js index a245eed2..9aa4ca6b 100644 --- a/js/preset_definitions.js +++ b/js/preset_definitions.js @@ -66,19 +66,11 @@ presets.presets = [ value: 250 }, { - key: "gyro_lpf_hz", + key: "gyro_main_lpf_hz", value: 130 }, { - key: "gyro_lpf_type", - value: "PT1" - }, - { - key: "gyro_stage2_lowpass_hz", - value: 150 - }, - { - key: "gyro_stage2_lowpass_type", + key: "gyro_main_lpf_type", value: "PT1" }, { @@ -224,19 +216,11 @@ presets.presets = [ value: 500 }, { - key: "gyro_lpf_hz", + key: "gyro_main_lpf_hz", value: 110 }, { - key: "gyro_lpf_type", - value: "PT1" - }, - { - key: "gyro_stage2_lowpass_hz", - value: 250 - }, - { - key: "gyro_stage2_lowpass_type", + key: "gyro_main_lpf_type", value: "PT1" }, { @@ -374,19 +358,11 @@ presets.presets = [ value: 500 }, { - key: "gyro_lpf_hz", + key: "gyro_main_lpf_hz", value: 100 }, { - key: "gyro_lpf_type", - value: "PT1" - }, - { - key: "gyro_stage2_lowpass_hz", - value: 160 - }, - { - key: "gyro_stage2_lowpass_type", + key: "gyro_main_lpf_type", value: "PT1" }, { @@ -537,19 +513,11 @@ presets.presets = [ value: 500 }, { - key: "gyro_lpf_hz", + key: "gyro_main_lpf_hz", value: 60 }, { - key: "gyro_lpf_type", - value: "PT1" - }, - { - key: "gyro_stage2_lowpass_hz", - value: 120 - }, - { - key: "gyro_stage2_lowpass_type", + key: "gyro_main_lpf_type", value: "PT1" }, { @@ -699,19 +667,11 @@ presets.presets = [ value: 250 }, { - key: "gyro_lpf_hz", + key: "gyro_main_lpf_hz", value: 130 }, { - key: "gyro_lpf_type", - value: "PT1" - }, - { - key: "gyro_stage2_lowpass_hz", - value: 180 - }, - { - key: "gyro_stage2_lowpass_type", + key: "gyro_main_lpf_type", value: "PT1" }, { @@ -865,19 +825,11 @@ presets.presets = [ value: 250 }, { - key: "gyro_lpf_hz", + key: "gyro_main_lpf_hz", value: 115 }, { - key: "gyro_lpf_type", - value: "PT1" - }, - { - key: "gyro_stage2_lowpass_hz", - value: 0 - }, - { - key: "gyro_stage2_lowpass_type", + key: "gyro_main_lpf_type", value: "PT1" }, { @@ -1023,19 +975,11 @@ presets.presets = [ value: 500 }, { - key: "gyro_lpf_hz", + key: "gyro_main_lpf_hz", value: 100 }, { - key: "gyro_lpf_type", - value: "PT1" - }, - { - key: "gyro_stage2_lowpass_hz", - value: 250 - }, - { - key: "gyro_stage2_lowpass_type", + key: "gyro_main_lpf_type", value: "PT1" }, { @@ -1178,7 +1122,7 @@ presets.presets = [ value: "256HZ" }, { - key: "gyro_lpf_hz", + key: "gyro_main_lpf_hz", value: 25 }, { @@ -1186,7 +1130,7 @@ presets.presets = [ value: 40 }, { - key: "gyro_lpf_type", + key: "gyro_main_lpf_type", value: "BIQUAD" }, { @@ -1344,7 +1288,7 @@ presets.presets = [ value: "256HZ" }, { - key: "gyro_lpf_hz", + key: "gyro_main_lpf_hz", value: 25 }, { @@ -1352,7 +1296,7 @@ presets.presets = [ value: 40 }, { - key: "gyro_lpf_type", + key: "gyro_main_lpf_type", value: "BIQUAD" }, { diff --git a/tabs/advanced_tuning.html b/tabs/advanced_tuning.html index 2dca16a9..f24e55ed 100644 --- a/tabs/advanced_tuning.html +++ b/tabs/advanced_tuning.html @@ -114,7 +114,7 @@
- +
@@ -147,25 +147,25 @@
- +
- +
- +
- +
@@ -177,24 +177,24 @@
- +
- +
- +
- +
@@ -251,55 +251,55 @@
- +
- +
- +
- +
- +
- +
- +
- +
- +
@@ -317,30 +317,30 @@
- +
- +
- +
- +
- +
@@ -351,56 +351,32 @@
- +
- +
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- +
- +
- -
- - -
+
- +
@@ -429,19 +405,55 @@
- +
- +
- + +
+ + +
+
+
+
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+ + +
+ +
+ + +
diff --git a/tabs/firmware_flasher.js b/tabs/firmware_flasher.js index e9f37859..7776439c 100755 --- a/tabs/firmware_flasher.js +++ b/tabs/firmware_flasher.js @@ -1,3 +1,4 @@ +/*global $,nwdialog*/ 'use strict'; TABS.firmware_flasher = {}; @@ -184,57 +185,41 @@ TABS.firmware_flasher.initialize = function (callback) { $('select[name="release"]').empty().append(''); }); - // UI Hooks - $('a.load_file').click(function () { - chrome.fileSystem.chooseEntry({type: 'openFile', accepts: [{extensions: ['hex']}]}, function (fileEntry) { - if (chrome.runtime.lastError) { - console.error(chrome.runtime.lastError.message); + $('a.load_file').on('click', function () { - return; - } - - // hide github info (if it exists) + nwdialog.setContext(document); + nwdialog.openFileDialog('.hex', function(filename) { + const fs = require('fs'); + $('div.git_info').slideUp(); - chrome.fileSystem.getDisplayPath(fileEntry, function (path) { - console.log('Loading file from: ' + path); + console.log('Loading file from: ' + filename); - fileEntry.file(function (file) { - var reader = new FileReader(); + fs.readFile(filename, (err, data) => { - reader.onprogress = function (e) { - if (e.total > 104857600) { // 100 MB - // dont allow reading files bigger then 100 MB - console.log('File limit (100 MB) exceeded, aborting'); - reader.abort(); - } - }; + if (err) { + console.log("Error loading local file", err); + return; + } - reader.onloadend = function(e) { - if (e.total != 0 && e.total == e.loaded) { - console.log('File loaded'); + console.log('File loaded'); - intel_hex = e.target.result; + parse_hex(data.toString(), function (data) { + parsed_hex = data; - parse_hex(intel_hex, function (data) { - parsed_hex = data; + if (parsed_hex) { + googleAnalytics.sendEvent('Flashing', 'Firmware', 'local'); + $('a.flash_firmware').removeClass('disabled'); - if (parsed_hex) { - googleAnalytics.sendEvent('Flashing', 'Firmware', 'local'); - $('a.flash_firmware').removeClass('disabled'); - - $('span.progressLabel').text('Loaded Local Firmware: (' + parsed_hex.bytes_total + ' bytes)'); - } else { - $('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherHexCorrupted')); - } - }); - } - }; - - reader.readAsText(file); + $('span.progressLabel').text('Loaded Local Firmware: (' + parsed_hex.bytes_total + ' bytes)'); + } else { + $('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherHexCorrupted')); + } }); }); + }); + }); /** diff --git a/tabs/onboard_logging.js b/tabs/onboard_logging.js index 7bea6b04..454f900b 100644 --- a/tabs/onboard_logging.js +++ b/tabs/onboard_logging.js @@ -1,4 +1,4 @@ -/*global MSP,MSPCodes,BF_CONFIG,TABS,GUI,CONFIGURATOR,helper,mspHelper*/ +/*global $,MSP,MSPCodes,BF_CONFIG,TABS,GUI,CONFIGURATOR,helper,mspHelper,nwdialog,SDCARD,chrome*/ 'use strict'; var @@ -304,39 +304,34 @@ TABS.onboard_logging.initialize = function (callback) { if (GUI.connected_to) { // Begin by refreshing the occupied size in case it changed while the tab was open flash_update_summary(function() { - var - maxBytes = DATAFLASH.usedSize; + const maxBytes = DATAFLASH.usedSize; - prepare_file(function(fileWriter) { - var - nextAddress = 0; + prepare_file(function(filename) { + const fs = require('fs'); + let nextAddress = 0; show_saving_dialog(); - function onChunkRead(chunkAddress, chunkDataView) { - if (chunkDataView != null) { + function onChunkRead(chunkAddress, chunk) { + if (chunk != null) { // Did we receive any data? - if (chunkDataView.byteLength > 0) { - nextAddress += chunkDataView.byteLength; + if (chunk.byteLength > 0) { + nextAddress += chunk.byteLength; $(".dataflash-saving progress").attr("value", nextAddress / maxBytes * 100); - var - blob = new Blob([chunkDataView]); + fs.writeFileSync(filename, new Uint8Array(chunk), { + "flag": "a" + }) - fileWriter.onwriteend = function(e) { - if (saveCancelled || nextAddress >= maxBytes) { - if (saveCancelled) { - dismiss_saving_dialog(); - } else { - mark_saving_dialog_done(); - } - } else { - mspHelper.dataflashRead(nextAddress, onChunkRead); - } - }; + if (saveCancelled) { + dismiss_saving_dialog(); + } else if (nextAddress >= maxBytes) { + mark_saving_dialog_done(); + }else { + mspHelper.dataflashRead(nextAddress, onChunkRead); + } - fileWriter.write(blob); } else { // A zero-byte block indicates end-of-file, so we're done mark_saving_dialog_done(); @@ -355,50 +350,23 @@ TABS.onboard_logging.initialize = function (callback) { } function prepare_file(onComplete) { - var - date = new Date(), - filename = 'blackbox_log_' + date.getFullYear() + '-' + zeroPad(date.getMonth() + 1, 2) + '-' + const date = new Date(); + const filename = 'blackbox_log_' + date.getFullYear() + '-' + zeroPad(date.getMonth() + 1, 2) + '-' + zeroPad(date.getDate(), 2) + '_' + zeroPad(date.getHours(), 2) + zeroPad(date.getMinutes(), 2) + zeroPad(date.getSeconds(), 2); + const accepts = [{ + description: 'TXT files', extensions: ['txt'], + }]; - chrome.fileSystem.chooseEntry({type: 'saveFile', suggestedName: filename, - accepts: [{extensions: ['TXT']}]}, function(fileEntry) { - var error = chrome.runtime.lastError; - - if (error) { - console.error(error.message); - - if (error.message != "User cancelled") { - GUI.log(chrome.i18n.getMessage('dataflashFileWriteFailed')); - } - return; - } - - // echo/console log path specified - chrome.fileSystem.getDisplayPath(fileEntry, function(path) { - console.log('Dataflash dump file path: ' + path); - }); - - fileEntry.createWriter(function (fileWriter) { - fileWriter.onerror = function (e) { - console.error(e); - - // stop logging if the procedure was/is still running - }; - - onComplete(fileWriter); - }, function (e) { - // File is not readable or does not exist! - console.error(e); - GUI.log(chrome.i18n.getMessage('dataflashFileWriteFailed')); - }); + nwdialog.setContext(document); + nwdialog.saveFileDialog(filename, accepts, '', function(file) { + onComplete(file); }); } function ask_to_erase_flash() { eraseCancelled = false; $(".dataflash-confirm-erase").removeClass('erasing'); - $(".dataflash-confirm-erase")[0].showModal(); } diff --git a/tabs/osd.js b/tabs/osd.js index 27fd3367..60fc45b7 100644 --- a/tabs/osd.js +++ b/tabs/osd.js @@ -1,4 +1,4 @@ -/*global $*/ +/*global $,nwdialog*/ 'use strict'; var SYM = SYM || {}; @@ -194,31 +194,13 @@ FONT.parseMCMFontFile = function (data) { //noinspection JSUnusedLocalSymbols FONT.openFontFile = function ($preview) { return new Promise(function (resolve) { - //noinspection JSUnresolvedVariable - chrome.fileSystem.chooseEntry({type: 'openFile', accepts: [ - {extensions: ['mcm']} - ]}, function (fileEntry) { - FONT.data.loaded_font_file = fileEntry.name; - //noinspection JSUnresolvedVariable - if (chrome.runtime.lastError) { - //noinspection JSUnresolvedVariable - console.error(chrome.runtime.lastError.message); - return; - } - fileEntry.file(function (file) { - var reader = new FileReader(); - reader.onloadend = function (e) { - //noinspection JSUnresolvedVariable - if (e.total != 0 && e.total == e.loaded) { - FONT.parseMCMFontFile(e.target.result); - resolve(); - } - else { - console.error('could not load whole font file'); - } - }; - reader.readAsText(file); - }); + + nwdialog.setContext(document); + nwdialog.openFileDialog('.mcm', function(filename) { + const fs = require('fs'); + const fontData = fs.readFileSync(filename, {flag: "r"}); + FONT.parseMCMFontFile(fontData.toString()); + resolve(); }); }); }; diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html index 39873779..4066693a 100755 --- a/tabs/pid_tuning.html +++ b/tabs/pid_tuning.html @@ -263,6 +263,13 @@
+ + + + - - - - - - - - - - - - - - - -
+ +
+
Gyro Dynamic Notch Filter @@ -324,37 +331,6 @@
-
- Hz -
-
-
- Hz -
-
@@ -365,28 +341,13 @@
- - - - - - - -
-
- Hz +
-
diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index bdceb7cb..ef1f32b2 100755 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -162,33 +162,21 @@ TABS.pid_tuning.initialize = function (callback) { pid_and_rc_to_form(); var $magHoldYawRate = $("#magHoldYawRate"), - $gyroSoftLpfHz = $('#gyroSoftLpfHz'), $accSoftLpfHz = $('#accSoftLpfHz'), - $dtermLpfHz = $('#dtermLpfHz'), $yawLpfHz = $('#yawLpfHz'); $magHoldYawRate.val(INAV_PID_CONFIG.magHoldRateLimit); - $gyroSoftLpfHz.val(FILTER_CONFIG.gyroSoftLpfHz); $accSoftLpfHz.val(INAV_PID_CONFIG.accSoftLpfHz); - $dtermLpfHz.val(FILTER_CONFIG.dtermLpfHz); $yawLpfHz.val(FILTER_CONFIG.yawLpfHz); $magHoldYawRate.change(function () { INAV_PID_CONFIG.magHoldRateLimit = parseInt($magHoldYawRate.val(), 10); }); - $gyroSoftLpfHz.change(function () { - FILTER_CONFIG.gyroSoftLpfHz = parseInt($gyroSoftLpfHz.val(), 10); - }); - $accSoftLpfHz.change(function () { INAV_PID_CONFIG.accSoftLpfHz = parseInt($accSoftLpfHz.val(), 10); }); - $dtermLpfHz.change(function () { - FILTER_CONFIG.dtermLpfHz = parseInt($dtermLpfHz.val(), 10); - }); - $yawLpfHz.change(function () { FILTER_CONFIG.yawLpfHz = parseInt($yawLpfHz.val(), 10); });