Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dyn_idle_start_increase to UX #4177

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4588,6 +4588,12 @@
"pidTuningIdleMinRpmDisabled": {
"message": "Dynamic Idle is DISABLED because Dshot Telemetry is OFF"
},
"pidTuningDynIdleStartIncrease": {
"message": "Dynamic Idle Start Increase"
},
"pidTuningDynIdleStartIncreaseHelp": {
"message": "TBD"
},
"pidTuningAcroTrainerAngleLimit": {
"message": "Acro Trainer Angle Limit"
},
Expand Down
1 change: 1 addition & 0 deletions src/js/fc.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ const FC = {
thrustLinearization: 0,
tpaRate: 0,
tpaBreakpoint: 0,
dynIdleStartIncrease: 0,
};
this.ADVANCED_TUNING_ACTIVE = { ...this.ADVANCED_TUNING };

Expand Down
7 changes: 7 additions & 0 deletions src/js/msp/MSPHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
FC.ADVANCED_TUNING.tpaRate = parseFloat((data.readU8() / 100).toFixed(2));
FC.ADVANCED_TUNING.tpaBreakpoint = data.readU16();

// Introduced in 1.47
FC.ADVANCED_TUNING.dynIdleStartIncrease = data.readU8();

FC.ADVANCED_TUNING_ACTIVE = { ...FC.ADVANCED_TUNING };
break;
case MSPCodes.MSP_SENSOR_CONFIG:
Expand Down Expand Up @@ -2119,7 +2122,11 @@ MspHelper.prototype.crunch = function(code, modifierCode = undefined) {
buffer.push8(FC.ADVANCED_TUNING.tpaMode);
buffer.push8(Math.round(FC.ADVANCED_TUNING.tpaRate * 100));
buffer.push16(FC.ADVANCED_TUNING.tpaBreakpoint);

// Introduced in 1.47
buffer.push8(FC.ADVANCED_TUNING.dynIdleStartIncrease);
break;

case MSPCodes.MSP_SET_SENSOR_CONFIG:
buffer.push8(FC.SENSOR_CONFIG.acc_hardware)
.push8(FC.SENSOR_CONFIG.baro_hardware)
Expand Down
10 changes: 9 additions & 1 deletion src/js/tabs/pid_tuning.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import TuningSliders from "../TuningSliders";
import Model from "../model";
import RateCurve from "../RateCurve";
import MSPCodes from "../msp/MSPCodes";
import { API_VERSION_1_45 } from "../data_storage";
import { API_VERSION_1_45, API_VERSION_1_47 } from "../data_storage";
import { gui_log } from "../gui_log";
import { degToRad, isInt } from "../utils/common";
import semver from "semver";
Expand Down Expand Up @@ -124,6 +124,10 @@ pid_tuning.initialize = function (callback) {
$('.tpa-old input[name="tpa-breakpoint"]').val(FC.RC_TUNING.dynamic_THR_breakpoint);
}

if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
$('input[name="dynIdleStartIncrease-number"]').val(FC.ADVANCED_TUNING.dynIdleStartIncrease);
}

$('.vbatpidcompensation').toggle(vbatpidcompensationIsUsed);
$('input[id="vbatpidcompensation"]').prop('checked', FC.ADVANCED_TUNING.vbatPidCompensation !== 0);

Expand Down Expand Up @@ -852,6 +856,10 @@ pid_tuning.initialize = function (callback) {
FC.RC_TUNING.dynamic_THR_breakpoint = parseInt($('.tpa-old input[name="tpa-breakpoint"]').val());
}

if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
FC.ADVANCED_TUNING.dynIdleStartIncrease = parseInt($('input[name="dynIdleStartIncrease-number"]').val());
}

FC.FILTER_CONFIG.gyro_lowpass_hz = parseInt($('.pid_filter input[name="gyroLowpassFrequency"]').val());
FC.FILTER_CONFIG.dterm_lowpass_hz = parseInt($('.pid_filter input[name="dtermLowpassFrequency"]').val());
FC.FILTER_CONFIG.yaw_lowpass_hz = parseInt($('.pid_filter input[name="yawLowpassFrequency"]').val());
Expand Down
12 changes: 12 additions & 0 deletions src/tabs/pid_tuning.html
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,18 @@
</td>
</tr>

<tr class="idleStartIncrease">
<td><input type="number" name="dynIdleStartIncrease-number" min="10" max="255"/></td>
<td colspan="2">
<div>
<label>
<span i18n="pidTuningDynIdleStartIncrease"></span>
</label>
<div class="helpicon cf_tip" i18n_title="pidTuningDynIdleStartIncreaseHelp"></div>
</div>
</td>
</tr>

<tr class="vbatSagCompensation">
<td><input type="checkbox" id="vbatSagCompensation" class="toggle" /></td>
<td colspan="2">
Expand Down