diff --git a/locales/en/messages.json b/locales/en/messages.json index 1b3e9f77..9f5ef49c 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -1245,6 +1245,17 @@ "message": "Profile independent PID Controller Settings" }, + "pidTuningAntiGravityMode": { + "message": "Anti Gravity Mode" + }, + "pidTuningAntiGravityModeOptionSmooth": { + "message": "Smooth", + "description": "One of the modes of anti gravity" + }, + "pidTuningAntiGravityModeOptionStep": { + "message": "Step", + "description": "One of the modes of anti gravity" + }, "pidTuningAntiGravityGain": { "message": "Anti Gravity Gain" }, diff --git a/src/js/fc.js b/src/js/fc.js index 084ea1b9..a3cd969c 100644 --- a/src/js/fc.js +++ b/src/js/fc.js @@ -380,6 +380,7 @@ var FC = { feedforwardPitch: 0, feedforwardYaw: 0, feedforwardTransition: 0, + antiGravityMode: 0, }; SENSOR_CONFIG = { diff --git a/src/js/msp/MSPHelper.js b/src/js/msp/MSPHelper.js index 5f046469..59b1ccea 100644 --- a/src/js/msp/MSPHelper.js +++ b/src/js/msp/MSPHelper.js @@ -911,6 +911,7 @@ MspHelper.prototype.process_data = function(dataHandler) { ADVANCED_TUNING.feedforwardRoll = data.readU16(); ADVANCED_TUNING.feedforwardPitch = data.readU16(); ADVANCED_TUNING.feedforwardYaw = data.readU16(); + ADVANCED_TUNING.antiGravityMode = data.readU8(); } } } @@ -1585,7 +1586,8 @@ MspHelper.prototype.crunch = function(code) { .push8(ADVANCED_TUNING.acroTrainerAngleLimit) .push16(ADVANCED_TUNING.feedforwardRoll) .push16(ADVANCED_TUNING.feedforwardPitch) - .push16(ADVANCED_TUNING.feedforwardYaw); + .push16(ADVANCED_TUNING.feedforwardYaw) + .push8(ADVANCED_TUNING.antiGravityMode); } } } diff --git a/src/js/tabs/pid_tuning.js b/src/js/tabs/pid_tuning.js index 15ef3eb4..f2da322a 100644 --- a/src/js/tabs/pid_tuning.js +++ b/src/js/tabs/pid_tuning.js @@ -272,6 +272,22 @@ TABS.pid_tuning.initialize = function (callback) { feedforwardTransitionNumberElement.val($(this).val()); }); + // AntiGravity Mode + var antiGravityModeSelect = $('.antigravity select[id="antiGravityMode"]'); + antiGravityModeSelect.change(function () { + var antiGravityModeValue = $('.antigravity select[id="antiGravityMode"]').val(); + + // Smooth + if (antiGravityModeValue == 0) { + $('.antigravity table th:nth-child(3)').hide(); + $('.antigravity table td:nth-child(3)').hide(); + } else { + $('.antigravity table th:nth-child(3)').show(); + $('.antigravity table td:nth-child(3)').show(); + } + }); + + antiGravityModeSelect.val(ADVANCED_TUNING.antiGravityMode).change(); } else { $('.itermrotation').hide(); @@ -288,6 +304,9 @@ TABS.pid_tuning.initialize = function (callback) { $('#pid_main .pid_titlebar2 th').attr("colspan", 8); $('#pid-tuning .feedforwardTransition').hide(); + + $('.antigravity table th:first-child').hide(); + $('.antigravity table td:first-child').hide(); } $('input[id="gyroNotch1Enabled"]').change(function() { @@ -497,6 +516,8 @@ TABS.pid_tuning.initialize = function (callback) { ADVANCED_TUNING.feedforwardYaw = parseInt($('.pid_tuning .YAW input[name="f"]').val()); ADVANCED_TUNING.feedforwardTransition = parseInt($('input[name="feedforwardTransition-number"]').val() * 100); + + ADVANCED_TUNING.antiGravityMode = $('select[id="antiGravityMode"]').val(); } } diff --git a/src/tabs/pid_tuning.html b/src/tabs/pid_tuning.html index afe4673b..00b7ce13 100644 --- a/src/tabs/pid_tuning.html +++ b/src/tabs/pid_tuning.html @@ -456,14 +456,25 @@
- | + | + + | ++ + | ++ + |