Skip to content

Commit

Permalink
Merge pull request #2896 from haslinghuis/remove_duplicates
Browse files Browse the repository at this point in the history
[chore] remove_duplicates from receiver tab
  • Loading branch information
limonspb committed Apr 15, 2022
2 parents 31aebea + 9e4c844 commit fa662d2
Showing 1 changed file with 10 additions and 31 deletions.
41 changes: 10 additions & 31 deletions src/js/tabs/receiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -816,10 +816,10 @@ TABS.receiver.initModelPreview = function () {
this.model = new Model($('.model_preview'), $('.model_preview canvas'));

let useOldRateCurve = false;
if (FC.CONFIG.flightControllerIdentifier === 'CLFL' && semver.lt(FC.CONFIG.apiVersion, '2.0.0')) {
useOldRateCurve = true;
}
if (FC.CONFIG.flightControllerIdentifier === 'BTFL' && semver.lt(FC.CONFIG.flightControllerVersion, '2.8.0')) {
const cleanFlight = FC.CONFIG.flightControllerIdentifier === 'CLFL' && semver.lt(FC.CONFIG.apiVersion, '2.0.0');
const betaFlight = FC.CONFIG.flightControllerIdentifier === 'BTFL' && semver.lt(FC.CONFIG.flightControllerVersion, '2.8.0');

if (cleanFlight || betaFlight) {
useOldRateCurve = true;
}

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

const roll = delta * this.rateCurve.rcCommandRawToDegreesPerSecond(
FC.RC.channels[0],
this.currentRates.roll_rate,
this.currentRates.rc_rate,
this.currentRates.rc_expo,
this.currentRates.superexpo,
this.currentRates.deadband,
this.currentRates.roll_rate_limit,
);
const pitch = delta * this.rateCurve.rcCommandRawToDegreesPerSecond(
FC.RC.channels[1],
this.currentRates.pitch_rate,
this.currentRates.rc_rate_pitch,
this.currentRates.rc_pitch_expo,
this.currentRates.superexpo,
this.currentRates.deadband,
this.currentRates.pitch_rate_limit,
);
const yaw = delta * this.rateCurve.rcCommandRawToDegreesPerSecond(
FC.RC.channels[2],
this.currentRates.yaw_rate,
this.currentRates.rc_rate_yaw,
this.currentRates.rc_yaw_expo,
this.currentRates.superexpo,
this.currentRates.yawDeadband,
this.currentRates.yaw_rate_limit,
);
const roll = delta * this.rateCurve.rcCommandRawToDegreesPerSecond(FC.RC.channels[0], this.currentRates.roll_rate, this.currentRates.rc_rate, this.currentRates.rc_expo,
this.currentRates.superexpo, this.currentRates.deadband, this.currentRates.roll_rate_limit);
const pitch = delta * this.rateCurve.rcCommandRawToDegreesPerSecond(FC.RC.channels[1], this.currentRates.pitch_rate, this.currentRates.rc_rate_pitch,
this.currentRates.rc_pitch_expo, this.currentRates.superexpo, this.currentRates.deadband, this.currentRates.pitch_rate_limit);
const yaw = delta * this.rateCurve.rcCommandRawToDegreesPerSecond(FC.RC.channels[2], this.currentRates.yaw_rate, this.currentRates.rc_rate_yaw,
this.currentRates.rc_yaw_expo, this.currentRates.superexpo, this.currentRates.yawDeadband, this.currentRates.yaw_rate_limit);

this.model.rotateBy(-degToRad(pitch), -degToRad(yaw), -degToRad(roll));
}
Expand Down

0 comments on commit fa662d2

Please sign in to comment.