Commit 23f5f244 authored by MagoKimbra's avatar MagoKimbra

Del Kc

parent 1a6d824d
......@@ -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
#endif
......@@ -515,7 +539,8 @@
#define LCD_UNLOAD_FEEDRATE 8 // mm/s
#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
#ifdef LCD_PROGRESS_BAR
// Amount of time (ms) to show the bar
......@@ -526,6 +551,12 @@
#define PROGRESS_BAR_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them
//#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
......
......@@ -91,13 +91,7 @@ void Config_StoreSettings()
EEPROM_WRITE_VAR(i,Kp);
EEPROM_WRITE_VAR(i,Ki);
EEPROM_WRITE_VAR(i,Kd);
#else
float dummy = 3000.0f;
EEPROM_WRITE_VAR(i,dummy);
dummy = 0.0f;
EEPROM_WRITE_VAR(i,dummy);
EEPROM_WRITE_VAR(i,dummy);
#endif
#endif // PIDTEMP
#ifndef DOGLCD
int lcd_contrast = 32;
#endif
......@@ -270,12 +264,17 @@ void Config_PrintSettings()
#ifdef PIDTEMP
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("PID settings:");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M301 P",Kp[active_extruder]);
SERIAL_ECHOPAIR(" I" ,unscalePID_i(Ki[active_extruder]));
SERIAL_ECHOPAIR(" D" ,unscalePID_d(Kd[active_extruder]));
SERIAL_ECHOLN("");
#endif
for (int e = 0; e < EXTRUDERS; e++)
{
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M301 E", (long unsigned int)e);
SERIAL_ECHOPAIR(" P", Kp[e]);
SERIAL_ECHOPAIR(" I" ,unscalePID_i(Ki[e]));
SERIAL_ECHOPAIR(" D" ,unscalePID_d(Kd[e]));
SERIAL_ECHOLN("");
}
#endif // PIDTEMP
#ifdef FWRETRACT
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Retract: S=Length (mm) F:Speed (mm/m) Z: ZLift (mm)");
......@@ -391,13 +390,14 @@ void Config_RetrieveSettings()
EEPROM_READ_VAR(i,gumPreheatHotendTemp);
EEPROM_READ_VAR(i,gumPreheatHPBTemp);
EEPROM_READ_VAR(i,gumPreheatFanSpeed);
#ifndef PIDTEMP
float Kp,Ki,Kd;
#endif
#ifdef PIDTEMP
// do not need to scale PID values as the values in EEPROM are already scaled
EEPROM_READ_VAR(i,Kp);
EEPROM_READ_VAR(i,Ki);
EEPROM_READ_VAR(i,Kd);
#endif // PIDTEMP
#ifndef DOGLCD
int lcd_contrast;
#endif
......@@ -461,7 +461,7 @@ void Config_ResetDefault()
float tmp5[]=DEFAULT_Kp;
float tmp6[]=DEFAULT_Ki;
float tmp7[]=DEFAULT_Kd;
#endif
#endif // PIDTEMP
for (short i=0;i<7;i++)
{
......@@ -517,6 +517,8 @@ void Config_ResetDefault()
lcd_contrast = DEFAULT_LCD_CONTRAST;
#endif
#ifdef PIDTEMP
// call updatePID (similar to when we have processed M301)
updatePID();
for (short i=0;i<4;i++)
{
#ifdef SINGLENOZZLE
......@@ -528,14 +530,8 @@ void Config_ResetDefault()
Ki[i] = scalePID_i(tmp6[i]);
Kd[i] = scalePID_d(tmp7[i]);
#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
#ifdef FWRETRACT
......
......@@ -28,16 +28,6 @@
//#define WATCH_TEMP_PERIOD 40000 //40 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.
//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>
......
......@@ -4497,28 +4497,35 @@ Sigma_Exit:
#ifdef PIDTEMP
case 301: // M301
{
if(code_seen('P')) Kp[active_extruder] = code_value();
if(code_seen('I')) Ki[active_extruder] = scalePID_i(code_value());
if(code_seen('D')) Kd[active_extruder] = scalePID_d(code_value());
#ifdef PID_ADD_EXTRUSION_RATE
if(code_seen('C')) Kc = code_value();
#endif
updatePID();
SERIAL_PROTOCOL(MSG_OK);
SERIAL_PROTOCOL(" p:");
SERIAL_PROTOCOL(Kp[active_extruder]);
SERIAL_PROTOCOL(" i:");
SERIAL_PROTOCOL(unscalePID_i(Ki[active_extruder]));
SERIAL_PROTOCOL(" d:");
SERIAL_PROTOCOL(unscalePID_d(Kd[active_extruder]));
#ifdef PID_ADD_EXTRUSION_RATE
SERIAL_PROTOCOL(" c:");
//Kc does not have scaling applied above, or in resetting defaults
SERIAL_PROTOCOL(Kc);
#endif
SERIAL_PROTOCOLLN("");
// multi-extruder PID patch: M301 updates or prints a single extruder's PID values
// default behaviour (omitting E parameter) is to update for extruder 0 only
int e = 0; // extruder being updated
if (code_seen('E'))
{
e = (int)code_value();
}
if (e < EXTRUDERS) // catch bad input value
{
if (code_seen('P')) Kp[e] = code_value();
if (code_seen('I')) Ki[e] = scalePID_i(code_value());
if (code_seen('D')) Kd[e] = scalePID_d(code_value());
updatePID();
SERIAL_PROTOCOL(MSG_OK);
SERIAL_PROTOCOL(" e:"); // specify extruder in serial output
SERIAL_PROTOCOL(e);
SERIAL_PROTOCOL(" p:");
SERIAL_PROTOCOL(Kp[e]);
SERIAL_PROTOCOL(" i:");
SERIAL_PROTOCOL(unscalePID_i(Ki[e]));
SERIAL_PROTOCOL(" d:");
SERIAL_PROTOCOL(unscalePID_d(Kd[e]));
SERIAL_PROTOCOLLN("");
}
else
{
SERIAL_ECHO_START;
SERIAL_ECHOLN(MSG_INVALID_EXTRUDER);
}
}
break;
#endif //PIDTEMP
......
This diff is collapsed.
......@@ -79,7 +79,6 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_ACC "Acel"
#define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk"
......
......@@ -66,7 +66,6 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_ACC "Accel"
#define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk"
......
......@@ -79,7 +79,6 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_ACC "Acc"
#define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk"
......
......@@ -79,7 +79,6 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_ACC "Accel"
#define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk"
......
......@@ -66,7 +66,6 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_ACC "Acel"
#define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk"
......
......@@ -66,7 +66,6 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_ACC "Azelerazioa"
#define MSG_VXY_JERK "Vxy-astindua"
#define MSG_VZ_JERK "Vz-astindua"
......
......@@ -79,7 +79,6 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_ACC "Accel"
#define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk"
......
......@@ -60,9 +60,6 @@ float current_temperature_bed = 0.0;
float Kp[4];
float Ki[4];
float Kd[4];
#ifdef PID_ADD_EXTRUSION_RATE
float Kc;
#endif
#endif //PIDTEMP
#ifdef PIDTEMPBED
......
......@@ -23,9 +23,7 @@
#include "Marlin.h"
#include "planner.h"
#ifdef PID_ADD_EXTRUSION_RATE
#include "stepper.h"
#endif
// public functions
void tp_init(); //initialize the heating
......@@ -68,7 +66,7 @@ extern float current_temperature_bed;
#endif
#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_d(float d);
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