Condition update for mode change from manual to auto.

Minor update on the condition of initialization when changing mode. To only detect mode change from manual to auto.
This commit is contained in:
zcx119 2017-02-14 23:38:57 +08:00 committed by GitHub
parent fb095d8cfc
commit 21b19e7ab0

View File

@ -146,7 +146,7 @@ void PID::SetOutputLimits(double Min, double Max)
void PID::SetMode(int Mode) void PID::SetMode(int Mode)
{ {
bool newAuto = (Mode == AUTOMATIC); bool newAuto = (Mode == AUTOMATIC);
if(newAuto == !inAuto) if(newAuto && !inAuto)
{ /*we just went from manual to auto*/ { /*we just went from manual to auto*/
PID::Initialize(); PID::Initialize();
} }