From f5410499dd92e89659e33c1d56470507253d1bc0 Mon Sep 17 00:00:00 2001 From: Asizon <43983086+Asizon@users.noreply.github.com> Date: Mon, 10 Feb 2020 12:30:37 +0100 Subject: [PATCH 1/2] Add FF Interpolation Options Sonar issues Move to Msp 1.44 and some fixes sonar sonar2 new sonar issues Suggested changes Default to AVG_2 Fix Indexation remove HEAD word fix API const and sonnar --- locales/en/messages.json | 27 +++++++++++++++++++++++++++ src/js/fc.js | 3 +++ src/js/msp/MSPHelper.js | 12 ++++++++++++ src/js/tabs/pid_tuning.js | 25 +++++++++++++++++++++++-- src/tabs/pid_tuning.html | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 99 insertions(+), 2 deletions(-) diff --git a/locales/en/messages.json b/locales/en/messages.json index c9d53645..af45c333 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -1761,6 +1761,33 @@ "pidTuningDtermSetpointTransitionWarning": { "message": "$t(warningTitle.message):<\/strong> The use of a D Setpoint transition greater than 0 and less than 0.1 is highly discouraged. Doing so may lead instability and reduced stick responsiveness as the sticks cross the centre point.<\/span>" }, + "pidTuningFfInterpolateSp": { + "message": "FF Interpolate" + }, + "pidTuningFfInterpolateSpHelp": { + "message": "The following options fine-tune feed forward from race/aggressive to smooth/HD.

Mode: set to NO_AVG for race, AVG_2 for race/fast freestyle, AVG_3 for HD recording, AVG_4 for HD cinematic smoothness.

Smoothness: limits the amount of change that any one incoming radio step can make, increase for smoother FF signal, decrease for more aggressive FF responses.

Boost: helps overcome motor lag with quick stick inputs, can increase jitter. Try 10 for HD, 20 for racers. Up to 30 may be useful for low authority quads but can cause micro overshoot or jitter." + }, + "pidTuningFfInterpolate": { + "message": "Mode" + }, + "pidTuningFfInterpolateSpOptionNoAverage": { + "message": "No AVG" + }, + "pidTuningFfInterpolateSpOptionAverage2": { + "message": "AVG 2" + }, + "pidTuningFfInterpolateSpOptionAverage3": { + "message": "AVG 3" + }, + "pidTuningFfInterpolateSpOptionAverage4": { + "message": "AVG 4" + }, + "pidTuningFfSmoothFactor": { + "message": "Smoothness" + }, + "pidTuningFfBoost": { + "message": "Boost" + }, "pidTuningProportional": { "message": "Proportional" }, diff --git a/src/js/fc.js b/src/js/fc.js index 8e09edc6..d0cc3151 100644 --- a/src/js/fc.js +++ b/src/js/fc.js @@ -458,6 +458,9 @@ var FC = { motorOutputLimit: 0, autoProfileCellCount: 0, idleMinRpm: 0, + ff_interpolate_sp: 0, + ff_smooth_factor: 0, + ff_boost: 0, }; ADVANCED_TUNING_ACTIVE = { ...ADVANCED_TUNING }; diff --git a/src/js/msp/MSPHelper.js b/src/js/msp/MSPHelper.js index df870f9d..3872c6b4 100644 --- a/src/js/msp/MSPHelper.js +++ b/src/js/msp/MSPHelper.js @@ -1152,6 +1152,12 @@ MspHelper.prototype.process_data = function(dataHandler) { ADVANCED_TUNING.motorOutputLimit = data.readU8(); ADVANCED_TUNING.autoProfileCellCount = data.read8(); ADVANCED_TUNING.idleMinRpm = data.readU8(); + + if(semver.gte(CONFIG.apiVersion, API_VERSION_1_44)) { + ADVANCED_TUNING.ff_interpolate_sp = data.readU8(); + ADVANCED_TUNING.ff_smooth_factor = data.readU8(); + ADVANCED_TUNING.ff_boost = data.readU8(); + } } } } @@ -2086,6 +2092,12 @@ MspHelper.prototype.crunch = function(code) { buffer.push8(ADVANCED_TUNING.motorOutputLimit) .push8(ADVANCED_TUNING.autoProfileCellCount) .push8(ADVANCED_TUNING.idleMinRpm); + + if(semver.gte(CONFIG.apiVersion, API_VERSION_1_44)) { + buffer.push8(ADVANCED_TUNING.ff_interpolate_sp) + .push8(ADVANCED_TUNING.ff_smooth_factor) + .push8(ADVANCED_TUNING.ff_boost); + } } } } diff --git a/src/js/tabs/pid_tuning.js b/src/js/tabs/pid_tuning.js index f1dd3293..a29a6e89 100644 --- a/src/js/tabs/pid_tuning.js +++ b/src/js/tabs/pid_tuning.js @@ -395,8 +395,6 @@ TABS.pid_tuning.initialize = function (callback) { $('.pid_filter input[name="rpmFilterHarmonics"]').val(FILTER_DEFAULT.gyro_rpm_notch_harmonics); } }).prop('checked', FILTER_CONFIG.gyro_rpm_notch_harmonics != 0).change(); - - } else { $('.itermRelaxCutoff').hide(); $('.dynamicNotch').hide(); @@ -438,6 +436,25 @@ TABS.pid_tuning.initialize = function (callback) { $('.rates_type').hide(); } + if (semver.gte(CONFIG.apiVersion, API_VERSION_1_44)) { + // FF Interpolate + const ffInterpolateCheck = $('input[id="ffInterpolateSp"]'); + + ffInterpolateCheck.prop('checked', ADVANCED_TUNING.ff_interpolate_sp !== 0); + $('select[id="ffInterpolate"]').val(ADVANCED_TUNING.ff_interpolate_sp > 0 ? ADVANCED_TUNING.ff_interpolate_sp : 2); + $('input[name="ffSmoothFactor"]').val(ADVANCED_TUNING.ff_smooth_factor); + $('input[name="ffBoost"]').val(ADVANCED_TUNING.ff_boost); + + ffInterpolateCheck.change(function() { + const checked = $(this).is(':checked'); + $('.ffInterpolateSp .suboption').toggle(checked); + }); + ffInterpolateCheck.change(); + + } else { + $('.ffInterpolateSp').hide(); + } + $('input[id="useIntegratedYaw"]').change(function() { var checked = $(this).is(':checked'); $('#pidTuningIntegratedYawCaution').toggle(checked); @@ -898,7 +915,11 @@ TABS.pid_tuning.initialize = function (callback) { RC_tuning.rates_type = selectedRatesType; } + if (semver.gte(CONFIG.apiVersion, API_VERSION_1_44)) { + ADVANCED_TUNING.ff_interpolate_sp = $('input[id="ffInterpolateSp"]').is(':checked') ? $('select[id="ffInterpolate"]').val() : 0; + ADVANCED_TUNING.ff_smooth_factor = parseInt($('input[name="ffSmoothFactor"]').val()); + ADVANCED_TUNING.ff_boost = parseInt($('input[name="ffBoost"]').val()); FILTER_CONFIG.dyn_lpf_curve_expo = parseInt($('.pid_filter input[name="dtermLowpassDynExpo"]').val()); } } diff --git a/src/tabs/pid_tuning.html b/src/tabs/pid_tuning.html index 7343f2b5..229e9d14 100644 --- a/src/tabs/pid_tuning.html +++ b/src/tabs/pid_tuning.html @@ -474,6 +474,40 @@ + + + + +
+ + + + + + + + + + + + + + + + + + From 322a34ee31969f8a0563f417e87d6b4d2a956a16 Mon Sep 17 00:00:00 2001 From: Asizon <43983086+Asizon@users.noreply.github.com> Date: Sun, 21 Jun 2020 08:30:57 +0200 Subject: [PATCH 2/2] Rename AVG to Average --- locales/en/messages.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locales/en/messages.json b/locales/en/messages.json index af45c333..ae156dc2 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -1765,22 +1765,22 @@ "message": "FF Interpolate" }, "pidTuningFfInterpolateSpHelp": { - "message": "The following options fine-tune feed forward from race/aggressive to smooth/HD.

Mode: set to NO_AVG for race, AVG_2 for race/fast freestyle, AVG_3 for HD recording, AVG_4 for HD cinematic smoothness.

Smoothness: limits the amount of change that any one incoming radio step can make, increase for smoother FF signal, decrease for more aggressive FF responses.

Boost: helps overcome motor lag with quick stick inputs, can increase jitter. Try 10 for HD, 20 for racers. Up to 30 may be useful for low authority quads but can cause micro overshoot or jitter." + "message": "The following options fine-tune feed forward from race/aggressive to smooth/HD.

Mode: set to NoAverage for race, Average 2 for race/fast freestyle, Average 3 for HD recording, Average 4 for HD cinematic smoothness.

Smoothness: limits the amount of change that any one incoming radio step can make, increase for smoother FF signal, decrease for more aggressive FF responses.

Boost: helps overcome motor lag with quick stick inputs, can increase jitter. Try 10 for HD, 20 for racers. Up to 30 may be useful for low authority quads but can cause micro overshoot or jitter." }, "pidTuningFfInterpolate": { "message": "Mode" }, "pidTuningFfInterpolateSpOptionNoAverage": { - "message": "No AVG" + "message": "NoAverage" }, "pidTuningFfInterpolateSpOptionAverage2": { - "message": "AVG 2" + "message": "Average 2" }, "pidTuningFfInterpolateSpOptionAverage3": { - "message": "AVG 3" + "message": "Average 3" }, "pidTuningFfInterpolateSpOptionAverage4": { - "message": "AVG 4" + "message": "Average 4" }, "pidTuningFfSmoothFactor": { "message": "Smoothness"