I a experiencing difficulty with this, this is the compiling error notice
osPID_Engine.cpp:45:52: error: variable 'tuningRule' must be const in order to be put into read-only section by means of 'attribute((progmem))'
PROGMEM Tuning tuningRule[PID::NO_OVERSHOOT_PID + 1] =
this is the partial code and relevant line, can anyone clue me in .( inexperienced new user)
/**********************************************************************************************
* PID engine with auto tune - Version 2.0.0
*
* original Arduino libraries by Brett Beauregard <br3ttb@gmail.com> brettbeauregard.com
* adapted by Tom Price <magicsmoke@tomprice.net> http://smokedprojects.blogspot.com
*
* This Library is licensed under a GPLv3 License
**********************************************************************************************/
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "osPID_Engine.h"
// prototype definitions
extern ospDecimalValue<1> manualOutput;
extern ospDecimalValue<3> PGain;
extern ospDecimalValue<3> IGain;
extern ospDecimalValue<3> DGain;
extern void markSettingsDirty();
extern void setOutputToManualOutput();
// source of Tyreus-Luyben and Ciancone-Marlin rules:
// "Autotuning of PID Controllers: A Relay Feedback Approach",
// by Cheng-Ching Yu, 2nd Edition, p.18
// Tyreus-Luyben is more conservative than Ziegler-Nichols
// and is preferred for lag dominated processes
// Ciancone-Marlin is preferred for delay dominated processes
// Ziegler-Nichols is intended for best disturbance rejection
// can lack robustness especially for lag dominated processes
// source for Pessen Integral, Some Overshoot, and No Overshoot rules:
// "Rule-Based Autotuning Based on Frequency Domain Identification"
// by Anthony S. McCormack and Keith R. Godfrey
// IEEE Transactions on Control Systems Technology, vol 6 no 1, January 1998.
// as reported on http://www.mstarlabs.com/control/znrule.html
// order must be match enumerated type for auto tune methods
PROGMEM Tuning tuningRule[PID::NO_OVERSHOOT_PID + 1] =
{
{ { 44, 24, 0 } }, // ZIEGLER_NICHOLS_PI
{ { 34, 40, 160 } }, // ZIEGLER_NICHOLS_PID
{ { 64, 9, 0 } }, // TYREUS_LUYBEN_PI
{ { 44, 9, 126 } }, // TYREUS_LUYBEN_PID
{ { 66, 80, 0 } }, // CIANCONE_MARLIN_PI
{ { 66, 88, 162 } }, // CIANCONE_MARLIN_PID
{ { 28, 50, 133 } }, // PESSEN_INTEGRAL_PID
{ { 60, 40, 60 } }, // SOME_OVERSHOOT_PID
{ { 100, 40, 60 } } // NO_OVERSHOOT_PID
};
/*Constructor (...)*********************************************************
* The parameters specified here are those for for which we can't set up
* reliable defaults, so we need to have the user set them.
***************************************************************************/
PID::PID(double* Input, double* Output, double* Setpoint,
ospDecimalValue<3> Kp, ospDecimalValue<3> Ki, ospDecimalValue<3> Kd, byte ControllerDirection)
{
// default output limit corresponds to
// the arduino pwm limits
PID::setOutputLimits(0, 255);
// default Controller Sample Time is 0.1 seconds
sampleTime = DEFAULT_LOOP_SAMPLE_TIME;
// set PID parameters
myOutput = Output;
myInput = Input;
mySetpoint = Setpoint;
setTunings(Kp, Ki, Kd);
controllerDirection = ControllerDirection;
// initialize internal variables
lastTime = millis() - (unsigned long) sampleTime;
isTuning = false;
}
/* compute() **********************************************************************
* This, as they say, is where the magic happens. this function should be called
* every time "void loop()" executes. the function will decide for itself whether a new
* pid Output needs to be computed
**********************************************************************************/
void PID::compute()
{
// is it time yet
unsigned long now = millis();
unsigned long timeChange = (now - lastTime);
if (timeChange < (unsigned long) sampleTime)
{