Skip to content

Commit

Permalink
Update pid_tuning.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRosser committed Apr 6, 2024
1 parent f7c1287 commit ca4e0e0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/js/tabs/pid_tuning.js
Original file line number Diff line number Diff line change
Expand Up @@ -1725,7 +1725,7 @@ pid_tuning.initialize = function (callback) {
const a = startY + endY - 2 * cpY;
const b = 2 * (cpY - startY);
const c = startY - y;
return a == 0 ? -c / b : ( -b + Math.sqrt(Math.pow(b, 2) - 4 * a * c)) / (2 * a);
return a == 0 ? -c / b : ( -b - Math.sqrt(Math.pow(b, 2) - 4 * a * c)) / (2 * a);
}

/* --- */
Expand Down Expand Up @@ -1768,7 +1768,7 @@ pid_tuning.initialize = function (callback) {
const midxl = midx * 0.5;
const midxr = (((canvasWidth - midx) * 0.5) + midx);
const midy = (canvasHeight - curvescale * (midx * (canvasHeight / canvasWidth)));
const midyl = (canvasHeight - curvescale * ((canvasHeight - midy) * 0.5 *(expo + 1)));
const midyl = (canvasHeight - ((canvasHeight - midy) * 0.5 *(expo + 1)));
const midyr = ((midy / 2) * (expo + 1));
const topy = canvasHeight * (1 - curvescale);

Expand All @@ -1784,7 +1784,7 @@ pid_tuning.initialize = function (callback) {
if (throttleLimitType === THROTTLE_LIMIT_TYPES.CLIP){
const clipPos = throttleLimitPercent <= midy
? getPosfromYBezier(throttleLimitPercent,canvasHeight,midyl, midy)
: getPosfromYBezier(throttleLimitPercent,midy, midyl, 0);
: getPosfromYBezier(throttleLimitPercent,midy, midyl, topy);
let lowerCtrl = getQuadraticCurvePoint(0, canvasHeight, midxl, midyl, midx, midy, clipPos / 2);
let curveClip = getQuadraticCurvePoint(0, canvasHeight, midxl, midyl, midx, midy, clipPos);
if (throttleLimitPercent > midyl){
Expand Down

0 comments on commit ca4e0e0

Please sign in to comment.