@@ -8,17 +8,16 @@ class PID
88
99 public:
1010
11- // Constants used in some of the functions below
12- #define AUTOMATIC 1
13- #define MANUAL 0
14- #define DIRECT 0
15- #define REVERSE 1
11+ // Parameter types for some of the functions below
12+ enum mode_t { AUTOMATIC = 1 , MANUAL = 0 };
13+ enum direction_t { DIRECT = 0 , REVERSE = 1 };
1614
1715 // commonly used functions **************************************************************************
1816 PID (double *, double *, double *, // * constructor. links the PID to the Input, Output, and
19- double , double , double , int ); // Setpoint. Initial tuning parameters are also set here
17+ double , double , double , // Setpoint. Initial tuning parameters are also set here
18+ direction_t );
2019
21- void SetMode (int Mode ); // * sets PID to either Manual (0) or Auto (non-0 )
20+ void SetMode (mode_t ); // * sets PID to either MANUAL (0) or AUTOMATIC (1 )
2221
2322 bool Compute (); // * performs the PID calculation. it should be
2423 // called every time loop() cycles. ON/OFF and
@@ -35,8 +34,8 @@ class PID
3534 void SetTunings (double , double , // * While most users will set the tunings once in the
3635 double ); // constructor, this function gives the user the option
3736 // of changing tunings during runtime for Adaptive control
38- void SetControllerDirection (int ); // * Sets the Direction, or "Action" of the controller. DIRECT
39- // means the output will increase when error is positive. REVERSE
37+ void SetControllerDirection ( // * Sets the Direction, or "Action" of the controller. DIRECT
38+ direction_t ); // means the output will increase when error is positive. REVERSE
4039 // means the opposite. it's very unlikely that this will be needed
4140 // once it is set in the constructor.
4241 void SetSampleTime (int ); // * sets the frequency, in Milliseconds, with which
0 commit comments