From cc31ceb89639f4a5fdb005d183bd944c2846ca96 Mon Sep 17 00:00:00 2001 From: mikeller Date: Tue, 12 Feb 2019 22:59:22 +1300 Subject: [PATCH 1/2] Removed support for 32 kHz gyro mode. --- src/js/msp/MSPHelper.js | 22 ++++++++++++++++++---- src/js/tabs/configuration.js | 6 +++--- src/js/tabs/onboard_logging.js | 2 +- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/js/msp/MSPHelper.js b/src/js/msp/MSPHelper.js index fc64bb49..e66f2fd8 100644 --- a/src/js/msp/MSPHelper.js +++ b/src/js/msp/MSPHelper.js @@ -919,7 +919,10 @@ MspHelper.prototype.process_data = function(dataHandler) { PID_ADVANCED_CONFIG.digitalIdlePercent = data.readU16() / 100; if (semver.gte(CONFIG.apiVersion, "1.25.0")) { - PID_ADVANCED_CONFIG.gyroUse32kHz = data.readU8(); + let gyroUse32kHz = data.readU8(); + if (semver.lt(CONFIG.apiVersion, "1.41.0")) { + PID_ADVANCED_CONFIG.gyroUse32kHz = gyroUse32kHz; + } } } break; @@ -941,12 +944,15 @@ MspHelper.prototype.process_data = function(dataHandler) { } if (semver.gte(CONFIG.apiVersion, "1.39.0")) { FILTER_CONFIG.gyro_hardware_lpf = data.readU8(); - FILTER_CONFIG.gyro_32khz_hardware_lpf = data.readU8(); + let gyro_32khz_hardware_lpf = data.readU8(); FILTER_CONFIG.gyro_lowpass_hz = data.readU16(); FILTER_CONFIG.gyro_lowpass2_hz = data.readU16(); FILTER_CONFIG.gyro_lowpass_type = data.readU8(); FILTER_CONFIG.gyro_lowpass2_type = data.readU8(); FILTER_CONFIG.dterm_lowpass2_hz = data.readU16(); + if (semver.lt(CONFIG.apiVersion, "1.41.0")) { + FILTER_CONFIG.gyro_32khz_hardware_lpf = data.readU8(); + } } } break; @@ -1630,7 +1636,11 @@ MspHelper.prototype.crunch = function(code) { buffer.push16(PID_ADVANCED_CONFIG.digitalIdlePercent * 100); if (semver.gte(CONFIG.apiVersion, "1.25.0")) { - buffer.push8(PID_ADVANCED_CONFIG.gyroUse32kHz); + let gyroUse32kHz = 0; + if (semver.lt(CONFIG.apiVersion, "1.41.0")) { + gyroUse32kHz = PID_ADVANCED_CONFIG.gyroUse32kHz; + } + buffer.push8(gyroUse32kHz); } } break; @@ -1651,8 +1661,12 @@ MspHelper.prototype.crunch = function(code) { buffer.push8(FILTER_CONFIG.dterm_lowpass_type); } if (semver.gte(CONFIG.apiVersion, "1.39.0")) { + let gyro_32khz_hardware_lpf = 0; + if (semver.lt(CONFIG.apiVersion, "1.41.0")) { + gyro_32khz_hardware_lpf = FILTER_CONFIG.gyro_32khz_hardware_lpf; + } buffer.push8(FILTER_CONFIG.gyro_hardware_lpf) - .push8(FILTER_CONFIG.gyro_32khz_hardware_lpf) + .push8(gyro_32khz_hardware_lpf) .push16(FILTER_CONFIG.gyro_lowpass_hz) .push16(FILTER_CONFIG.gyro_lowpass2_hz) .push8(FILTER_CONFIG.gyro_lowpass_type) diff --git a/src/js/tabs/configuration.js b/src/js/tabs/configuration.js index 85a2eabe..0ff530e8 100644 --- a/src/js/tabs/configuration.js +++ b/src/js/tabs/configuration.js @@ -445,7 +445,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) { gyro_select_e.change(); }; - if (semver.gte(CONFIG.apiVersion, "1.25.0")) { + if (semver.gte(CONFIG.apiVersion, "1.25.0") && semver.lt(CONFIG.apiVersion, "1.41.0")) { gyroUse32kHz_e.prop('checked', PID_ADVANCED_CONFIG.gyroUse32kHz !== 0); gyroUse32kHz_e.change(function () { @@ -470,7 +470,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) { var originalPidDenom = pid_select_e.val(); var pidBaseFreq = 8; - if (semver.gte(CONFIG.apiVersion, "1.25.0") && gyroUse32kHz_e.is(':checked')) { + if (semver.gte(CONFIG.apiVersion, "1.25.0") && semver.lt(CONFIG.apiVersion, "1.41.0") && gyroUse32kHz_e.is(':checked')) { pidBaseFreq = 32; } @@ -1023,7 +1023,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) { PID_ADVANCED_CONFIG.gyro_sync_denom = parseInt(gyro_select_e.val()); PID_ADVANCED_CONFIG.pid_process_denom = parseInt(pid_select_e.val()); PID_ADVANCED_CONFIG.digitalIdlePercent = parseFloat($('input[name="digitalIdlePercent"]').val()); - if (semver.gte(CONFIG.apiVersion, "1.25.0")) { + if (semver.gte(CONFIG.apiVersion, "1.25.0") && semver.lt(CONFIG.apiVersion, "1.41.0")) { PID_ADVANCED_CONFIG.gyroUse32kHz = $('input[id="gyroUse32kHz"]').is(':checked') ? 1 : 0; } diff --git a/src/js/tabs/onboard_logging.js b/src/js/tabs/onboard_logging.js index 0e2413e6..4dce3e97 100644 --- a/src/js/tabs/onboard_logging.js +++ b/src/js/tabs/onboard_logging.js @@ -209,7 +209,7 @@ TABS.onboard_logging.initialize = function (callback) { var loggingRates = []; var pidRateBase = 8000; - if (PID_ADVANCED_CONFIG.gyroUse32kHz !== 0) { + if (semver.gte(CONFIG.apiVersion, "1.25.0") && semver.lt(CONFIG.apiVersion, "1.41.0") && PID_ADVANCED_CONFIG.gyroUse32kHz !== 0) { pidRateBase = 32000; } From 3144767f4751c1b2e0bb1b80737eaf341898a94c Mon Sep 17 00:00:00 2001 From: mikeller Date: Wed, 13 Feb 2019 02:26:10 +1300 Subject: [PATCH 2/2] Added note. --- locales/en/messages.json | 3 +++ src/js/tabs/configuration.js | 7 +++++++ src/tabs/configuration.html | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/locales/en/messages.json b/locales/en/messages.json index afe1661c..41243e72 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -1210,6 +1210,9 @@ "configurationLoopTimeHelp": { "message": "Note: Make sure your FC is able to operate at these speeds! Check CPU and cycletime stability. Changing this may require PID re-tuning. TIP: Disable Accelerometer and other sensors to gain more performance." }, + "configurationLoopTimeNo32KhzHelp": { + "message": "$t(configurationLoopTimeHelp.message)
Note about 32 kHz gyro gyro sampling mode: Support for 32 kHz gyro gyro sampling mode was added to Betaflight as an experimental feature. In the years that it was available, it has never shown that it has any advantage over 8 kHz gyro sampling mode, due to its susceptibility to vibrations, and its high noise level which require aggressive filtering, causing delays in the control loop. For this reason, support for 32 kHz gyro sampling mode has been dropped in Betaflight 4.0." + }, "configurationGPS": { "message": "GPS" }, diff --git a/src/js/tabs/configuration.js b/src/js/tabs/configuration.js index 0ff530e8..2e071713 100644 --- a/src/js/tabs/configuration.js +++ b/src/js/tabs/configuration.js @@ -464,6 +464,13 @@ TABS.configuration.initialize = function (callback, scrollPosition) { updateGyroDenom(8); } + + if (semver.gte(CONFIG.apiVersion, "1.41.0")) { + $('.systemconfigNote').html(i18n.getMessage('configurationLoopTimeNo32KhzHelp')); + } else { + $('.systemconfigNote').html(i18n.getMessage('configurationLoopTimeHelp')); + } + gyro_select_e.val(PID_ADVANCED_CONFIG.gyro_sync_denom); gyro_select_e.change(function () { diff --git a/src/tabs/configuration.html b/src/tabs/configuration.html index dc811028..2a6aa383 100644 --- a/src/tabs/configuration.html +++ b/src/tabs/configuration.html @@ -55,7 +55,7 @@
-

+