Commit 23f5f244 authored by MagoKimbra's avatar MagoKimbra

Del Kc

parent 1a6d824d
...@@ -87,7 +87,31 @@ ...@@ -87,7 +87,31 @@
//********************************************************************** //**********************************************************************
#if !defined(MKR4) /***********************************************************************
*********************** Multiextruder NPr2 ***************************
***********************************************************************
* *
* Setting fot color meccanism NPr2 by NicolaP (www.3dmakerlab.it) *
* *
* Firmware by MagoKimbra magokimbra@hotmail.com *
* *
* Find angle setting by g-Code "M997 Cxxx" *
* *
***********************************************************************/
//#define NPR2
#ifdef NPR2
#define COLOR_STEP {120,25,-65,-155} // CARTER ANGLE
#define COLOR_SLOWRATE 170 // MICROSECOND delay for carter motor routine (Carter Motor Feedrate: upper value-slow feedrate)
#define COLOR_HOMERATE 4 // FEEDRATE for carter home
#define MOTOR_ANGLE 1.8 // Nema angle for single step
#define DRIVER_MICROSTEP 4 // Microstep moltiplicator driver (set jumper MS1-2-3) off-on-off 1/4 microstepping.
#define CARTER_MOLTIPLICATOR 14.22 // CARTER MOLTIPLICATOR (gear ratio 13/31-10/31)
#define DRIVER_EXTRUDERS 2 // This defines the number of Driver extruders
#endif
//**********************************************************************
#if !defined(MKR4) && !defined(NPR2)
#define DRIVER_EXTRUDERS EXTRUDERS // This defines the number of Driver extruders #define DRIVER_EXTRUDERS EXTRUDERS // This defines the number of Driver extruders
#endif #endif
...@@ -515,7 +539,8 @@ ...@@ -515,7 +539,8 @@
#define LCD_UNLOAD_FEEDRATE 8 // mm/s #define LCD_UNLOAD_FEEDRATE 8 // mm/s
#endif #endif
// Show a progress bar on the LCD when printing from SD?
// Show a progress bar on HD44780 LCDs for SD printing
//#define LCD_PROGRESS_BAR //#define LCD_PROGRESS_BAR
#ifdef LCD_PROGRESS_BAR #ifdef LCD_PROGRESS_BAR
// Amount of time (ms) to show the bar // Amount of time (ms) to show the bar
...@@ -526,6 +551,12 @@ ...@@ -526,6 +551,12 @@
#define PROGRESS_BAR_MSG_EXPIRE 0 #define PROGRESS_BAR_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them // Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_BAR_MSG_ONCE //#define PROGRESS_BAR_MSG_ONCE
#ifdef DOGLCD
#warning LCD_PROGRESS_BAR does not apply to graphical displays at this time.
#endif
#ifdef FILAMENT_LCD_DISPLAY
#error LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both.
#endif
#endif #endif
......
...@@ -91,13 +91,7 @@ void Config_StoreSettings() ...@@ -91,13 +91,7 @@ void Config_StoreSettings()
EEPROM_WRITE_VAR(i,Kp); EEPROM_WRITE_VAR(i,Kp);
EEPROM_WRITE_VAR(i,Ki); EEPROM_WRITE_VAR(i,Ki);
EEPROM_WRITE_VAR(i,Kd); EEPROM_WRITE_VAR(i,Kd);
#else #endif // PIDTEMP
float dummy = 3000.0f;
EEPROM_WRITE_VAR(i,dummy);
dummy = 0.0f;
EEPROM_WRITE_VAR(i,dummy);
EEPROM_WRITE_VAR(i,dummy);
#endif
#ifndef DOGLCD #ifndef DOGLCD
int lcd_contrast = 32; int lcd_contrast = 32;
#endif #endif
...@@ -270,12 +264,17 @@ void Config_PrintSettings() ...@@ -270,12 +264,17 @@ void Config_PrintSettings()
#ifdef PIDTEMP #ifdef PIDTEMP
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("PID settings:"); SERIAL_ECHOLNPGM("PID settings:");
SERIAL_ECHO_START; for (int e = 0; e < EXTRUDERS; e++)
SERIAL_ECHOPAIR(" M301 P",Kp[active_extruder]); {
SERIAL_ECHOPAIR(" I" ,unscalePID_i(Ki[active_extruder])); SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" D" ,unscalePID_d(Kd[active_extruder])); SERIAL_ECHOPAIR(" M301 E", (long unsigned int)e);
SERIAL_ECHOLN(""); SERIAL_ECHOPAIR(" P", Kp[e]);
#endif SERIAL_ECHOPAIR(" I" ,unscalePID_i(Ki[e]));
SERIAL_ECHOPAIR(" D" ,unscalePID_d(Kd[e]));
SERIAL_ECHOLN("");
}
#endif // PIDTEMP
#ifdef FWRETRACT #ifdef FWRETRACT
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Retract: S=Length (mm) F:Speed (mm/m) Z: ZLift (mm)"); SERIAL_ECHOLNPGM("Retract: S=Length (mm) F:Speed (mm/m) Z: ZLift (mm)");
...@@ -391,13 +390,14 @@ void Config_RetrieveSettings() ...@@ -391,13 +390,14 @@ void Config_RetrieveSettings()
EEPROM_READ_VAR(i,gumPreheatHotendTemp); EEPROM_READ_VAR(i,gumPreheatHotendTemp);
EEPROM_READ_VAR(i,gumPreheatHPBTemp); EEPROM_READ_VAR(i,gumPreheatHPBTemp);
EEPROM_READ_VAR(i,gumPreheatFanSpeed); EEPROM_READ_VAR(i,gumPreheatFanSpeed);
#ifndef PIDTEMP
float Kp,Ki,Kd; #ifdef PIDTEMP
#endif
// do not need to scale PID values as the values in EEPROM are already scaled // do not need to scale PID values as the values in EEPROM are already scaled
EEPROM_READ_VAR(i,Kp); EEPROM_READ_VAR(i,Kp);
EEPROM_READ_VAR(i,Ki); EEPROM_READ_VAR(i,Ki);
EEPROM_READ_VAR(i,Kd); EEPROM_READ_VAR(i,Kd);
#endif // PIDTEMP
#ifndef DOGLCD #ifndef DOGLCD
int lcd_contrast; int lcd_contrast;
#endif #endif
...@@ -461,7 +461,7 @@ void Config_ResetDefault() ...@@ -461,7 +461,7 @@ void Config_ResetDefault()
float tmp5[]=DEFAULT_Kp; float tmp5[]=DEFAULT_Kp;
float tmp6[]=DEFAULT_Ki; float tmp6[]=DEFAULT_Ki;
float tmp7[]=DEFAULT_Kd; float tmp7[]=DEFAULT_Kd;
#endif #endif // PIDTEMP
for (short i=0;i<7;i++) for (short i=0;i<7;i++)
{ {
...@@ -517,6 +517,8 @@ void Config_ResetDefault() ...@@ -517,6 +517,8 @@ void Config_ResetDefault()
lcd_contrast = DEFAULT_LCD_CONTRAST; lcd_contrast = DEFAULT_LCD_CONTRAST;
#endif #endif
#ifdef PIDTEMP #ifdef PIDTEMP
// call updatePID (similar to when we have processed M301)
updatePID();
for (short i=0;i<4;i++) for (short i=0;i<4;i++)
{ {
#ifdef SINGLENOZZLE #ifdef SINGLENOZZLE
...@@ -528,14 +530,8 @@ void Config_ResetDefault() ...@@ -528,14 +530,8 @@ void Config_ResetDefault()
Ki[i] = scalePID_i(tmp6[i]); Ki[i] = scalePID_i(tmp6[i]);
Kd[i] = scalePID_d(tmp7[i]); Kd[i] = scalePID_d(tmp7[i]);
#endif #endif
} }
// call updatePID (similar to when we have processed M301)
updatePID();
#ifdef PID_ADD_EXTRUSION_RATE
Kc = DEFAULT_Kc;
#endif//PID_ADD_EXTRUSION_RATE
#endif//PIDTEMP #endif//PIDTEMP
#ifdef FWRETRACT #ifdef FWRETRACT
......
...@@ -28,16 +28,6 @@ ...@@ -28,16 +28,6 @@
//#define WATCH_TEMP_PERIOD 40000 //40 seconds //#define WATCH_TEMP_PERIOD 40000 //40 seconds
//#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds //#define WATCH_TEMP_INCREASE 10 //Heat up at least 10 degree in 20 seconds
#ifdef PIDTEMP
// 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.
#define PID_ADD_EXTRUSION_RATE
#ifdef PID_ADD_EXTRUSION_RATE
#define DEFAULT_Kc (1) //heating power=Kc*(e_speed)
#endif
#endif
//automatic temperature: The hot end target temperature is calculated by all the buffered lines of gcode. //automatic temperature: The hot end target temperature is calculated by all the buffered lines of gcode.
//The maximum buffered steps/sec of the extruder motor are called "se". //The maximum buffered steps/sec of the extruder motor are called "se".
//You enter the autotemp mode by a M109 S<mintemp> B<maxtemp> F<factor> //You enter the autotemp mode by a M109 S<mintemp> B<maxtemp> F<factor>
......
...@@ -4497,28 +4497,35 @@ Sigma_Exit: ...@@ -4497,28 +4497,35 @@ Sigma_Exit:
#ifdef PIDTEMP #ifdef PIDTEMP
case 301: // M301 case 301: // M301
{ {
if(code_seen('P')) Kp[active_extruder] = code_value(); // multi-extruder PID patch: M301 updates or prints a single extruder's PID values
if(code_seen('I')) Ki[active_extruder] = scalePID_i(code_value()); // default behaviour (omitting E parameter) is to update for extruder 0 only
if(code_seen('D')) Kd[active_extruder] = scalePID_d(code_value()); int e = 0; // extruder being updated
if (code_seen('E'))
#ifdef PID_ADD_EXTRUSION_RATE {
if(code_seen('C')) Kc = code_value(); e = (int)code_value();
#endif }
if (e < EXTRUDERS) // catch bad input value
updatePID(); {
SERIAL_PROTOCOL(MSG_OK); if (code_seen('P')) Kp[e] = code_value();
SERIAL_PROTOCOL(" p:"); if (code_seen('I')) Ki[e] = scalePID_i(code_value());
SERIAL_PROTOCOL(Kp[active_extruder]); if (code_seen('D')) Kd[e] = scalePID_d(code_value());
SERIAL_PROTOCOL(" i:"); updatePID();
SERIAL_PROTOCOL(unscalePID_i(Ki[active_extruder])); SERIAL_PROTOCOL(MSG_OK);
SERIAL_PROTOCOL(" d:"); SERIAL_PROTOCOL(" e:"); // specify extruder in serial output
SERIAL_PROTOCOL(unscalePID_d(Kd[active_extruder])); SERIAL_PROTOCOL(e);
#ifdef PID_ADD_EXTRUSION_RATE SERIAL_PROTOCOL(" p:");
SERIAL_PROTOCOL(" c:"); SERIAL_PROTOCOL(Kp[e]);
//Kc does not have scaling applied above, or in resetting defaults SERIAL_PROTOCOL(" i:");
SERIAL_PROTOCOL(Kc); SERIAL_PROTOCOL(unscalePID_i(Ki[e]));
#endif SERIAL_PROTOCOL(" d:");
SERIAL_PROTOCOLLN(""); SERIAL_PROTOCOL(unscalePID_d(Kd[e]));
SERIAL_PROTOCOLLN("");
}
else
{
SERIAL_ECHO_START;
SERIAL_ECHOLN(MSG_INVALID_EXTRUDER);
}
} }
break; break;
#endif //PIDTEMP #endif //PIDTEMP
......
This diff is collapsed.
...@@ -79,7 +79,6 @@ ...@@ -79,7 +79,6 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_ACC "Acel" #define MSG_ACC "Acel"
#define MSG_VXY_JERK "Vxy-jerk" #define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk" #define MSG_VZ_JERK "Vz-jerk"
......
...@@ -66,7 +66,6 @@ ...@@ -66,7 +66,6 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_ACC "Accel" #define MSG_ACC "Accel"
#define MSG_VXY_JERK "Vxy-jerk" #define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk" #define MSG_VZ_JERK "Vz-jerk"
......
...@@ -79,7 +79,6 @@ ...@@ -79,7 +79,6 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_ACC "Acc" #define MSG_ACC "Acc"
#define MSG_VXY_JERK "Vxy-jerk" #define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk" #define MSG_VZ_JERK "Vz-jerk"
......
...@@ -79,7 +79,6 @@ ...@@ -79,7 +79,6 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_ACC "Accel" #define MSG_ACC "Accel"
#define MSG_VXY_JERK "Vxy-jerk" #define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk" #define MSG_VZ_JERK "Vz-jerk"
......
...@@ -66,7 +66,6 @@ ...@@ -66,7 +66,6 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_ACC "Acel" #define MSG_ACC "Acel"
#define MSG_VXY_JERK "Vxy-jerk" #define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk" #define MSG_VZ_JERK "Vz-jerk"
......
...@@ -66,7 +66,6 @@ ...@@ -66,7 +66,6 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_ACC "Azelerazioa" #define MSG_ACC "Azelerazioa"
#define MSG_VXY_JERK "Vxy-astindua" #define MSG_VXY_JERK "Vxy-astindua"
#define MSG_VZ_JERK "Vz-astindua" #define MSG_VZ_JERK "Vz-astindua"
......
...@@ -79,7 +79,6 @@ ...@@ -79,7 +79,6 @@
#define MSG_PID_P "PID-P" #define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I" #define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D" #define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_ACC "Accel" #define MSG_ACC "Accel"
#define MSG_VXY_JERK "Vxy-jerk" #define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk" #define MSG_VZ_JERK "Vz-jerk"
......
...@@ -60,9 +60,6 @@ float current_temperature_bed = 0.0; ...@@ -60,9 +60,6 @@ float current_temperature_bed = 0.0;
float Kp[4]; float Kp[4];
float Ki[4]; float Ki[4];
float Kd[4]; float Kd[4];
#ifdef PID_ADD_EXTRUSION_RATE
float Kc;
#endif
#endif //PIDTEMP #endif //PIDTEMP
#ifdef PIDTEMPBED #ifdef PIDTEMPBED
......
...@@ -23,9 +23,7 @@ ...@@ -23,9 +23,7 @@
#include "Marlin.h" #include "Marlin.h"
#include "planner.h" #include "planner.h"
#ifdef PID_ADD_EXTRUSION_RATE
#include "stepper.h"
#endif
// public functions // public functions
void tp_init(); //initialize the heating void tp_init(); //initialize the heating
...@@ -68,7 +66,7 @@ extern float current_temperature_bed; ...@@ -68,7 +66,7 @@ extern float current_temperature_bed;
#endif #endif
#ifdef PIDTEMP #ifdef PIDTEMP
extern float Kp[4],Ki[4],Kd[4],Kc; extern float Kp[4],Ki[4],Kd[4];
float scalePID_i(float i); float scalePID_i(float i);
float scalePID_d(float d); float scalePID_d(float d);
float unscalePID_i(float i); float unscalePID_i(float i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment