diff --git a/_locales/en/messages.json b/_locales/en/messages.json index cf5dca42f..7e4a89009 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1552,7 +1552,7 @@ "message": "Pitch trim for self-leveling flight modes. In degrees. +5 means airplane nose should be raised 5 deg from level" }, "pidTuning_ButtonSave": { - "message": "Save" + "message": "Save and Reboot" }, "pidTuning_ButtonRefresh": { "message": "Refresh" @@ -2220,7 +2220,7 @@ "message": "Blackbox configuration" }, "blackboxButtonSave": { - "message": "Save and reboot" + "message": "Save and Reboot" }, "serialLogging": { "message": "Outboard serial logging device" @@ -4452,7 +4452,7 @@ "message": "Confirm" }, "mixerButtonSaveAndReboot": { - "message": "Save and reboot" + "message": "Save and Reboot" }, "mixerApplyDescription": { "message": "This action overrides all current mixer settings and replaces them with default values. There is no 'Undo' option!" diff --git a/js/defaults_dialog.js b/js/defaults_dialog.js index 9f9641b11..532c4f6d7 100644 --- a/js/defaults_dialog.js +++ b/js/defaults_dialog.js @@ -57,14 +57,6 @@ helper.defaultsDialog = (function () { key: "dterm_lpf_type", value: "PT3" }, - { - key: "dterm_lpf2_hz", - value: 0 - }, - { - key: "dterm_lpf2_type", - value: "PT1" - }, { key: "dynamic_gyro_notch_enabled", value: "ON" @@ -270,14 +262,6 @@ helper.defaultsDialog = (function () { key: "dterm_lpf_type", value: "PT3" }, - { - key: "dterm_lpf2_hz", - value: 0 - }, - { - key: "dterm_lpf2_type", - value: "PT1" - }, { key: "dynamic_gyro_notch_enabled", value: "ON" @@ -461,14 +445,6 @@ helper.defaultsDialog = (function () { key: "dterm_lpf_type", value: "PT3" }, - { - key: "dterm_lpf2_hz", - value: 0 - }, - { - key: "dterm_lpf2_type", - value: "PT1" - }, { key: "dynamic_gyro_notch_enabled", value: "ON" @@ -1169,6 +1145,7 @@ helper.defaultsDialog = (function () { privateScope.setSettings = function (selectedDefaultPreset) { var currentControlProfile = parseInt($("#profilechange").val()); var currentBatteryProfile = parseInt($("#batteryprofilechange").val()); + //Save analytics googleAnalytics.sendEvent('Setting', 'Defaults', selectedDefaultPreset.title); Promise.mapSeries(selectedDefaultPreset.settings, function (input, ii) { @@ -1205,21 +1182,27 @@ helper.defaultsDialog = (function () { mspHelper.sendServoMixer(function () { mspHelper.sendMotorMixer(function () { MSP.send_message(MSPCodes.MSP_SELECT_SETTING, [currentControlProfile], false, function() { - MSP.send_message(MSPCodes.MSP2_INAV_SELECT_BATTERY_PROFILE, [currentBatteryProfile], false, privateScope.finalize(selectedDefaultPreset)); + MSP.send_message(MSPCodes.MSP2_INAV_SELECT_BATTERY_PROFILE, [currentBatteryProfile], false, function() { + privateScope.setOriginalProfile(selectedDefaultPreset, currentBatteryProfile, currentControlProfile) + }); }); }); }); }); } else { - MSP.send_message(MSPCodes.MSP_SELECT_SETTING, [currentControlProfile], false, function() { - MSP.send_message(MSPCodes.MSP2_INAV_SELECT_BATTERY_PROFILE, [currentBatteryProfile], false, privateScope.finalize(selectedDefaultPreset)); - }); + privateScope.setOriginalProfile(selectedDefaultPreset, currentBatteryProfile, currentControlProfile); } }) }); }; + privateScope.setOriginalProfile = function (selectedDefaultPreset, currentBatteryProfile, currentControlProfile) { + MSP.send_message(MSPCodes.MSP_SELECT_SETTING, [currentControlProfile], false, function() { + MSP.send_message(MSPCodes.MSP2_INAV_SELECT_BATTERY_PROFILE, [currentBatteryProfile], false, privateScope.finalize(selectedDefaultPreset)); + }); + }; + privateScope.setSettingForAllControlProfiles = function (key, value) { MSP.send_message(MSPCodes.MSP_SELECT_SETTING, [0], false, function () { mspHelper.setSetting(key, value, function() { diff --git a/js/fc.js b/js/fc.js index 42eabd1de..447eb114a 100644 --- a/js/fc.js +++ b/js/fc.js @@ -118,9 +118,9 @@ var FC = { i2cError: 0, activeSensors: 0, mode: [], - mixer_profile: 0, - profile: 0, - battery_profile: 0, + mixer_profile: -1, + profile: -1, + battery_profile: -1, uid: [0, 0, 0], accelerometerTrims: [0, 0], armingFlags: 0, @@ -1439,8 +1439,6 @@ var FC = { 'max_angle_inclination_pit', 'dterm_lpf_hz', 'dterm_lpf_type', - 'dterm_lpf2_hz', - 'dterm_lpf2_type', 'yaw_lpf_hz', 'fw_iterm_throw_limit', 'fw_reference_airspeed', diff --git a/js/gui.js b/js/gui.js index db2f9bd02..91856e75b 100644 --- a/js/gui.js +++ b/js/gui.js @@ -260,10 +260,16 @@ GUI_control.prototype.updateStatusBar = function() { $('span.arming-flags').text(activeArmFlags.length ? activeArmFlags.join(', ') : '-'); }; -GUI_control.prototype.updateProfileChange = function() { +GUI_control.prototype.updateProfileChange = function(refresh) { $('#mixerprofilechange').val(CONFIG.mixer_profile); $('#profilechange').val(CONFIG.profile); $('#batteryprofilechange').val(CONFIG.battery_profile); + if (refresh) { + GUI.log(chrome.i18n.getMessage('loadedMixerProfile', [CONFIG.mixer_profile + 1])); + GUI.log(chrome.i18n.getMessage('pidTuning_LoadedProfile', [CONFIG.profile + 1])); + GUI.log(chrome.i18n.getMessage('loadedBatteryProfile', [CONFIG.battery_profile + 1])); + updateActivatedTab(); + } }; GUI_control.prototype.fillSelect = function ($element, values, currentValue, unit) { diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index d440b29ff..f54f3ec37 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -68,6 +68,7 @@ var mspHelper = (function (gui) { color; if (!dataHandler.unsupported || dataHandler.unsupported) switch (dataHandler.code) { case MSPCodes.MSPV2_INAV_STATUS: + let profile_changed = false; CONFIG.cycleTime = data.getUint16(offset, true); offset += 2; CONFIG.i2cError = data.getUint16(offset, true); @@ -76,15 +77,28 @@ var mspHelper = (function (gui) { offset += 2; CONFIG.cpuload = data.getUint16(offset, true); offset += 2; + profile_byte = data.getUint8(offset++) - CONFIG.profile = profile_byte & 0x0F; - CONFIG.battery_profile = (profile_byte & 0xF0) >> 4; - profile_byte = data.getUint8(offset++) - CONFIG.mixer_profile = profile_byte & 0x0F; + let profile = profile_byte & 0x0F; + profile_changed |= (profile !== CONFIG.profile) && (CONFIG.profile !==-1); + CONFIG.profile = profile; + + let battery_profile = (profile_byte & 0xF0) >> 4; + profile_changed |= (battery_profile !== CONFIG.battery_profile) && (CONFIG.battery_profile !==-1); + CONFIG.battery_profile = battery_profile; + CONFIG.armingFlags = data.getUint32(offset, true); offset += 4; + + //As there are 8 bytes for mspBoxModeFlags (number of bytes is actually variable) + //read mixer profile as the last byte in the the message + profile_byte = data.getUint8(dataHandler.message_length_expected - 1); + let mixer_profile = profile_byte & 0x0F; + profile_changed |= (mixer_profile !== CONFIG.mixer_profile) && (CONFIG.mixer_profile !==-1); + CONFIG.mixer_profile = mixer_profile; + gui.updateStatusBar(); - gui.updateProfileChange(); + gui.updateProfileChange(profile_changed); break; case MSPCodes.MSP_ACTIVEBOXES: @@ -2910,7 +2924,7 @@ var mspHelper = (function (gui) { MSP.send_message(MSPCodes.MSP2_INAV_TIMER_OUTPUT_MODE, false, false, callback); } - self.sendTimerOutputModes = function(callback) { + self.sendTimerOutputModes = function(onCompleteCallback) { var nextFunction = send_next_output_mode; var idIndex = 0; @@ -2935,7 +2949,7 @@ var mspHelper = (function (gui) { // prepare for next iteration idIndex++; if (idIndex == overrideIds.length) { - nextFunction = callback; + nextFunction = onCompleteCallback; } MSP.send_message(MSPCodes.MSP2_INAV_SET_TIMER_OUTPUT_MODE, buffer, false, nextFunction); diff --git a/js/serial_backend.js b/js/serial_backend.js index ec813bf38..827169f63 100755 --- a/js/serial_backend.js +++ b/js/serial_backend.js @@ -257,6 +257,7 @@ function onValidFirmware() $('#tabs ul.mode-connected .tab_setup a').click(); + updateEzTuneTabVisibility(true); updateFirmwareVersion(); }); }); diff --git a/main.js b/main.js index f31976395..84ada3838 100644 --- a/main.js +++ b/main.js @@ -567,7 +567,6 @@ $(document).ready(function () { var profile = parseInt($(this).val()); MSP.send_message(MSPCodes.MSP_SELECT_SETTING, [profile], false, function () { GUI.log(chrome.i18n.getMessage('pidTuning_LoadedProfile', [profile + 1])); - updateActivatedTab(); }); }); @@ -577,7 +576,6 @@ $(document).ready(function () { var batteryprofile = parseInt($(this).val()); MSP.send_message(MSPCodes.MSP2_INAV_SELECT_BATTERY_PROFILE, [batteryprofile], false, function () { GUI.log(chrome.i18n.getMessage('loadedBatteryProfile', [batteryprofile + 1])); - updateActivatedTab(); }); }); }); @@ -717,3 +715,28 @@ function updateFirmwareVersion() { globalSettings.docsTreeLocation = 'https://github.com/iNavFlight/inav/blob/master/docs/'; } } + +function updateEzTuneTabVisibility(loadMixerConfig) { + let useEzTune = true; + if (CONFIGURATOR.connectionValid) { + if (loadMixerConfig) { + mspHelper.loadMixerConfig(function() { + if (MIXER_CONFIG.platformType == PLATFORM_MULTIROTOR || MIXER_CONFIG.platformType == PLATFORM_TRICOPTER) { + $('.tab_ez_tune').removeClass("is-hidden"); + } else { + $('.tab_ez_tune').addClass("is-hidden"); + useEzTune = false; + } + }); + } else { + if (MIXER_CONFIG.platformType == PLATFORM_MULTIROTOR || MIXER_CONFIG.platformType == PLATFORM_TRICOPTER) { + $('.tab_ez_tune').removeClass("is-hidden"); + } else { + $('.tab_ez_tune').addClass("is-hidden"); + useEzTune = false; + } + } + } + + return useEzTune; +} \ No newline at end of file diff --git a/resources/osd/analogue/bold.mcm b/resources/osd/analogue/bold.mcm index b8719dfc0..3d55ca5b2 100644 --- a/resources/osd/analogue/bold.mcm +++ b/resources/osd/analogue/bold.mcm @@ -16068,34 +16068,37 @@ MAX7456 01010101 01010101 01010101 -01010101 -01010101 -01010101 -01010101 +00010101 01010101 01010100 -01010101 +10000101 01010101 01010010 -00010101 +10100001 01010101 01001010 +10101000 +01010101 +01010000 +10000001 +01010101 +01010100 10000101 01010101 -00101010 -10100001 +01010000 +10000001 01010101 -01000010 -00000101 +01001010 +10101000 01010100 01010010 -00010101 +10100001 01010010 -00010010 -00010101 +00010100 +10000101 01010010 -10000100 -01010101 +10000101 +00010101 01001010 10000101 01000101 @@ -16130,9 +16133,6 @@ MAX7456 01010101 01010101 01010101 -01010101 -01010101 -01010101 01010100 00010000 00010101 diff --git a/resources/osd/analogue/bold.png b/resources/osd/analogue/bold.png index d41e8d697..b957c59ff 100644 Binary files a/resources/osd/analogue/bold.png and b/resources/osd/analogue/bold.png differ diff --git a/resources/osd/analogue/clarity.mcm b/resources/osd/analogue/clarity.mcm index 8633b470b..dbcbad60f 100644 --- a/resources/osd/analogue/clarity.mcm +++ b/resources/osd/analogue/clarity.mcm @@ -16068,34 +16068,37 @@ MAX7456 01010101 01010101 01010101 -01010101 -01010101 -01010101 -01010101 +00010101 01010101 01010100 -01010101 +10000101 01010101 01010010 -00010101 +10100001 01010101 01001010 +10101000 +01010101 +01010000 +10000001 +01010101 +01010100 10000101 01010101 -00101010 -10100001 +01010000 +10000001 01010101 -01000010 -00000101 +01001010 +10101000 01010100 01010010 -00010101 +10100001 01010010 -00010010 -00010101 +00010100 +10000101 01010010 -10000100 -01010101 +10000101 +00010101 01001010 10000101 01000101 @@ -16130,9 +16133,6 @@ MAX7456 01010101 01010101 01010101 -01010101 -01010101 -01010101 01010100 00010000 00010101 diff --git a/resources/osd/analogue/clarity.png b/resources/osd/analogue/clarity.png index 913eba099..14dd8a3f2 100644 Binary files a/resources/osd/analogue/clarity.png and b/resources/osd/analogue/clarity.png differ diff --git a/resources/osd/analogue/clarity_medium.mcm b/resources/osd/analogue/clarity_medium.mcm index f6f7ceb0b..cb8d171ae 100644 --- a/resources/osd/analogue/clarity_medium.mcm +++ b/resources/osd/analogue/clarity_medium.mcm @@ -16068,34 +16068,37 @@ MAX7456 01010101 01010101 01010101 -01010101 -01010101 -01010101 -01010101 +00010101 01010101 01010100 -01010101 +10000101 01010101 01010010 -00010101 +10100001 01010101 01001010 +10101000 +01010101 +01010000 +10000001 +01010101 +01010100 10000101 01010101 -00101010 -10100001 +01010000 +10000001 01010101 -01000010 -00000101 +01001010 +10101000 01010100 01010010 -00010101 +10100001 01010010 -00010010 -00010101 +00010100 +10000101 01010010 -10000100 -01010101 +10000101 +00010101 01001010 10000101 01000101 @@ -16130,9 +16133,6 @@ MAX7456 01010101 01010101 01010101 -01010101 -01010101 -01010101 01010100 00010000 00010101 diff --git a/resources/osd/analogue/clarity_medium.png b/resources/osd/analogue/clarity_medium.png index a31fa35c4..6ac6ad524 100644 Binary files a/resources/osd/analogue/clarity_medium.png and b/resources/osd/analogue/clarity_medium.png differ diff --git a/resources/osd/analogue/default.mcm b/resources/osd/analogue/default.mcm index 5c6082ac0..ced1110d5 100644 --- a/resources/osd/analogue/default.mcm +++ b/resources/osd/analogue/default.mcm @@ -16068,34 +16068,37 @@ MAX7456 01010101 01010101 01010101 -01010101 -01010101 -01010101 -01010101 +00010101 01010101 01010100 -01010101 +10000101 01010101 01010010 -00010101 +10100001 01010101 01001010 +10101000 +01010101 +01010000 +10000001 +01010101 +01010100 10000101 01010101 -00101010 -10100001 +01010000 +10000001 01010101 -01000010 -00000101 +01001010 +10101000 01010100 01010010 -00010101 +10100001 01010010 -00010010 -00010101 +00010100 +10000101 01010010 -10000100 -01010101 +10000101 +00010101 01001010 10000101 01000101 @@ -16130,9 +16133,6 @@ MAX7456 01010101 01010101 01010101 -01010101 -01010101 -01010101 01010100 00010000 00010101 diff --git a/resources/osd/analogue/default.png b/resources/osd/analogue/default.png index e10f12e45..99dfdfde9 100644 Binary files a/resources/osd/analogue/default.png and b/resources/osd/analogue/default.png differ diff --git a/resources/osd/analogue/default/251.png b/resources/osd/analogue/default/251.png index 9f6312855..7cc273f6f 100644 Binary files a/resources/osd/analogue/default/251.png and b/resources/osd/analogue/default/251.png differ diff --git a/resources/osd/analogue/impact.mcm b/resources/osd/analogue/impact.mcm index 2154f8861..756c46297 100644 --- a/resources/osd/analogue/impact.mcm +++ b/resources/osd/analogue/impact.mcm @@ -16068,34 +16068,37 @@ MAX7456 01010101 01010101 01010101 -01010101 -01010101 -01010101 -01010101 +00010101 01010101 01010100 -01010101 +10000101 01010101 01010010 -00010101 +10100001 01010101 01001010 +10101000 +01010101 +01010000 +10000001 +01010101 +01010100 10000101 01010101 -00101010 -10100001 +01010000 +10000001 01010101 -01000010 -00000101 +01001010 +10101000 01010100 01010010 -00010101 +10100001 01010010 -00010010 -00010101 +00010100 +10000101 01010010 -10000100 -01010101 +10000101 +00010101 01001010 10000101 01000101 @@ -16130,9 +16133,6 @@ MAX7456 01010101 01010101 01010101 -01010101 -01010101 -01010101 01010100 00010000 00010101 diff --git a/resources/osd/analogue/impact.png b/resources/osd/analogue/impact.png index 39627744f..2e18fd835 100644 Binary files a/resources/osd/analogue/impact.png and b/resources/osd/analogue/impact.png differ diff --git a/resources/osd/analogue/impact_mini.mcm b/resources/osd/analogue/impact_mini.mcm index 7a87d890e..14ed5030d 100644 --- a/resources/osd/analogue/impact_mini.mcm +++ b/resources/osd/analogue/impact_mini.mcm @@ -16068,34 +16068,37 @@ MAX7456 01010101 01010101 01010101 -01010101 -01010101 -01010101 -01010101 +00010101 01010101 01010100 -01010101 +10000101 01010101 01010010 -00010101 +10100001 01010101 01001010 +10101000 +01010101 +01010000 +10000001 +01010101 +01010100 10000101 01010101 -00101010 -10100001 +01010000 +10000001 01010101 -01000010 -00000101 +01001010 +10101000 01010100 01010010 -00010101 +10100001 01010010 -00010010 -00010101 +00010100 +10000101 01010010 -10000100 -01010101 +10000101 +00010101 01001010 10000101 01000101 @@ -16130,9 +16133,6 @@ MAX7456 01010101 01010101 01010101 -01010101 -01010101 -01010101 01010100 00010000 00010101 diff --git a/resources/osd/analogue/impact_mini.png b/resources/osd/analogue/impact_mini.png index 3b1bd1a17..7d9c70b88 100644 Binary files a/resources/osd/analogue/impact_mini.png and b/resources/osd/analogue/impact_mini.png differ diff --git a/resources/osd/analogue/large.mcm b/resources/osd/analogue/large.mcm index 7bb887d43..b47f17d54 100644 --- a/resources/osd/analogue/large.mcm +++ b/resources/osd/analogue/large.mcm @@ -16068,34 +16068,37 @@ MAX7456 01010101 01010101 01010101 -01010101 -01010101 -01010101 -01010101 +00010101 01010101 01010100 -01010101 +10000101 01010101 01010010 -00010101 +10100001 01010101 01001010 +10101000 +01010101 +01010000 +10000001 +01010101 +01010100 10000101 01010101 -00101010 -10100001 +01010000 +10000001 01010101 -01000010 -00000101 +01001010 +10101000 01010100 01010010 -00010101 +10100001 01010010 -00010010 -00010101 +00010100 +10000101 01010010 -10000100 -01010101 +10000101 +00010101 01001010 10000101 01000101 @@ -16130,9 +16133,6 @@ MAX7456 01010101 01010101 01010101 -01010101 -01010101 -01010101 01010100 00010000 00010101 diff --git a/resources/osd/analogue/large.png b/resources/osd/analogue/large.png index 1203865b2..f9d02636a 100644 Binary files a/resources/osd/analogue/large.png and b/resources/osd/analogue/large.png differ diff --git a/resources/osd/analogue/vision.mcm b/resources/osd/analogue/vision.mcm index 297baada4..bc25a5e6f 100644 --- a/resources/osd/analogue/vision.mcm +++ b/resources/osd/analogue/vision.mcm @@ -16068,34 +16068,37 @@ MAX7456 01010101 01010101 01010101 -01010101 -01010101 -01010101 -01010101 +00010101 01010101 01010100 -01010101 +10000101 01010101 01010010 -00010101 +10100001 01010101 01001010 +10101000 +01010101 +01010000 +10000001 +01010101 +01010100 10000101 01010101 -00101010 -10100001 +01010000 +10000001 01010101 -01000010 -00000101 +01001010 +10101000 01010100 01010010 -00010101 +10100001 01010010 -00010010 -00010101 +00010100 +10000101 01010010 -10000100 -01010101 +10000101 +00010101 01001010 10000101 01000101 @@ -16130,9 +16133,6 @@ MAX7456 01010101 01010101 01010101 -01010101 -01010101 -01010101 01010100 00010000 00010101 diff --git a/resources/osd/analogue/vision.png b/resources/osd/analogue/vision.png index aa6b73a66..464685d21 100644 Binary files a/resources/osd/analogue/vision.png and b/resources/osd/analogue/vision.png differ diff --git a/resources/sitl/linux/inav_SITL b/resources/sitl/linux/inav_SITL index 64f98d3c1..6256ad525 100755 Binary files a/resources/sitl/linux/inav_SITL and b/resources/sitl/linux/inav_SITL differ diff --git a/resources/sitl/windows/inav_SITL.exe b/resources/sitl/windows/inav_SITL.exe index 6f170a69d..3d080a6dc 100755 Binary files a/resources/sitl/windows/inav_SITL.exe and b/resources/sitl/windows/inav_SITL.exe differ diff --git a/tabs/mixer.js b/tabs/mixer.js index 8a997b593..0cc125d84 100644 --- a/tabs/mixer.js +++ b/tabs/mixer.js @@ -29,7 +29,8 @@ TABS.mixer.initialize = function (callback, scrollPosition) { mspHelper.loadMotorMixRules, mspHelper.loadOutputMappingExt, mspHelper.loadTimerOutputModes, - mspHelper.loadLogicConditions + mspHelper.loadLogicConditions, + mspHelper.loadEzTune, ]); loadChainer.setExitPoint(loadHtml); loadChainer.execute(); @@ -668,6 +669,11 @@ TABS.mixer.initialize = function (callback, scrollPosition) { $('#platform-type').parent('.select').addClass('no-bottom-border'); } + if (!updateEzTuneTabVisibility(false)) { + EZ_TUNE.enabled = 0; + mspHelper.saveEzTune(); + } + updateRefreshButtonStatus(); updateMotorDirection();