Skip to content

Commit

Permalink
Added get/set integral fxns
Browse files Browse the repository at this point in the history
  • Loading branch information
r-downing committed Mar 4, 2018
1 parent d8c8c34 commit fea6b99
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode*
8 changes: 8 additions & 0 deletions AutoPID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ bool AutoPID::isStopped(){
return _stopped;
}

double AutoPID::getIntegral(){
return _integral;
}

void AutoPID::setIntegral(double integral){
_integral = integral;
}

void AutoPIDRelay::run() {
AutoPID::run();
while ((millis() - _lastPulseTime) > _pulseWidth) _lastPulseTime += _pulseWidth;
Expand Down
3 changes: 3 additions & 0 deletions AutoPID.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ class AutoPID {
void reset();
bool isStopped();

double getIntegral();
void setIntegral(double integral);

private:
double _Kp, _Ki, _Kd;
double _integral, _previousError;
Expand Down
2 changes: 2 additions & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ atSetPoint KEYWORD2
run KEYWORD2
stop KEYWORD2
reset KEYWORD2
setIntegral KEYWORD2
getIntegral KEYWORD2

#######################################
# Constants (LITERAL1)
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=AutoPID
version=1.0.2
version=1.0.3
author=Ryan Downing
maintainer=Ryan Downing
sentence=Automatic PID controller
Expand Down

0 comments on commit fea6b99

Please sign in to comment.