Skip to content

Commit fde01eb

Browse files
committed
RFC Dynamic Idle
1 parent dd183f0 commit fde01eb

File tree

6 files changed

+50
-2
lines changed

6 files changed

+50
-2
lines changed

locales/en/messages.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,9 @@
12811281
"configurationDigitalIdlePercent": {
12821282
"message": "Motor Idle Throttle Value [percent]"
12831283
},
1284+
"configurationDigitalIdlePercentDisabled": {
1285+
"message": "Motor Idle Throttle Value [percent] is disabled because Dynamic Idle is enabled in PID tuning tab"
1286+
},
12841287
"configurationDigitalIdlePercentHelp": {
12851288
"message": "The 'DShot idle' value is the percent of maximum throttle that is sent to the ESCs when the throttle at minimum stick position and the craft is armed. Increase it to gain more idle speed and avoid desyncs. Too high and the craft feels floaty."
12861289
},
@@ -1788,6 +1791,18 @@
17881791
"pidTuningFeedforwardTransitionHelp": {
17891792
"message": "With this parameter, the Feedforward term can be reduced near the center of the sticks, which results in smoother end of flips and rolls.<br>The value represents a point of stick deflection: 0 - stick centered, 1 - full deflection. When the stick is above that point, Feedforward is kept constant at its configured value. When the stick is positioned below that point, Feedforward is reduced proportionally, reaching 0 at the stick center position.<br>Value of 1 gives maximum smoothing effect, while value of 0 keeps the Feedforward fixed at its configured value over the whole stick range."
17901793
},
1794+
"pidTuningFeedforwardMaxRateLimit": {
1795+
"message": "Max Rate Limit"
1796+
},
1797+
"pidTuningFeedforwardMaxRateLimitHelp": {
1798+
"message": "pidTuningFeedforwardMaxRateLimitHelp Placeholder"
1799+
},
1800+
"pidTuningFeedforwardJitter": {
1801+
"message": "Jitter Reduction"
1802+
},
1803+
"pidTuningFeedforwardJitterHelp": {
1804+
"message": "Jitter reduction reduces Feedforward when the sticks move slowly. This allows smooth, jitter-free flight when making smooth slow arcs, yet provides full feedforward without any delay when the sticks are moved quickly. A higher threshold value (10-12) is more useful for cinematic or HD freestyle purposes, and a slightly lower value (5) better for racing or higher speed RC links."
1805+
},
17911806
"pidTuningDtermSetpointTransition": {
17921807
"message": "D Setpoint transition"
17931808
},

src/js/msp/MSPHelper.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,8 @@ MspHelper.prototype.process_data = function(dataHandler) {
11781178
FC.ADVANCED_TUNING.feedforward_averaging = data.readU8();
11791179
FC.ADVANCED_TUNING.feedforward_smooth_factor = data.readU8();
11801180
FC.ADVANCED_TUNING.feedforward_boost = data.readU8();
1181+
FC.ADVANCED_TUNING.feedforward_max_rate_limit = data.readU8();
1182+
FC.ADVANCED_TUNING.feedforward_jitter_factor = data.readU8();
11811183
FC.ADVANCED_TUNING.vbat_sag_compensation = data.readU8();
11821184
FC.ADVANCED_TUNING.thrustLinearization = data.readU8();
11831185
}
@@ -2151,6 +2153,8 @@ MspHelper.prototype.crunch = function(code) {
21512153
buffer.push8(FC.ADVANCED_TUNING.feedforward_averaging)
21522154
.push8(FC.ADVANCED_TUNING.feedforward_smooth_factor)
21532155
.push8(FC.ADVANCED_TUNING.feedforward_boost)
2156+
.push8(FC.ADVANCED_TUNING.feedforward_max_rate_limit)
2157+
.push8(FC.ADVANCED_TUNING.feedforward_jitter_factor)
21542158
.push8(FC.ADVANCED_TUNING.vbat_sag_compensation)
21552159
.push8(FC.ADVANCED_TUNING.thrustLinearization);
21562160
}

src/js/tabs/motors.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ TABS.motors.initialize = function (callback) {
6161
}
6262

6363
MSP.promise(MSPCodes.MSP_STATUS)
64+
.then(() => MSP.promise(MSPCodes.MSP_PID_ADVANCED))
6465
.then(() => MSP.promise(MSPCodes.MSP_FEATURE_CONFIG))
6566
.then(() => MSP.promise(MSPCodes.MSP_MIXER_CONFIG))
6667
.then(() => FC.MOTOR_CONFIG.use_dshot_telemetry || FC.MOTOR_CONFIG.use_esc_sensor ? MSP.promise(MSPCodes.MSP_MOTOR_TELEMETRY) : true)
@@ -735,6 +736,15 @@ TABS.motors.initialize = function (callback) {
735736
divUnsyncedPWMFreq.toggle(protocolConfigured && !digitalProtocol);
736737

737738
$('div.digitalIdlePercent').toggle(protocolConfigured && digitalProtocol);
739+
740+
$('input[name="digitalIdlePercent"]').prop('disabled', protocolConfigured && digitalProtocol && FC.ADVANCED_TUNING.idleMinRpm && FC.MOTOR_CONFIG.use_dshot_telemetry);
741+
742+
if (FC.ADVANCED_TUNING.idleMinRpm && FC.MOTOR_CONFIG.use_dshot_telemetry) {
743+
$('span.digitalIdlePercentDisabled').text(i18n.getMessage('configurationDigitalIdlePercentDisabled'));
744+
} else {
745+
$('span.digitalIdlePercentDisabled').text(i18n.getMessage('configurationDigitalIdlePercent'));
746+
}
747+
738748
$('.escSensor').toggle(protocolConfigured && digitalProtocol);
739749

740750
$('div.checkboxDshotBidir').toggle(protocolConfigured && semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42) && digitalProtocol);

src/js/tabs/pid_tuning.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ TABS.pid_tuning.initialize = function (callback) {
457457
$('.pid_tuning input[name="motorLimit"]').val(FC.ADVANCED_TUNING.motorOutputLimit);
458458
$('.pid_tuning input[name="cellCount"]').val(FC.ADVANCED_TUNING.autoProfileCellCount);
459459
$('input[name="idleMinRpm-number"]').val(FC.ADVANCED_TUNING.idleMinRpm);
460+
$('.idleMinRpm').toggle(FC.MOTOR_CONFIG.use_dshot_telemetry);
460461
} else {
461462
$('.motorOutputLimit').hide();
462463
$('.idleMinRpm').hide();
@@ -509,6 +510,8 @@ TABS.pid_tuning.initialize = function (callback) {
509510
$('select[id="feedforwardAveraging"]').val(FC.ADVANCED_TUNING.feedforward_averaging);
510511
$('input[name="feedforwardSmoothFactor"]').val(FC.ADVANCED_TUNING.feedforward_smooth_factor);
511512
$('input[name="feedforwardBoost"]').val(FC.ADVANCED_TUNING.feedforward_boost);
513+
$('input[name="feedforwardMaxRateLimit"]').val(FC.ADVANCED_TUNING.feedforward_max_rate_limit);
514+
$('input[name="feedforwardJitterFactor"]').val(FC.ADVANCED_TUNING.feedforward_jitter);
512515

513516
// Vbat Sag Compensation
514517
const vbatSagCompensationCheck = $('input[id="vbatSagCompensation"]');
@@ -534,6 +537,8 @@ TABS.pid_tuning.initialize = function (callback) {
534537
} else {
535538
$('.vbatSagCompensation').hide();
536539
$('.thrustLinearization').hide();
540+
$('.feedforwardMaxRateLimit').hide();
541+
$('.feedforwardJitter').hide();
537542

538543
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_40)) {
539544
$('.pid_tuning .ROLL input[name="f"]').val(FC.ADVANCED_TUNING.feedforwardRoll > 0 ? FC.ADVANCED_TUNING.feedforwardRoll : PID_DEFAULT[4]);
@@ -1066,6 +1071,8 @@ TABS.pid_tuning.initialize = function (callback) {
10661071
FC.ADVANCED_TUNING.feedforward_averaging = $('select[id="feedforwardAveraging"]').val();
10671072
FC.ADVANCED_TUNING.feedforward_smooth_factor = parseInt($('input[name="feedforwardSmoothFactor"]').val());
10681073
FC.ADVANCED_TUNING.feedforward_boost = parseInt($('input[name="feedforwardBoost"]').val());
1074+
FC.ADVANCED_TUNING.feedforward_max_rate_limit = parseInt($('input[name="feedforwardMaxRateLimit"]').val());
1075+
FC.ADVANCED_TUNING.feedforward_jitter = parseInt($('input[name="feedforwardJitterFactor"]').val());
10691076
FC.FILTER_CONFIG.dyn_lpf_curve_expo = parseInt($('.pid_filter input[name="dtermLowpassDynExpo"]').val());
10701077
FC.ADVANCED_TUNING.vbat_sag_compensation = $('input[id="vbatSagCompensation"]').is(':checked') ? parseInt($('input[name="vbatSagValue"]').val()) : 0;
10711078
FC.ADVANCED_TUNING.thrustLinearization = $('input[id="thrustLinearization"]').is(':checked') ? parseInt($('input[name="thrustLinearValue"]').val()) : 0;

src/tabs/motors.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@
105105
<div class="numberspacer">
106106
<input type="number" name="digitalIdlePercent" min="0.00" max="20.00" step="0.01"/>
107107
</div>
108-
<span i18n="configurationDigitalIdlePercent"></span>
108+
<span class="digitalIdlePercentDisabled"></span>
109+
<div class="helpicon cf_tip" i18n_title="configurationDigitalIdlePercentHelp"></div>
109110
</label>
110-
<div class="helpicon cf_tip" i18n_title="configurationDigitalIdlePercentHelp"></div>
111111
</div>
112112
<div class="number minthrottle">
113113
<label>

src/tabs/pid_tuning.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,18 @@
613613
<div class="helpicon cf_tip" i18n_title="pidTuningFeedforwardTransitionHelp"></div>
614614
</span>
615615

616+
<span class="feedforwardMaxRateLimit suboption">
617+
<input type="number" name="feedforwardMaxRateLimit" step="0.01" min="0.00" max="1.00"/>
618+
<label><span i18n="pidTuningFeedforwardMaxRateLimit"></span></label>
619+
<div class="helpicon cf_tip" i18n_title="pidTuningFeedforwardMaxRateLimitHelp"></div>
620+
</span>
621+
622+
<span class="feedforwardJitter suboption">
623+
<input type="number" name="feedforwardJitterFactor" step="0.01" min="0.00" max="1.00"/>
624+
<label><span i18n="pidTuningFeedforwardJitter"></span></label>
625+
<div class="helpicon cf_tip" i18n_title="pidTuningFeedforwardJitterHelp"></div>
626+
</span>
627+
616628
<span class="feedforwardOption feedforwardAveraging suboption">
617629
<select id="feedforwardAveraging">
618630
<option i18n="pidTuningOptionOff" value="0"/>

0 commit comments

Comments
 (0)