From 79e5cc533a51888466ef543fb8a1cb08e63714e3 Mon Sep 17 00:00:00 2001 From: Isaac Rodman Date: Tue, 3 Aug 2021 18:02:43 -0700 Subject: [PATCH] Update PID_v1.cpp Don't need ```else output = 0``` because it becomes the default case during variable assignment ```double output = 0;```, if ```(!pOnE)``` --- PID_v1.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PID_v1.cpp b/PID_v1.cpp index cb6637c..cbc7a70 100644 --- a/PID_v1.cpp +++ b/PID_v1.cpp @@ -75,9 +75,8 @@ bool PID::Compute() else if(outputSum < outMin) outputSum= outMin; /*Add Proportional on Error, if P_ON_E is specified*/ - double output; + double output = 0; if(pOnE) output = kp * error; - else output = 0; /*Compute Rest of PID Output*/ output += outputSum - kd * dInput;