Skip to content

Commit 50c2f8b

Browse files
committed
Fix br3ttb#2
1 parent 12697fc commit 50c2f8b

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

QuickPID.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
reliable defaults, so we need to have the user set them.
2020
**********************************************************************************/
2121
QuickPID::QuickPID(int16_t* Input, int16_t* Output, int16_t* Setpoint,
22-
float Kp, float Ki, float Kd, float POn = 1, bool ControllerDirection = 0)
22+
float Kp, float Ki, float Kd, float POn = 1, uint8_t ControllerDirection = 0)
2323
{
2424
myOutput = Output;
2525
myInput = Input;
@@ -41,7 +41,7 @@ QuickPID::QuickPID(int16_t* Input, int16_t* Output, int16_t* Setpoint,
4141
**********************************************************************************/
4242

4343
QuickPID::QuickPID(int16_t* Input, int16_t* Output, int16_t* Setpoint,
44-
float Kp, float Ki, float Kd, bool ControllerDirection)
44+
float Kp, float Ki, float Kd, uint8_t ControllerDirection)
4545
: QuickPID::QuickPID(Input, Output, Setpoint, Kp, Ki, Kd, pOn = 1, ControllerDirection = 0)
4646
{
4747

@@ -222,7 +222,7 @@ void QuickPID::SetOutputLimits(int16_t Min, int16_t Max)
222222
when the transition from manual to auto occurs, the controller is
223223
automatically initialized
224224
******************************************************************************/
225-
void QuickPID::SetMode(bool Mode)
225+
void QuickPID::SetMode(uint8_t Mode)
226226
{
227227
bool newAuto = (Mode == AUTOMATIC);
228228
if (newAuto && !inAuto)
@@ -249,7 +249,7 @@ void QuickPID::Initialize()
249249
know which one, because otherwise we may increase the output when we should
250250
be decreasing. This is called from the constructor.
251251
******************************************************************************/
252-
void QuickPID::SetControllerDirection(bool Direction)
252+
void QuickPID::SetControllerDirection(uint8_t Direction)
253253
{
254254
if (inAuto && Direction != controllerDirection)
255255
{
@@ -283,10 +283,10 @@ float QuickPID::GetTu() {
283283
float QuickPID::GetTd() {
284284
return dispTd;
285285
}
286-
bool QuickPID::GetMode() {
286+
uint8_t QuickPID::GetMode() {
287287
return inAuto ? AUTOMATIC : MANUAL;
288288
}
289-
bool QuickPID::GetDirection() {
289+
uint8_t QuickPID::GetDirection() {
290290
return controllerDirection;
291291
}
292292

QuickPID.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ class QuickPID
1818
// commonly used functions ************************************************************************************
1919

2020
// Constructor. Links the PID to Input, Output, Setpoint and initial Tuning Parameters.
21-
QuickPID(int16_t*, int16_t*, int16_t*, float, float, float, float, bool);
21+
QuickPID(int16_t*, int16_t*, int16_t*, float, float, float, float, uint8_t);
2222

2323
// Overload constructor with proportional mode. Links the PID to Input, Output, Setpoint and Tuning Parameters.
24-
QuickPID(int16_t*, int16_t*, int16_t*, float, float, float, bool);
24+
QuickPID(int16_t*, int16_t*, int16_t*, float, float, float, uint8_t);
2525

2626
// Sets PID to either Manual (0) or Auto (non-0).
27-
void SetMode(bool Mode);
27+
void SetMode(uint8_t Mode);
2828

2929
// Performs the PID calculation. It should be called every time loop() cycles. ON/OFF and calculation frequency
3030
// can be set using SetMode and SetSampleTime respectively.
@@ -47,7 +47,7 @@ class QuickPID
4747

4848
// Sets the Direction, or "Action" of control. DIRECT means the output will increase when error is positive.
4949
// REVERSE means the opposite. It's very unlikely that this will be needed once it is set in the constructor.
50-
void SetControllerDirection(bool);
50+
void SetControllerDirection(uint8_t);
5151

5252
// Sets the sample time in milliseconds with which each PID calculation is performed. Default is 100.
5353
void SetSampleTimeUs(uint32_t);
@@ -59,8 +59,8 @@ class QuickPID
5959
float GetKu(); // Ultimate Gain
6060
float GetTu(); // Ultimate Period
6161
float GetTd(); // Dead Time
62-
bool GetMode();
63-
bool GetDirection();
62+
uint8_t GetMode();
63+
uint8_t GetDirection();
6464

6565
// Utility functions ******************************************************************************************
6666
int analogReadFast(int);
@@ -88,7 +88,7 @@ class QuickPID
8888
float kpi; // proportional on error amount
8989
float kpd; // proportional on measurement amount
9090

91-
bool controllerDirection;
91+
uint8_t controllerDirection;
9292

9393
int16_t *myInput; // Pointers to the Input, Output, and Setpoint variables. This creates a
9494
int16_t *myOutput; // hard link between the variables and the PID, freeing the user from having

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "QuickPID",
33
"keywords": "PID, controller, signal",
4-
"description": "A fast fixed/floating point PID controller with AutoTune and 8 tuning rules to choose from. This controller can automatically determine and set tuning parameters. An added feature is contolling the mix of Proportional on Error to Proportional on Measurement.",
4+
"description": "A fast fixed/floating point PID controller with AutoTune and 9 tuning rules to choose from. This controller can automatically determine and set tuning parameters. An added feature is contolling the mix of Proportional on Error to Proportional on Measurement.",
55
"url": "https://github.com/Dlloydev/QuickPID",
66
"include": "QuickPID",
77
"authors":

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name=QuickPID
22
version=2.2.1
33
author=David Lloyd
44
maintainer=David Lloyd <[email protected]>
5-
sentence=A fast fixed/floating point PID controller with AutoTune and 8 tuning rules to choose from.
5+
sentence=A fast fixed/floating point PID controller with AutoTune and 9 tuning rules to choose from.
66
paragraph=This controller can automatically determine and set tuning parameters. An added feature is contolling the mix of Proportional on Error to Proportional on Measurement.
77
category=Signal Input/Output
88
url=https://github.com/Dlloydev/QuickPID

0 commit comments

Comments
 (0)