From 9e4c84441709d207f3ce05bd1f8f22ca1334d525 Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Thu, 14 Apr 2022 15:31:12 +0200 Subject: [PATCH] [chore] remove_duplicates from receiver tab --- src/js/tabs/receiver.js | 41 ++++++++++------------------------------- 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/src/js/tabs/receiver.js b/src/js/tabs/receiver.js index 3b0e894401..8c817af04a 100644 --- a/src/js/tabs/receiver.js +++ b/src/js/tabs/receiver.js @@ -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; } @@ -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)); }