Skip to content

Commit 6be0fbe

Browse files
committed
Added MIT license, POn default = 1
1 parent a59ea08 commit 6be0fbe

File tree

11 files changed

+41
-18
lines changed

11 files changed

+41
-18
lines changed

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright 2011-2017 Brett Beauregard <[email protected]> brettbeauregard.com
2+
Copyright 2021 David Lloyd <[email protected]>
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of
5+
this software and associated documentation files (the "Software"), to deal in
6+
the Software without restriction, including without limitation the rights to
7+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8+
the Software, and to permit persons to whom the Software is furnished to do so,
9+
subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all
12+
copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

QuickPID.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**********************************************************************************
2-
QuickPID Library for Arduino - Version 2.0.4
2+
QuickPID Library for Arduino - Version 2.0.5
33
by dlloydev https://github.com/Dlloydev/QuickPID
44
Based on the Arduino PID Library by Brett Beauregard
55
@@ -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, bool ControllerDirection)
22+
float Kp, float Ki, float Kd, float POn = 1, bool ControllerDirection = 0)
2323
{
2424
myOutput = Output;
2525
myInput = Input;
@@ -28,6 +28,7 @@ QuickPID::QuickPID(int16_t* Input, int16_t* Output, int16_t* Setpoint,
2828

2929
QuickPID::SetOutputLimits(0, 255); // default is same as the arduino PWM limit
3030
SampleTimeUs = 100000; // default is 0.1 seconds
31+
3132
QuickPID::SetControllerDirection(ControllerDirection);
3233
QuickPID::SetTunings(Kp, Ki, Kd, POn);
3334

@@ -41,7 +42,7 @@ QuickPID::QuickPID(int16_t* Input, int16_t* Output, int16_t* Setpoint,
4142

4243
QuickPID::QuickPID(int16_t* Input, int16_t* Output, int16_t* Setpoint,
4344
float Kp, float Ki, float Kd, bool ControllerDirection)
44-
: QuickPID::QuickPID(Input, Output, Setpoint, Kp, Ki, Kd, POn, ControllerDirection)
45+
: QuickPID::QuickPID(Input, Output, Setpoint, Kp, Ki, Kd, pOn = 1, ControllerDirection = 0)
4546
{
4647

4748
}
@@ -85,12 +86,11 @@ bool QuickPID::Compute()
8586
it's called automatically from the constructor, but tunings can also
8687
be adjusted on the fly during normal operation
8788
******************************************************************************/
88-
void QuickPID::SetTunings(float Kp, float Ki, float Kd, float POn)
89+
void QuickPID::SetTunings(float Kp, float Ki, float Kd, float POn = 1)
8990
{
9091
if (Kp < 0 || Ki < 0 || Kd < 0) return;
9192

9293
pOn = POn;
93-
9494
dispKp = Kp; dispKi = Ki; dispKd = Kd;
9595

9696
float SampleTimeSec = (float)SampleTimeUs / 1000000;
@@ -112,7 +112,7 @@ void QuickPID::SetTunings(float Kp, float Ki, float Kd, float POn)
112112
Set Tunings using the last remembered POn setting.
113113
******************************************************************************/
114114
void QuickPID::SetTunings(float Kp, float Ki, float Kd) {
115-
SetTunings(Kp, Ki, Kd, POn);
115+
SetTunings(Kp, Ki, Kd, pOn);
116116
}
117117

118118
/* SetSampleTime(...) *********************************************************

QuickPID.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class QuickPID
6969
float dispKi;
7070
float dispKd;
7171

72-
float pOn; // proportional mode (0-1) default 1 (100% on Error, 0% on Measurement)
72+
float pOn; // proportional mode (0-1) default = 1, 100% Proportional on Error
7373
float kp; // (P)roportional Tuning Parameter
7474
float ki; // (I)ntegral Tuning Parameter
7575
float kd; // (D)erivative Tuning Parameter

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ QuickPID::QuickPID(int16_t* Input, int16_t* Output, int16_t* Setpoint,
5656
5757
- `Input`, `Output`, and `Setpoint` are pointers to the variables holding these values.
5858
- `Kp`, `Ki`, and `Kd` are the PID proportional, integral, and derivative gains.
59-
- `POn` is the Proportional on Error weighting value (0.0-1.0). This controls the mix of Proportional on Error (PonE) and Proportional on Measurement (PonM) that's used in the compute algorithm. Note that POn controls the PonE amount, where the remainder (1-PonE) is the PonM amount. Also, the default POn is 0 (100% PonM, 0% PonE).
59+
- `POn` is the Proportional on Error weighting value (0.0-1.0). This controls the mix of Proportional on Error (PonE) and Proportional on Measurement (PonM) that's used in the compute algorithm. Note that POn controls the PonE amount, where the remainder (1-PonE) is the PonM amount. Also, the default POn is 1
6060
6161
![POn](https://user-images.githubusercontent.com/63488701/104958919-fe3c4680-599e-11eb-851e-73f26291d3e5.gif)
6262
@@ -164,6 +164,11 @@ A faster configuration of `analogRead()`where a preset of 32 is used. Works with
164164
165165
### Change Log
166166
167+
#### Version 2.0.5 (latest)
168+
169+
- Added MIT license text file
170+
- POn defaults to 1
171+
167172
#### Version 2.0.4
168173
169174
- Added `QuickPID_AdaptiveTunings.ino`, `QuickPID_Basic.ino`, `QuickPID_PonM.ino` and `QuickPID_RelayOutput.ino` to the examples folder.

examples/QuickPID_AdaptiveTunings/QuickPID_AdaptiveTunings.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Parameters when we're farther away.
1010
********************************************************/
1111

12-
#include <QuickPID.h>
12+
#include "QuickPID.h"
1313

1414
#define PIN_INPUT 0
1515
#define PIN_OUTPUT 3

examples/QuickPID_Basic/QuickPID_Basic.ino

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Reading analog input 0 to control analog PWM output 3
44
********************************************************/
55

6-
#include <QuickPID.h>
6+
#include "QuickPID.h"
77

88
#define PIN_INPUT 0
99
#define PIN_OUTPUT 3
@@ -13,9 +13,8 @@ int Setpoint, Input, Output;
1313

1414
//Specify the links and initial tuning parameters
1515
float Kp = 2, Ki = 5, Kd = 1;
16-
float POn = 1.0; // Range is 0.0 to 1.0 (1.0 is 100% P on Error, 0% P on Measurement)
1716

18-
QuickPID myQuickPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, POn, DIRECT);
17+
QuickPID myQuickPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);
1918

2019
void setup()
2120
{

examples/QuickPID_PonM/QuickPID_PonM.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
in certain processes like sous-vides.
77
********************************************************/
88

9-
#include <QuickPID.h>
9+
#include "QuickPID.h"
1010

1111
//Define Variables we'll be connecting to
1212
int Setpoint, Input, Output;

examples/QuickPID_RC_Filter/QuickPID_RC_Filter.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
https://github.com/Dlloydev/QuickPID/wiki/QuickPID_RC_Filter
77
**************************************************************/
88

9-
#include <QuickPID.h>
9+
#include "QuickPID.h"
1010

1111
#define PIN_INPUT 0
1212
#define PIN_OUTPUT 3

examples/QuickPID_RelayOutput/QuickPID_RelayOutput.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
be on for a minimum amount of time.
1717
********************************************************/
1818

19-
#include <QuickPID.h>
19+
#include "QuickPID.h"
2020

2121
#define PIN_INPUT 0
2222
#define RELAY_PIN 6

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": "QuickPID controller - a faster implementation of the Arduino PID Library with more features. This hybrid fixed/floating point controller seeks to keep an output close to a desired setpoint by adjusting four parameters (P,I,D) and POn (PonE, PonM setpoint weighting).",
4+
"description": "QuickPID controller - a faster implementation of the Arduino PID Library with more features. This hybrid fixed/floating point controller seeks to keep an output close to a desired setpoint by adjusting four parameters (P,I,D) and proportional setpoint weighting (POn).",
55
"url": "https://github.com/Dlloydev/QuickPID",
66
"include": "QuickPID",
77
"authors":

0 commit comments

Comments
 (0)