Skip to content

Commit

Permalink
Show idleMinRpm on motor tab (active profile) (betaflight#3625)
Browse files Browse the repository at this point in the history
* Make idleMinRpm configurable from motor tab (active profile)

* Reorder idleMinRpm and digitalIdlePercent

* Fixes per review

* Co-authored-by: nerdCopter <56646290+nerdCopter@users.noreply.github.com>
  • Loading branch information
haslinghuis authored and chmelevskij committed Apr 27, 2024
1 parent 78b6775 commit 7af7972
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,10 @@
"message": "The pole count is the number of magnets on the bell of the motor. Do NOT count the stators where the windings are located. 5\" motors usually have 14 magnets, 3\" or smaller often have 12 magnets.",
"description": "Help text for the Motor poles field of the ESC/Motor configuration"
},
"configurationMotorIdleRpmHelp" : {
"message": "This is the dynamic idle value from the active PID profile. When Dynamic Idle is set to zero, only static motor idle will apply. Change the Dynamic Idle settings on the PID tuning tab.",
"description": "Help text for dynamic idle setting"
},
"configurationThrottleMinimum": {
"message": "Minimum Throttle (Lowest ESC value when armed)"
},
Expand Down
6 changes: 6 additions & 0 deletions src/css/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ input[type="number"] {
margin-left: 5px;
}
}
.noarrows {
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
}
}
.clear-both {
clear: both;
}
Expand Down
4 changes: 4 additions & 0 deletions src/js/tabs/motors.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ motors.initialize = async function (callback) {
dshotBidir: FC.MOTOR_CONFIG.use_dshot_telemetry,
motorPoles: FC.MOTOR_CONFIG.motor_poles,
digitalIdlePercent: FC.PID_ADVANCED_CONFIG.digitalIdlePercent,
idleMinRpm: FC.ADVANCED_TUNING.idleMinRpm,
_3ddeadbandlow: FC.MOTOR_3D_CONFIG.deadband3d_low,
_3ddeadbandhigh: FC.MOTOR_3D_CONFIG.deadband3d_high,
_3dneutral: FC.MOTOR_3D_CONFIG.neutral,
Expand Down Expand Up @@ -693,6 +694,8 @@ motors.initialize = async function (callback) {
unsyncedPWMSwitchElement.prop('checked', FC.PID_ADVANCED_CONFIG.use_unsyncedPwm !== 0).trigger("change");
$('input[name="unsyncedpwmfreq"]').val(FC.PID_ADVANCED_CONFIG.motor_pwm_rate);
$('input[name="digitalIdlePercent"]').val(FC.PID_ADVANCED_CONFIG.digitalIdlePercent);
$('input[name="idleMinRpm"]').val(FC.ADVANCED_TUNING.idleMinRpm);

if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) {
dshotBidirElement.prop('checked', FC.MOTOR_CONFIG.use_dshot_telemetry).trigger("change");

Expand Down Expand Up @@ -771,6 +774,7 @@ motors.initialize = async function (callback) {
divUnsyncedPWMFreq.toggle(protocolConfigured && !digitalProtocol);

$('div.digitalIdlePercent').toggle(protocolConfigured && digitalProtocol);
$('div.idleMinRpm').toggle(protocolConfigured && digitalProtocol && FC.MOTOR_CONFIG.use_dshot_telemetry);

if (FC.ADVANCED_TUNING.idleMinRpm && FC.MOTOR_CONFIG.use_dshot_telemetry) {
$('div.digitalIdlePercent').hide();
Expand Down
9 changes: 9 additions & 0 deletions src/tabs/motors.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@
</label>
<div class="helpicon cf_tip" i18n_title="configurationMotorPolesHelp"></div>
</div>
<div class="number idleMinRpm">
<label>
<div class="numberspacer noarrows">
<input type="number" name="idleMinRpm" min="0" max="100" step="1" readonly/>
</div>
<span i18n="pidTuningIdleMinRpm"></span>
</label>
<div class="helpicon cf_tip" i18n_title="configurationMotorIdleRpmHelp"></div>
</div>
<div class="number digitalIdlePercent">
<label>
<div class="numberspacer">
Expand Down

0 comments on commit 7af7972

Please sign in to comment.