Make multiple PID parameters a config option

* Adds config parameter `PID_PARAMS_PER_EXTRUDER` - allows single PID
parameters to be used where this would be preferable (e.g. dual
identical extruders)
* When disabled, will use `float Kp, Ki, Kd, Kc;` as before.
Preprocessor macros used to switch between.
* ultralcd.cpp defines extra menus for extra parameters only where
required
* M301 reports `e:xx` only if independent pid parameters enabled
* EEPROM structure still leaves space for 3 extruders worth, when undef
will save single parameter to all extruder positions, but only read the
first
* Switching off saves approx 330 B with no LCD enabled, 2634B with LCD
(RRD) enabled: this is significant.
* LCD modifications should be tested.
This commit is contained in:
grob6000
2015-01-11 13:50:17 +11:00
parent 0877aa0fe0
commit bf2c923db5
6 changed files with 96 additions and 70 deletions

View File

@ -58,7 +58,14 @@ extern float current_temperature_bed;
#endif
#ifdef PIDTEMP
extern float Kp[EXTRUDERS], Ki[EXTRUDERS], Kd[EXTRUDERS], Kc[EXTRUDERS];
#ifdef PID_PARAMS_PER_EXTRUDER
extern float Kp[EXTRUDERS], Ki[EXTRUDERS], Kd[EXTRUDERS], Kc[EXTRUDERS]; // one param per extruder
#define PID_PARAM(param,e) param[e] // use macro to point to array value
#else
extern float Kp, Ki, Kd, Kc; // one param per extruder - saves 20 or 36 bytes of ram (inc array pointer)
#define PID_PARAM(param, e) param // use macro to point directly to value
#endif // PID_PARAMS_PER_EXTRUDER
float scalePID_i(float i);
float scalePID_d(float d);
float unscalePID_i(float i);