Skip to content

Commit

Permalink
Namespace cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiaai committed Jan 15, 2024
1 parent 8bd3cf9 commit daba524
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
18 changes: 10 additions & 8 deletions PID_Timed.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef PID_Timed_h
#define PID_Timed_h
#pragma once
#define LIBRARY_VERSION 1.1.1

class PID
Expand All @@ -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
Expand Down Expand Up @@ -80,5 +83,4 @@ class PID
double ReferenceSampleTime;
double outMin, outMax;
bool inAuto, pOnE;
};
#endif
};
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
2 changes: 1 addition & 1 deletion examples/PID_Basic/PID_Basic.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit daba524

Please sign in to comment.