Skip to content

Commit 922adbe

Browse files
authored
Deprecate minthrottle to use motor_idle (#4196)
* Depricate minthrottle * Fix sonar * Update toggle hide logic * Rename digitalIdlePercent * Move mincommand above maxthrottle * Use widetip * Update tooltip * Change precision * Fix camelCase
1 parent ab5f510 commit 922adbe

File tree

5 files changed

+35
-34
lines changed

5 files changed

+35
-34
lines changed

locales/en/messages.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1464,11 +1464,11 @@
14641464
"configurationGyroCalOnFirstArm": {
14651465
"message": "Calibrate Gyro on first arm"
14661466
},
1467-
"configurationDigitalIdlePercent": {
1467+
"configurationMotorIdle": {
14681468
"message": "Motor Idle (%)"
14691469
},
1470-
"configurationDigitalIdlePercentHelp": {
1471-
"message": "The Motor Idle value sets the idle speed of the motors when throttle is at minimum position.<br/><br/><strong>Dynamic Idle disabled</strong><br/><br/>The lowest throttle value sent to any motor, while armed, as a percentage of full throttle. Increase it to improve motor startup reliability, to avoid desyncs, and to improve PID responsiveness at low throttle.<br/><br/>Too low: the motors may not start up reliably, or desync at the end of a flip or roll or on hard throttle chops.<br/><br/>Too high: the craft may feel 'floaty'.<br/><br/><strong>Dynamic idle enabled</strong><br/><br/>The maximum throttle allowed, after arming, before takeoff. If RPM is less than dyn_idle_min_rpm, or zero, this throttle value will be sent to the motors. When the motors start spinning, throttle is adjusted to maintain the set RPM, but cannot exceed this value until the quad takes off.<br/><br/>Too low: the motors may not start up reliably.<br/><br/>Too high: the craft may shake on the ground before takeoff."
1470+
"configurationMotorIdleHelp": {
1471+
"message": "Sets the idle speed of the motors while armed and throttle is 'low' (below `min_check`).<br/><br/><strong class=\"message-positive\">Dynamic Idle not enabled</strong><br/><br/>Each motor gets `min_command` plus Motor Idle percent.<br/><br/><b>Idle too low</b>: motors may not start reliably, spin up slowly, or desync in flips or rolls.<br/><br/><b>Idle too high</b>: the craft may feel 'floaty'.<br/><br/><b>Note</b>: analog ESC's must be calibrated so the motors start just above `min_command`.<br/><br/><strong class=\"message-positive\">Dynamic Idle enabled</strong><br/><br/>On arming, the 'normal' idle value is sent to each motor, until they spin up.<br/><br/>Once spinning, the motor signal is adjusted to achieve the target RPM.<br/><br/>Before takeoff, the motor signal is limited to the Motor Idle percentage, and the set RPM may not be achieved. This is OK. When throttle is raised above the `airmode_motor_start_throttle` percentage, the limit is much higher, and the set RPM should be achieved at idle.<br/><br/><b>Idle too low</b>: motors may not start reliably<br/><br/><b>Idle too high</b>: shaking before takeoff (only if dynamic idle is also high)<br/><br/><b>Note</b>: Dynamic Idle requires DShot and DShot Telemetry."
14721472
},
14731473
"configurationMotorPoles": {
14741474
"message": "Motor poles",

src/js/fc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ const FC = {
479479
use_unsyncedPwm: 0,
480480
fast_pwm_protocol: 0,
481481
motor_pwm_rate: 0,
482-
digitalIdlePercent: 0,
482+
motorIdle: 0,
483483
gyroUse32kHz: 0,
484484
motorPwmInversion: 0,
485485
gyroHighFsr: 0,

src/js/msp/MSPHelper.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
10481048
FC.PID_ADVANCED_CONFIG.use_unsyncedPwm = data.readU8();
10491049
FC.PID_ADVANCED_CONFIG.fast_pwm_protocol = EscProtocols.ReorderPwmProtocols(FC.CONFIG.apiVersion, data.readU8());
10501050
FC.PID_ADVANCED_CONFIG.motor_pwm_rate = data.readU16();
1051-
FC.PID_ADVANCED_CONFIG.digitalIdlePercent = data.readU16() / 100;
1051+
FC.PID_ADVANCED_CONFIG.motorIdle = data.readU16() / 100;
10521052
data.readU8(); // gyroUse32Khz is not supported
10531053
// Introduced in 1.42
10541054
FC.PID_ADVANCED_CONFIG.motorPwmInversion = data.readU8();
@@ -2002,7 +2002,7 @@ MspHelper.prototype.crunch = function(code, modifierCode = undefined) {
20022002
.push8(FC.PID_ADVANCED_CONFIG.use_unsyncedPwm)
20032003
.push8(EscProtocols.ReorderPwmProtocols(FC.CONFIG.apiVersion, FC.PID_ADVANCED_CONFIG.fast_pwm_protocol))
20042004
.push16(FC.PID_ADVANCED_CONFIG.motor_pwm_rate)
2005-
.push16(FC.PID_ADVANCED_CONFIG.digitalIdlePercent * 100)
2005+
.push16(FC.PID_ADVANCED_CONFIG.motorIdle * 100)
20062006
.push8(0); // gyroUse32kHz not used
20072007

20082008
// Introduced in 1.42

src/js/tabs/motors.js

+18-17
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ motors.initialize = async function (callback) {
278278
feature27: FC.FEATURE_CONFIG.features.isEnabled('ESC_SENSOR'),
279279
dshotBidir: FC.MOTOR_CONFIG.use_dshot_telemetry,
280280
motorPoles: FC.MOTOR_CONFIG.motor_poles,
281-
digitalIdlePercent: FC.PID_ADVANCED_CONFIG.digitalIdlePercent,
281+
motorIdle: FC.PID_ADVANCED_CONFIG.motorIdle,
282282
idleMinRpm: FC.ADVANCED_TUNING.idleMinRpm,
283283
_3ddeadbandlow: FC.MOTOR_3D_CONFIG.deadband3d_low,
284284
_3ddeadbandhigh: FC.MOTOR_3D_CONFIG.deadband3d_high,
@@ -691,7 +691,7 @@ motors.initialize = async function (callback) {
691691

692692
unsyncedPWMSwitchElement.prop('checked', FC.PID_ADVANCED_CONFIG.use_unsyncedPwm !== 0).trigger("change");
693693
$('input[name="unsyncedpwmfreq"]').val(FC.PID_ADVANCED_CONFIG.motor_pwm_rate);
694-
$('input[name="digitalIdlePercent"]').val(FC.PID_ADVANCED_CONFIG.digitalIdlePercent);
694+
$('input[name="motorIdle"]').val(FC.PID_ADVANCED_CONFIG.motorIdle);
695695
$('input[name="idleMinRpm"]').val(FC.ADVANCED_TUNING.idleMinRpm);
696696

697697
dshotBidirElement.prop('checked', FC.MOTOR_CONFIG.use_dshot_telemetry).trigger("change");
@@ -755,24 +755,25 @@ motors.initialize = async function (callback) {
755755
default:
756756
}
757757

758+
const analogProtocolConfigured = protocolConfigured && !digitalProtocol;
759+
const digitalProtocolConfigured = protocolConfigured && digitalProtocol;
758760
const rpmFeaturesVisible = digitalProtocol && dshotBidirElement.is(':checked') || $("input[name='ESC_SENSOR']").is(':checked');
759761

760-
$('div.minthrottle').toggle(protocolConfigured && !digitalProtocol);
761-
$('div.maxthrottle').toggle(protocolConfigured && !digitalProtocol);
762-
$('div.mincommand').toggle(protocolConfigured && !digitalProtocol);
763-
$('div.checkboxPwm').toggle(protocolConfigured && !digitalProtocol);
764-
divUnsyncedPWMFreq.toggle(protocolConfigured && !digitalProtocol);
762+
$('div.minthrottle').toggle(analogProtocolConfigured && semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_47));
763+
$('div.maxthrottle').toggle(analogProtocolConfigured);
764+
$('div.mincommand').toggle(analogProtocolConfigured);
765+
$('div.checkboxPwm').toggle(analogProtocolConfigured);
766+
divUnsyncedPWMFreq.toggle(analogProtocolConfigured);
765767

766-
$('div.digitalIdlePercent').toggle(protocolConfigured && digitalProtocol);
767-
$('div.idleMinRpm').toggle(protocolConfigured && digitalProtocol && FC.MOTOR_CONFIG.use_dshot_telemetry);
768+
$('div.motorIdle').toggle(protocolConfigured
769+
&& semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)
770+
|| (digitalProtocolConfigured && FC.MOTOR_CONFIG.use_dshot_telemetry && FC.ADVANCED_TUNING.idleMinRpm));
768771

769-
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_47) && FC.ADVANCED_TUNING.idleMinRpm && FC.MOTOR_CONFIG.use_dshot_telemetry) {
770-
$('div.digitalIdlePercent').hide();
771-
}
772+
$('div.idleMinRpm').toggle(protocolConfigured && digitalProtocol && FC.MOTOR_CONFIG.use_dshot_telemetry);
772773

773-
$('.escSensor').toggle(protocolConfigured && digitalProtocol);
774+
$('.escSensor').toggle(digitalProtocolConfigured);
774775

775-
$('div.checkboxDshotBidir').toggle(protocolConfigured && digitalProtocol);
776+
$('div.checkboxDshotBidir').toggle(digitalProtocolConfigured);
776777
$('div.motorPoles').toggle(protocolConfigured && rpmFeaturesVisible);
777778

778779
$('.escMotorStop').toggle(protocolConfigured);
@@ -1157,7 +1158,7 @@ motors.initialize = async function (callback) {
11571158
FC.PID_ADVANCED_CONFIG.fast_pwm_protocol = parseInt(escProtocolElement.val() - 1);
11581159
FC.PID_ADVANCED_CONFIG.use_unsyncedPwm = unsyncedPWMSwitchElement.is(':checked') ? 1 : 0;
11591160
FC.PID_ADVANCED_CONFIG.motor_pwm_rate = parseInt($('input[name="unsyncedpwmfreq"]').val());
1160-
FC.PID_ADVANCED_CONFIG.digitalIdlePercent = parseFloat($('input[name="digitalIdlePercent"]').val());
1161+
FC.PID_ADVANCED_CONFIG.motorIdle = parseFloat($('input[name="motorIdle"]').val());
11611162

11621163
await MSP.promise(MSPCodes.MSP_SET_FEATURE_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FEATURE_CONFIG));
11631164
await MSP.promise(MSPCodes.MSP_SET_MIXER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_MIXER_CONFIG));
@@ -1225,7 +1226,7 @@ motors.initialize = async function (callback) {
12251226
function setup_motor_output_reordering_dialog(callbackFunction, zeroThrottleValue)
12261227
{
12271228
const domDialogMotorOutputReorder = $('#dialogMotorOutputReorder');
1228-
const idleThrottleValue = zeroThrottleValue + FC.PID_ADVANCED_CONFIG.digitalIdlePercent * 1000 / 100;
1229+
const idleThrottleValue = zeroThrottleValue + FC.PID_ADVANCED_CONFIG.motorIdle * 1000 / 100;
12291230
const motorOutputReorderComponent = new MotorOutputReorderComponent($('#dialogMotorOutputReorderContent'),
12301231
callbackFunction, mixerList[FC.MIXER_CONFIG.mixer - 1].name,
12311232
zeroThrottleValue, idleThrottleValue);
@@ -1256,7 +1257,7 @@ motors.initialize = async function (callback) {
12561257
function SetupdescDshotDirectionDialog(callbackFunction, zeroThrottleValue)
12571258
{
12581259
const domEscDshotDirectionDialog = $('#escDshotDirectionDialog');
1259-
const idleThrottleValue = zeroThrottleValue + FC.PID_ADVANCED_CONFIG.digitalIdlePercent * 1000 / 100;
1260+
const idleThrottleValue = zeroThrottleValue + FC.PID_ADVANCED_CONFIG.motorIdle * 1000 / 100;
12601261
const motorConfig = {
12611262
numberOfMotors: self.numberOfValidOutputs,
12621263
motorStopValue: zeroThrottleValue,

src/tabs/motors.html

+11-11
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@
9999
<span i18n="configurationMotorPolesLong"></span>
100100
<div class="helpicon cf_tip" i18n_title="configurationMotorPolesHelp"></div>
101101
</div>
102-
<div class="number digitalIdlePercent">
102+
<div class="number motorIdle">
103103
<div class="numberspacer">
104-
<input type="number" name="digitalIdlePercent" min="0.00" max="20.00" step="0.01"/>
104+
<input type="number" name="motorIdle" min="0.0" max="20.0" step="0.1"/>
105105
</div>
106-
<span i18n="configurationDigitalIdlePercent"></span>
107-
<div class="helpicon cf_tip" i18n_title="configurationDigitalIdlePercentHelp"></div>
106+
<span i18n="configurationMotorIdle"></span>
107+
<div class="helpicon cf_tip_wide" i18n_title="configurationMotorIdleHelp"></div>
108108
</div>
109109
<div class="number idleMinRpm">
110110
<div class="numberspacer noarrows">
@@ -113,6 +113,13 @@
113113
<span i18n="pidTuningIdleMinRpm"></span>
114114
<div class="helpicon cf_tip" i18n_title="configurationMotorIdleRpmHelp"></div>
115115
</div>
116+
<div class="number mincommand">
117+
<div class="numberspacer">
118+
<input type="number" name="mincommand" min="0" max="2000" />
119+
</div>
120+
<span i18n="configurationThrottleMinimumCommand"></span>
121+
<div class="helpicon cf_tip" i18n_title="configurationThrottleMinimumCommandHelp"></div>
122+
</div>
116123
<div class="number minthrottle">
117124
<div class="numberspacer">
118125
<input type="number" name="minthrottle" min="0" max="2000" />
@@ -126,13 +133,6 @@
126133
</div>
127134
<span i18n="configurationThrottleMaximum"></span>
128135
</div>
129-
<div class="number mincommand">
130-
<div class="numberspacer">
131-
<input type="number" name="mincommand" min="0" max="2000" />
132-
</div>
133-
<span i18n="configurationThrottleMinimumCommand"></span>
134-
<div class="helpicon cf_tip" i18n_title="configurationThrottleMinimumCommandHelp"></div>
135-
</div>
136136
</div>
137137
</div>
138138
</div>

0 commit comments

Comments
 (0)