Skip to content

Commit fa662d2

Browse files
author
Ivan Efimov
authored
Merge pull request #2896 from haslinghuis/remove_duplicates
[chore] remove_duplicates from receiver tab
2 parents 31aebea + 9e4c844 commit fa662d2

File tree

1 file changed

+10
-31
lines changed

1 file changed

+10
-31
lines changed

src/js/tabs/receiver.js

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -816,10 +816,10 @@ TABS.receiver.initModelPreview = function () {
816816
this.model = new Model($('.model_preview'), $('.model_preview canvas'));
817817

818818
let useOldRateCurve = false;
819-
if (FC.CONFIG.flightControllerIdentifier === 'CLFL' && semver.lt(FC.CONFIG.apiVersion, '2.0.0')) {
820-
useOldRateCurve = true;
821-
}
822-
if (FC.CONFIG.flightControllerIdentifier === 'BTFL' && semver.lt(FC.CONFIG.flightControllerVersion, '2.8.0')) {
819+
const cleanFlight = FC.CONFIG.flightControllerIdentifier === 'CLFL' && semver.lt(FC.CONFIG.apiVersion, '2.0.0');
820+
const betaFlight = FC.CONFIG.flightControllerIdentifier === 'BTFL' && semver.lt(FC.CONFIG.flightControllerVersion, '2.8.0');
821+
822+
if (cleanFlight || betaFlight) {
823823
useOldRateCurve = true;
824824
}
825825

@@ -837,33 +837,12 @@ TABS.receiver.renderModel = function () {
837837
if (FC.RC.channels[0] && FC.RC.channels[1] && FC.RC.channels[2]) {
838838
const delta = this.clock.getDelta();
839839

840-
const roll = delta * this.rateCurve.rcCommandRawToDegreesPerSecond(
841-
FC.RC.channels[0],
842-
this.currentRates.roll_rate,
843-
this.currentRates.rc_rate,
844-
this.currentRates.rc_expo,
845-
this.currentRates.superexpo,
846-
this.currentRates.deadband,
847-
this.currentRates.roll_rate_limit,
848-
);
849-
const pitch = delta * this.rateCurve.rcCommandRawToDegreesPerSecond(
850-
FC.RC.channels[1],
851-
this.currentRates.pitch_rate,
852-
this.currentRates.rc_rate_pitch,
853-
this.currentRates.rc_pitch_expo,
854-
this.currentRates.superexpo,
855-
this.currentRates.deadband,
856-
this.currentRates.pitch_rate_limit,
857-
);
858-
const yaw = delta * this.rateCurve.rcCommandRawToDegreesPerSecond(
859-
FC.RC.channels[2],
860-
this.currentRates.yaw_rate,
861-
this.currentRates.rc_rate_yaw,
862-
this.currentRates.rc_yaw_expo,
863-
this.currentRates.superexpo,
864-
this.currentRates.yawDeadband,
865-
this.currentRates.yaw_rate_limit,
866-
);
840+
const roll = delta * this.rateCurve.rcCommandRawToDegreesPerSecond(FC.RC.channels[0], this.currentRates.roll_rate, this.currentRates.rc_rate, this.currentRates.rc_expo,
841+
this.currentRates.superexpo, this.currentRates.deadband, this.currentRates.roll_rate_limit);
842+
const pitch = delta * this.rateCurve.rcCommandRawToDegreesPerSecond(FC.RC.channels[1], this.currentRates.pitch_rate, this.currentRates.rc_rate_pitch,
843+
this.currentRates.rc_pitch_expo, this.currentRates.superexpo, this.currentRates.deadband, this.currentRates.pitch_rate_limit);
844+
const yaw = delta * this.rateCurve.rcCommandRawToDegreesPerSecond(FC.RC.channels[2], this.currentRates.yaw_rate, this.currentRates.rc_rate_yaw,
845+
this.currentRates.rc_yaw_expo, this.currentRates.superexpo, this.currentRates.yawDeadband, this.currentRates.yaw_rate_limit);
867846

868847
this.model.rotateBy(-degToRad(pitch), -degToRad(yaw), -degToRad(roll));
869848
}

0 commit comments

Comments
 (0)