From 752c32b81701a5a9cf7beacb00e1294b6708d85f Mon Sep 17 00:00:00 2001 From: ChrisRosser <41840611+ChrisRosser@users.noreply.github.com> Date: Sat, 6 Apr 2024 18:34:10 +0100 Subject: [PATCH] Update pid_tuning.js --- src/js/tabs/pid_tuning.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/js/tabs/pid_tuning.js b/src/js/tabs/pid_tuning.js index 521e20e37ee..6ae5bc21ea8 100644 --- a/src/js/tabs/pid_tuning.js +++ b/src/js/tabs/pid_tuning.js @@ -1759,17 +1759,18 @@ pid_tuning.initialize = function (callback) { throttleCurve.width = throttleCurve.height * (throttleCurve.clientWidth / throttleCurve.clientHeight); - const canvasHeight = throttleCurve.height; + const curvescale = throttleLimitType === THROTTLE_LIMIT_TYPES.SCALE ? throttleLimitPercent : 1; + const canvasHeight = throttleCurve.height * curvescale; const canvasWidth = throttleCurve.width; // math magic by englishman - const curvescale = throttleLimitType === THROTTLE_LIMIT_TYPES.SCALE ? throttleLimitPercent : 1; + const midx = canvasWidth * mid; const midxl = midx * 0.5; const midxr = (((canvasWidth - midx) * 0.5) + midx); - const midy = (canvasHeight - (midx * (canvasHeight / canvasWidth))) * curvescale; - const midyl = (canvasHeight - ((canvasHeight - midy) * 0.5 *(expo + 1))) * curvescale; - const midyr = ((midy / 2) * (expo + 1)) * curvescale; + const midy = (canvasHeight - (midx * (canvasHeight / canvasWidth))); + const midyl = (canvasHeight - ((canvasHeight - midy) * 0.5 *(expo + 1))); + const midyr = ((midy / 2) * (expo + 1)); let thrPercent = (FC.RC.channels[3] - 1000) / 1000, thrpos = thrPercent <= mid