diff --git a/PID_Timed.h b/PID_Timed.h index 5a8f39a..aff4467 100644 --- a/PID_Timed.h +++ b/PID_Timed.h @@ -1,5 +1,4 @@ -#ifndef PID_Timed_h -#define PID_Timed_h +#pragma once #define LIBRARY_VERSION 1.1.1 class PID @@ -9,10 +8,14 @@ class PID public: //Constants used in some of the functions below - #define DIRECT 0 - #define REVERSE 1 - #define P_ON_M 0 - #define P_ON_E 1 + //#define DIRECT 0 + //#define REVERSE 1 + //#define P_ON_M 0 + //#define P_ON_E 1 + static const int8_t DIRECT = 0; + static const int8_t REVERSE = 1; + static const int8_t P_ON_M = 0; + static const int8_t P_ON_E = 1; //commonly used functions ************************************************************************** PID(double*, double*, double*, // * constructor. links the PID to the Input, Output, and @@ -80,5 +83,4 @@ class PID double ReferenceSampleTime; double outMin, outMax; bool inAuto, pOnE; -}; -#endif +}; \ No newline at end of file diff --git a/README.md b/README.md index 40177b9..5be6f36 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ double Setpoint, Input, Output; //Specify the links and initial tuning parameters double Kp=2, Ki=5, Kd=1; -PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, 0.03, DIRECT); // 30 msec target average sampling rate +PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, 0.03, PID::DIRECT); // 30 msec target average sampling rate void setup() { diff --git a/examples/PID_Basic/PID_Basic.ino b/examples/PID_Basic/PID_Basic.ino index d910592..e721a99 100644 --- a/examples/PID_Basic/PID_Basic.ino +++ b/examples/PID_Basic/PID_Basic.ino @@ -13,7 +13,7 @@ double Setpoint, Input, Output; //Specify the links and initial tuning parameters double Kp=2, Ki=5, Kd=1; -PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, 0.03, DIRECT); // 30 msec target average sampling rate +PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, 0.03, PID::DIRECT); // 30 msec target average sampling rate void setup() { diff --git a/library.properties b/library.properties index 8b017ae..68e3c0b 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=PID_Timed -version=1.0.1 +version=1.1.0 author=Ilia O., Brett Beauregard maintainer=Ilia O. sentence=PID controller with non-uniform time sampling