Merge pull request #4486 from thinkyhead/rc_pid_add_extrusion_rate_off

PID_EXTRUSION_SCALING, disabled by default
This commit is contained in:
Scott Lahteine 2016-07-31 18:23:51 -07:00 committed by GitHub
commit 6eed37aafb
25 changed files with 65 additions and 63 deletions

View file

@ -113,8 +113,8 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE //#define PID_EXTRUSION_SCALING
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50 #define LPQ_MAX_LEN 50
#endif #endif

View file

@ -352,7 +352,7 @@ float code_value_temp_diff();
extern FilamentChangeMenuResponse filament_change_menu_response; extern FilamentChangeMenuResponse filament_change_menu_response;
#endif #endif
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
extern int lpq_len; extern int lpq_len;
#endif #endif

View file

@ -531,7 +531,7 @@ static bool send_ok[BUFSIZE];
boolean chdkActive = false; boolean chdkActive = false;
#endif #endif
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
int lpq_len = 20; int lpq_len = 20;
#endif #endif
@ -5671,7 +5671,7 @@ inline void gcode_M226() {
* I[float] Ki term (unscaled) * I[float] Ki term (unscaled)
* D[float] Kd term (unscaled) * D[float] Kd term (unscaled)
* *
* With PID_ADD_EXTRUSION_RATE: * With PID_EXTRUSION_SCALING:
* *
* C[float] Kc term * C[float] Kc term
* L[float] LPQ length * L[float] LPQ length
@ -5686,7 +5686,7 @@ inline void gcode_M226() {
if (code_seen('P')) PID_PARAM(Kp, e) = code_value_float(); if (code_seen('P')) PID_PARAM(Kp, e) = code_value_float();
if (code_seen('I')) PID_PARAM(Ki, e) = scalePID_i(code_value_float()); if (code_seen('I')) PID_PARAM(Ki, e) = scalePID_i(code_value_float());
if (code_seen('D')) PID_PARAM(Kd, e) = scalePID_d(code_value_float()); if (code_seen('D')) PID_PARAM(Kd, e) = scalePID_d(code_value_float());
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
if (code_seen('C')) PID_PARAM(Kc, e) = code_value_float(); if (code_seen('C')) PID_PARAM(Kc, e) = code_value_float();
if (code_seen('L')) lpq_len = code_value_float(); if (code_seen('L')) lpq_len = code_value_float();
NOMORE(lpq_len, LPQ_MAX_LEN); NOMORE(lpq_len, LPQ_MAX_LEN);
@ -5704,7 +5704,7 @@ inline void gcode_M226() {
SERIAL_ECHO(unscalePID_i(PID_PARAM(Ki, e))); SERIAL_ECHO(unscalePID_i(PID_PARAM(Ki, e)));
SERIAL_ECHOPGM(" d:"); SERIAL_ECHOPGM(" d:");
SERIAL_ECHO(unscalePID_d(PID_PARAM(Kd, e))); SERIAL_ECHO(unscalePID_d(PID_PARAM(Kd, e)));
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
SERIAL_ECHOPGM(" c:"); SERIAL_ECHOPGM(" c:");
//Kc does not have scaling applied above, or in resetting defaults //Kc does not have scaling applied above, or in resetting defaults
SERIAL_ECHO(PID_PARAM(Kc, e)); SERIAL_ECHO(PID_PARAM(Kc, e));

View file

@ -730,4 +730,6 @@
#error "HOMING_FEEDRATE is deprecated. Set individual rates with HOMING_FEEDRATE_(XY|Z|E) instead." #error "HOMING_FEEDRATE is deprecated. Set individual rates with HOMING_FEEDRATE_(XY|Z|E) instead."
#elif defined(MANUAL_HOME_POSITIONS) #elif defined(MANUAL_HOME_POSITIONS)
#error "MANUAL_HOME_POSITIONS is deprecated. Set MANUAL_[XYZ]_HOME_POS as-needed instead." #error "MANUAL_HOME_POSITIONS is deprecated. Set MANUAL_[XYZ]_HOME_POS as-needed instead."
#elif defined(PID_ADD_EXTRUSION_RATE)
#error "PID_ADD_EXTRUSION_RATE is now PID_EXTRUSION_SCALING and is DISABLED by default. Are you sure you want to use this option? Please update your configuration."
#endif #endif

View file

@ -290,7 +290,7 @@ void Config_StoreSettings() {
EEPROM_WRITE(PID_PARAM(Kp, e)); EEPROM_WRITE(PID_PARAM(Kp, e));
EEPROM_WRITE(PID_PARAM(Ki, e)); EEPROM_WRITE(PID_PARAM(Ki, e));
EEPROM_WRITE(PID_PARAM(Kd, e)); EEPROM_WRITE(PID_PARAM(Kd, e));
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
EEPROM_WRITE(PID_PARAM(Kc, e)); EEPROM_WRITE(PID_PARAM(Kc, e));
#else #else
dummy = 1.0f; // 1.0 = default kc dummy = 1.0f; // 1.0 = default kc
@ -308,7 +308,7 @@ void Config_StoreSettings() {
} // Hotends Loop } // Hotends Loop
#if DISABLED(PID_ADD_EXTRUSION_RATE) #if DISABLED(PID_EXTRUSION_SCALING)
int lpq_len = 20; int lpq_len = 20;
#endif #endif
EEPROM_WRITE(lpq_len); EEPROM_WRITE(lpq_len);
@ -481,7 +481,7 @@ void Config_RetrieveSettings() {
PID_PARAM(Kp, e) = dummy; PID_PARAM(Kp, e) = dummy;
EEPROM_READ(PID_PARAM(Ki, e)); EEPROM_READ(PID_PARAM(Ki, e));
EEPROM_READ(PID_PARAM(Kd, e)); EEPROM_READ(PID_PARAM(Kd, e));
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
EEPROM_READ(PID_PARAM(Kc, e)); EEPROM_READ(PID_PARAM(Kc, e));
#else #else
EEPROM_READ(dummy); EEPROM_READ(dummy);
@ -496,7 +496,7 @@ void Config_RetrieveSettings() {
for (uint8_t q = MAX_EXTRUDERS * 4; q--;) EEPROM_READ(dummy); // Kp, Ki, Kd, Kc for (uint8_t q = MAX_EXTRUDERS * 4; q--;) EEPROM_READ(dummy); // Kp, Ki, Kd, Kc
#endif // !PIDTEMP #endif // !PIDTEMP
#if DISABLED(PID_ADD_EXTRUSION_RATE) #if DISABLED(PID_EXTRUSION_SCALING)
int lpq_len; int lpq_len;
#endif #endif
EEPROM_READ(lpq_len); EEPROM_READ(lpq_len);
@ -641,11 +641,11 @@ void Config_ResetDefault() {
PID_PARAM(Kp, e) = DEFAULT_Kp; PID_PARAM(Kp, e) = DEFAULT_Kp;
PID_PARAM(Ki, e) = scalePID_i(DEFAULT_Ki); PID_PARAM(Ki, e) = scalePID_i(DEFAULT_Ki);
PID_PARAM(Kd, e) = scalePID_d(DEFAULT_Kd); PID_PARAM(Kd, e) = scalePID_d(DEFAULT_Kd);
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
PID_PARAM(Kc, e) = DEFAULT_Kc; PID_PARAM(Kc, e) = DEFAULT_Kc;
#endif #endif
} }
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
lpq_len = 20; // default last-position-queue size lpq_len = 20; // default last-position-queue size
#endif #endif
#endif // PIDTEMP #endif // PIDTEMP
@ -863,7 +863,7 @@ void Config_PrintSettings(bool forReplay) {
SERIAL_ECHOPAIR(" P", PID_PARAM(Kp, e)); SERIAL_ECHOPAIR(" P", PID_PARAM(Kp, e));
SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, e))); SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, e)));
SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, e))); SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, e)));
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
SERIAL_ECHOPAIR(" C", PID_PARAM(Kc, e)); SERIAL_ECHOPAIR(" C", PID_PARAM(Kc, e));
if (e == 0) SERIAL_ECHOPAIR(" L", lpq_len); if (e == 0) SERIAL_ECHOPAIR(" L", lpq_len);
#endif #endif
@ -878,7 +878,7 @@ void Config_PrintSettings(bool forReplay) {
SERIAL_ECHOPAIR(" M301 P", PID_PARAM(Kp, 0)); // for compatibility with hosts, only echo values for E0 SERIAL_ECHOPAIR(" M301 P", PID_PARAM(Kp, 0)); // for compatibility with hosts, only echo values for E0
SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, 0))); SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, 0)));
SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, 0))); SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, 0)));
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
SERIAL_ECHOPAIR(" C", PID_PARAM(Kc, 0)); SERIAL_ECHOPAIR(" C", PID_PARAM(Kc, 0));
SERIAL_ECHOPAIR(" L", lpq_len); SERIAL_ECHOPAIR(" L", lpq_len);
#endif #endif

View file

@ -113,8 +113,8 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE //#define PID_EXTRUSION_SCALING
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50 #define LPQ_MAX_LEN 50
#endif #endif

View file

@ -113,8 +113,8 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE //#define PID_EXTRUSION_SCALING
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50 #define LPQ_MAX_LEN 50
#endif #endif

View file

@ -113,8 +113,8 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE //#define PID_EXTRUSION_SCALING
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50 #define LPQ_MAX_LEN 50
#endif #endif

View file

@ -113,8 +113,8 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE //#define PID_EXTRUSION_SCALING
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50 #define LPQ_MAX_LEN 50
#endif #endif

View file

@ -119,8 +119,8 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE //#define PID_EXTRUSION_SCALING
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50 #define LPQ_MAX_LEN 50
#endif #endif

View file

@ -113,8 +113,8 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE //#define PID_EXTRUSION_SCALING
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50 #define LPQ_MAX_LEN 50
#endif #endif

View file

@ -113,8 +113,8 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE //#define PID_EXTRUSION_SCALING
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50 #define LPQ_MAX_LEN 50
#endif #endif

View file

@ -113,8 +113,8 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE //#define PID_EXTRUSION_SCALING
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50 #define LPQ_MAX_LEN 50
#endif #endif

View file

@ -113,8 +113,8 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE //#define PID_EXTRUSION_SCALING
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50 #define LPQ_MAX_LEN 50
#endif #endif

View file

@ -113,8 +113,8 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE //#define PID_EXTRUSION_SCALING
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50 #define LPQ_MAX_LEN 50
#endif #endif

View file

@ -113,8 +113,8 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE //#define PID_EXTRUSION_SCALING
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50 #define LPQ_MAX_LEN 50
#endif #endif

View file

@ -113,8 +113,8 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE //#define PID_EXTRUSION_SCALING
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50 #define LPQ_MAX_LEN 50
#endif #endif

View file

@ -113,8 +113,8 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE //#define PID_EXTRUSION_SCALING
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50 #define LPQ_MAX_LEN 50
#endif #endif

View file

@ -118,8 +118,8 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE //#define PID_EXTRUSION_SCALING
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50 #define LPQ_MAX_LEN 50
#endif #endif

View file

@ -113,8 +113,8 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE //#define PID_EXTRUSION_SCALING
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50 #define LPQ_MAX_LEN 50
#endif #endif

View file

@ -113,8 +113,8 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE //#define PID_EXTRUSION_SCALING
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50 #define LPQ_MAX_LEN 50
#endif #endif

View file

@ -113,8 +113,8 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed. // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated. // if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE //#define PID_EXTRUSION_SCALING
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
#define LPQ_MAX_LEN 50 #define LPQ_MAX_LEN 50
#endif #endif

View file

@ -72,14 +72,14 @@ unsigned char Temperature::soft_pwm_bed;
float Temperature::Kp[HOTENDS] = ARRAY_BY_HOTENDS1(DEFAULT_Kp), float Temperature::Kp[HOTENDS] = ARRAY_BY_HOTENDS1(DEFAULT_Kp),
Temperature::Ki[HOTENDS] = ARRAY_BY_HOTENDS1((DEFAULT_Ki) * (PID_dT)), Temperature::Ki[HOTENDS] = ARRAY_BY_HOTENDS1((DEFAULT_Ki) * (PID_dT)),
Temperature::Kd[HOTENDS] = ARRAY_BY_HOTENDS1((DEFAULT_Kd) / (PID_dT)); Temperature::Kd[HOTENDS] = ARRAY_BY_HOTENDS1((DEFAULT_Kd) / (PID_dT));
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
float Temperature::Kc[HOTENDS] = ARRAY_BY_HOTENDS1(DEFAULT_Kc); float Temperature::Kc[HOTENDS] = ARRAY_BY_HOTENDS1(DEFAULT_Kc);
#endif #endif
#else #else
float Temperature::Kp = DEFAULT_Kp, float Temperature::Kp = DEFAULT_Kp,
Temperature::Ki = (DEFAULT_Ki) * (PID_dT), Temperature::Ki = (DEFAULT_Ki) * (PID_dT),
Temperature::Kd = (DEFAULT_Kd) / (PID_dT); Temperature::Kd = (DEFAULT_Kd) / (PID_dT);
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
float Temperature::Kc = DEFAULT_Kc; float Temperature::Kc = DEFAULT_Kc;
#endif #endif
#endif #endif
@ -126,7 +126,7 @@ volatile bool Temperature::temp_meas_ready = false;
Temperature::iTerm[HOTENDS], Temperature::iTerm[HOTENDS],
Temperature::dTerm[HOTENDS]; Temperature::dTerm[HOTENDS];
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
float Temperature::cTerm[HOTENDS]; float Temperature::cTerm[HOTENDS];
long Temperature::last_e_position; long Temperature::last_e_position;
long Temperature::lpq[LPQ_MAX_LEN]; long Temperature::lpq[LPQ_MAX_LEN];
@ -444,7 +444,7 @@ Temperature::Temperature() { }
void Temperature::updatePID() { void Temperature::updatePID() {
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
last_e_position = 0; last_e_position = 0;
#endif #endif
HOTEND_LOOP() { HOTEND_LOOP() {
@ -560,7 +560,7 @@ float Temperature::get_pid_output(int e) {
pid_output = pTerm[HOTEND_INDEX] + iTerm[HOTEND_INDEX] - dTerm[HOTEND_INDEX]; pid_output = pTerm[HOTEND_INDEX] + iTerm[HOTEND_INDEX] - dTerm[HOTEND_INDEX];
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
cTerm[HOTEND_INDEX] = 0; cTerm[HOTEND_INDEX] = 0;
if (_HOTEND_TEST) { if (_HOTEND_TEST) {
long e_position = stepper.position(E_AXIS); long e_position = stepper.position(E_AXIS);
@ -575,7 +575,7 @@ float Temperature::get_pid_output(int e) {
cTerm[HOTEND_INDEX] = (lpq[lpq_ptr] * planner.steps_to_mm[E_AXIS]) * PID_PARAM(Kc, HOTEND_INDEX); cTerm[HOTEND_INDEX] = (lpq[lpq_ptr] * planner.steps_to_mm[E_AXIS]) * PID_PARAM(Kc, HOTEND_INDEX);
pid_output += cTerm[HOTEND_INDEX]; pid_output += cTerm[HOTEND_INDEX];
} }
#endif //PID_ADD_EXTRUSION_RATE #endif // PID_EXTRUSION_SCALING
if (pid_output > PID_MAX) { if (pid_output > PID_MAX) {
if (pid_error[HOTEND_INDEX] > 0) temp_iState[HOTEND_INDEX] -= pid_error[HOTEND_INDEX]; // conditional un-integration if (pid_error[HOTEND_INDEX] > 0) temp_iState[HOTEND_INDEX] -= pid_error[HOTEND_INDEX]; // conditional un-integration
@ -598,7 +598,7 @@ float Temperature::get_pid_output(int e) {
SERIAL_ECHOPAIR(MSG_PID_DEBUG_PTERM, pTerm[HOTEND_INDEX]); SERIAL_ECHOPAIR(MSG_PID_DEBUG_PTERM, pTerm[HOTEND_INDEX]);
SERIAL_ECHOPAIR(MSG_PID_DEBUG_ITERM, iTerm[HOTEND_INDEX]); SERIAL_ECHOPAIR(MSG_PID_DEBUG_ITERM, iTerm[HOTEND_INDEX]);
SERIAL_ECHOPAIR(MSG_PID_DEBUG_DTERM, dTerm[HOTEND_INDEX]); SERIAL_ECHOPAIR(MSG_PID_DEBUG_DTERM, dTerm[HOTEND_INDEX]);
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
SERIAL_ECHOPAIR(MSG_PID_DEBUG_CTERM, cTerm[HOTEND_INDEX]); SERIAL_ECHOPAIR(MSG_PID_DEBUG_CTERM, cTerm[HOTEND_INDEX]);
#endif #endif
SERIAL_EOL; SERIAL_EOL;
@ -949,7 +949,7 @@ void Temperature::init() {
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
temp_iState_min[e] = 0.0; temp_iState_min[e] = 0.0;
temp_iState_max[e] = (PID_INTEGRAL_DRIVE_MAX) / PID_PARAM(Ki, e); temp_iState_max[e] = (PID_INTEGRAL_DRIVE_MAX) / PID_PARAM(Ki, e);
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
last_e_position = 0; last_e_position = 0;
#endif #endif
#endif //PIDTEMP #endif //PIDTEMP
@ -959,7 +959,7 @@ void Temperature::init() {
#endif //PIDTEMPBED #endif //PIDTEMPBED
} }
#if ENABLED(PIDTEMP) && ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PIDTEMP) && ENABLED(PID_EXTRUSION_SCALING)
last_e_position = 0; last_e_position = 0;
#endif #endif

View file

@ -31,7 +31,7 @@
#include "planner.h" #include "planner.h"
#include "thermistortables.h" #include "thermistortables.h"
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#include "stepper.h" #include "stepper.h"
#endif #endif
@ -79,7 +79,7 @@ class Temperature {
#if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1 #if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1
static float Kp[HOTENDS], Ki[HOTENDS], Kd[HOTENDS]; static float Kp[HOTENDS], Ki[HOTENDS], Kd[HOTENDS];
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
static float Kc[HOTENDS]; static float Kc[HOTENDS];
#endif #endif
#define PID_PARAM(param, h) Temperature::param[h] #define PID_PARAM(param, h) Temperature::param[h]
@ -87,7 +87,7 @@ class Temperature {
#else #else
static float Kp, Ki, Kd; static float Kp, Ki, Kd;
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
static float Kc; static float Kc;
#endif #endif
#define PID_PARAM(param, h) Temperature::param #define PID_PARAM(param, h) Temperature::param
@ -149,7 +149,7 @@ class Temperature {
iTerm[HOTENDS], iTerm[HOTENDS],
dTerm[HOTENDS]; dTerm[HOTENDS];
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
static float cTerm[HOTENDS]; static float cTerm[HOTENDS];
static long last_e_position; static long last_e_position;
static long lpq[LPQ_MAX_LEN]; static long lpq[LPQ_MAX_LEN];

View file

@ -1684,7 +1684,7 @@ void kill_screen(const char* lcd_msg) {
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I ELABEL, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E ## eindex); \ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I ELABEL, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E ## eindex); \
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D ELABEL, &raw_Kd, 1, 9990, copy_and_scalePID_d_E ## eindex) MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D ELABEL, &raw_Kd, 1, 9990, copy_and_scalePID_d_E ## eindex)
#if ENABLED(PID_ADD_EXTRUSION_RATE) #if ENABLED(PID_EXTRUSION_SCALING)
#define _PID_MENU_ITEMS(ELABEL, eindex) \ #define _PID_MENU_ITEMS(ELABEL, eindex) \
_PID_BASE_MENU_ITEMS(ELABEL, eindex); \ _PID_BASE_MENU_ITEMS(ELABEL, eindex); \
MENU_ITEM_EDIT(float3, MSG_PID_C ELABEL, &PID_PARAM(Kc, eindex), 1, 9990) MENU_ITEM_EDIT(float3, MSG_PID_C ELABEL, &PID_PARAM(Kc, eindex), 1, 9990)