PID now per extruder. Fixed typo
This commit is contained in:
parent
0ac452e252
commit
6752cb2d9c
@ -136,6 +136,17 @@
|
|||||||
// #define DEFAULT_Kd 440
|
// #define DEFAULT_Kd 440
|
||||||
#endif // PIDTEMP
|
#endif // PIDTEMP
|
||||||
|
|
||||||
|
// PID parameters for 2nd extruder
|
||||||
|
#define DEFAULT_Kp_E1 22.2
|
||||||
|
#define DEFAULT_Ki_E1 1.08
|
||||||
|
#define DEFAULT_Kd_E1 114
|
||||||
|
|
||||||
|
|
||||||
|
// PID parameters for 3th extruder
|
||||||
|
// #define DEFAULT_Kp_E2 22.2
|
||||||
|
// #define DEFAULT_Ki_E2 1.08
|
||||||
|
// #define DEFAULT_Kd_E2 114
|
||||||
|
|
||||||
// Bed Temperature Control
|
// Bed Temperature Control
|
||||||
// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis
|
// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis
|
||||||
//
|
//
|
||||||
|
@ -3,26 +3,26 @@
|
|||||||
#include "temperature.h"
|
#include "temperature.h"
|
||||||
#include "ultralcd.h"
|
#include "ultralcd.h"
|
||||||
#include "ConfigurationStore.h"
|
#include "ConfigurationStore.h"
|
||||||
|
|
||||||
void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size)
|
void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
eeprom_write_byte((unsigned char*)pos, *value);
|
eeprom_write_byte((unsigned char*)pos, *value);
|
||||||
pos++;
|
pos++;
|
||||||
value++;
|
value++;
|
||||||
}while(--size);
|
}while(--size);
|
||||||
}
|
}
|
||||||
#define EEPROM_WRITE_VAR(pos, value) _EEPROM_writeData(pos, (uint8_t*)&value, sizeof(value))
|
#define EEPROM_WRITE_VAR(pos, value) _EEPROM_writeData(pos, (uint8_t*)&value, sizeof(value))
|
||||||
void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size)
|
void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
*value = eeprom_read_byte((unsigned char*)pos);
|
*value = eeprom_read_byte((unsigned char*)pos);
|
||||||
pos++;
|
pos++;
|
||||||
value++;
|
value++;
|
||||||
}while(--size);
|
}while(--size);
|
||||||
}
|
}
|
||||||
#define EEPROM_READ_VAR(pos, value) _EEPROM_readData(pos, (uint8_t*)&value, sizeof(value))
|
#define EEPROM_READ_VAR(pos, value) _EEPROM_readData(pos, (uint8_t*)&value, sizeof(value))
|
||||||
//======================================================================================
|
//======================================================================================
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size)
|
|||||||
void Config_StoreSettings()
|
void Config_StoreSettings()
|
||||||
{
|
{
|
||||||
char ver[4]= "000";
|
char ver[4]= "000";
|
||||||
int i=EEPROM_OFFSET;
|
int i=EEPROM_OFFSET;
|
||||||
EEPROM_WRITE_VAR(i,ver); // invalidate data first
|
EEPROM_WRITE_VAR(i,ver); // invalidate data first
|
||||||
EEPROM_WRITE_VAR(i,axis_steps_per_unit);
|
EEPROM_WRITE_VAR(i,axis_steps_per_unit);
|
||||||
EEPROM_WRITE_VAR(i,max_feedrate);
|
EEPROM_WRITE_VAR(i,max_feedrate);
|
||||||
@ -58,8 +58,8 @@ void Config_StoreSettings()
|
|||||||
EEPROM_WRITE_VAR(i,max_e_jerk);
|
EEPROM_WRITE_VAR(i,max_e_jerk);
|
||||||
EEPROM_WRITE_VAR(i,add_homeing);
|
EEPROM_WRITE_VAR(i,add_homeing);
|
||||||
#ifndef ULTIPANEL
|
#ifndef ULTIPANEL
|
||||||
int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED;
|
int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED;
|
||||||
int absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
|
int absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
|
||||||
#endif
|
#endif
|
||||||
EEPROM_WRITE_VAR(i,plaPreheatHotendTemp);
|
EEPROM_WRITE_VAR(i,plaPreheatHotendTemp);
|
||||||
EEPROM_WRITE_VAR(i,plaPreheatHPBTemp);
|
EEPROM_WRITE_VAR(i,plaPreheatHPBTemp);
|
||||||
@ -75,7 +75,7 @@ void Config_StoreSettings()
|
|||||||
EEPROM_WRITE_VAR(i,3000);
|
EEPROM_WRITE_VAR(i,3000);
|
||||||
EEPROM_WRITE_VAR(i,0);
|
EEPROM_WRITE_VAR(i,0);
|
||||||
EEPROM_WRITE_VAR(i,0);
|
EEPROM_WRITE_VAR(i,0);
|
||||||
#endif
|
#endif
|
||||||
char ver2[4]=EEPROM_VERSION;
|
char ver2[4]=EEPROM_VERSION;
|
||||||
i=EEPROM_OFFSET;
|
i=EEPROM_OFFSET;
|
||||||
EEPROM_WRITE_VAR(i,ver2); // validate data
|
EEPROM_WRITE_VAR(i,ver2); // validate data
|
||||||
@ -105,7 +105,7 @@ void Config_PrintSettings()
|
|||||||
SERIAL_ECHOPAIR(" Z", max_feedrate[2] );
|
SERIAL_ECHOPAIR(" Z", max_feedrate[2] );
|
||||||
SERIAL_ECHOPAIR(" E", max_feedrate[3]);
|
SERIAL_ECHOPAIR(" E", max_feedrate[3]);
|
||||||
SERIAL_ECHOLN("");
|
SERIAL_ECHOLN("");
|
||||||
|
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
SERIAL_ECHOLNPGM("Maximum Acceleration (mm/s2):");
|
SERIAL_ECHOLNPGM("Maximum Acceleration (mm/s2):");
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
@ -120,7 +120,7 @@ void Config_PrintSettings()
|
|||||||
SERIAL_ECHOPAIR(" M204 S",acceleration );
|
SERIAL_ECHOPAIR(" M204 S",acceleration );
|
||||||
SERIAL_ECHOPAIR(" T" ,retract_acceleration);
|
SERIAL_ECHOPAIR(" T" ,retract_acceleration);
|
||||||
SERIAL_ECHOLN("");
|
SERIAL_ECHOLN("");
|
||||||
|
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
SERIAL_ECHOLNPGM("Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum xY jerk (mm/s), Z=maximum Z jerk (mm/s)");
|
SERIAL_ECHOLNPGM("Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum xY jerk (mm/s), Z=maximum Z jerk (mm/s)");
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
@ -131,7 +131,7 @@ void Config_PrintSettings()
|
|||||||
SERIAL_ECHOPAIR(" Z" ,max_z_jerk);
|
SERIAL_ECHOPAIR(" Z" ,max_z_jerk);
|
||||||
SERIAL_ECHOPAIR(" E" ,max_e_jerk);
|
SERIAL_ECHOPAIR(" E" ,max_e_jerk);
|
||||||
SERIAL_ECHOLN("");
|
SERIAL_ECHOLN("");
|
||||||
|
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
SERIAL_ECHOLNPGM("Home offset (mm):");
|
SERIAL_ECHOLNPGM("Home offset (mm):");
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
@ -143,10 +143,24 @@ void Config_PrintSettings()
|
|||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
SERIAL_ECHOLNPGM("PID settings:");
|
SERIAL_ECHOLNPGM("PID settings:");
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
SERIAL_ECHOPAIR(" M301 P",Kp);
|
SERIAL_ECHOPAIR(" M301 P",Kp[0]);
|
||||||
SERIAL_ECHOPAIR(" I" ,Ki/PID_dT);
|
SERIAL_ECHOPAIR(" I" ,Ki[0]/PID_dT);
|
||||||
SERIAL_ECHOPAIR(" D" ,Kd*PID_dT);
|
SERIAL_ECHOPAIR(" D" ,Kd[0]*PID_dT);
|
||||||
SERIAL_ECHOLN("");
|
SERIAL_ECHOLN("");
|
||||||
|
#if EXTRUDERS > 1
|
||||||
|
SERIAL_ECHOPAIR(" M301 P",Kp[1]);
|
||||||
|
SERIAL_ECHOPAIR(" I" ,Ki[1]/PID_dT);
|
||||||
|
SERIAL_ECHOPAIR(" D" ,Kd[1]*PID_dT);
|
||||||
|
SERIAL_ECHOPGM(" T1");
|
||||||
|
SERIAL_ECHOLN("");
|
||||||
|
#endif
|
||||||
|
#if EXTRUDERS > 2
|
||||||
|
SERIAL_ECHOPAIR(" M301 P",Kp[2]);
|
||||||
|
SERIAL_ECHOPAIR(" I" ,Ki[2]/PID_dT);
|
||||||
|
SERIAL_ECHOPAIR(" D" ,Kd[2]*PID_dT);
|
||||||
|
SERIAL_ECHOPGM(" T2");
|
||||||
|
SERIAL_ECHOLN("");
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -161,7 +175,7 @@ void Config_RetrieveSettings()
|
|||||||
EEPROM_READ_VAR(i,stored_ver); //read stored version
|
EEPROM_READ_VAR(i,stored_ver); //read stored version
|
||||||
// SERIAL_ECHOLN("Version: [" << ver << "] Stored version: [" << stored_ver << "]");
|
// SERIAL_ECHOLN("Version: [" << ver << "] Stored version: [" << stored_ver << "]");
|
||||||
if (strncmp(ver,stored_ver,3) == 0)
|
if (strncmp(ver,stored_ver,3) == 0)
|
||||||
{
|
{
|
||||||
// version number match
|
// version number match
|
||||||
EEPROM_READ_VAR(i,axis_steps_per_unit);
|
EEPROM_READ_VAR(i,axis_steps_per_unit);
|
||||||
EEPROM_READ_VAR(i,max_feedrate);
|
EEPROM_READ_VAR(i,max_feedrate);
|
||||||
@ -176,15 +190,15 @@ void Config_RetrieveSettings()
|
|||||||
EEPROM_READ_VAR(i,max_e_jerk);
|
EEPROM_READ_VAR(i,max_e_jerk);
|
||||||
EEPROM_READ_VAR(i,add_homeing);
|
EEPROM_READ_VAR(i,add_homeing);
|
||||||
#ifndef ULTIPANEL
|
#ifndef ULTIPANEL
|
||||||
int plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed;
|
int plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed;
|
||||||
int absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed;
|
int absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed;
|
||||||
#endif
|
#endif
|
||||||
EEPROM_READ_VAR(i,plaPreheatHotendTemp);
|
EEPROM_READ_VAR(i,plaPreheatHotendTemp);
|
||||||
EEPROM_READ_VAR(i,plaPreheatHPBTemp);
|
EEPROM_READ_VAR(i,plaPreheatHPBTemp);
|
||||||
EEPROM_READ_VAR(i,plaPreheatFanSpeed);
|
EEPROM_READ_VAR(i,plaPreheatFanSpeed);
|
||||||
EEPROM_READ_VAR(i,absPreheatHotendTemp);
|
EEPROM_READ_VAR(i,absPreheatHotendTemp);
|
||||||
EEPROM_READ_VAR(i,absPreheatHPBTemp);
|
EEPROM_READ_VAR(i,absPreheatHPBTemp);
|
||||||
EEPROM_READ_VAR(i,absPreheatFanSpeed);
|
EEPROM_READ_VAR(i,absPreheatFanSpeed);
|
||||||
#ifndef PIDTEMP
|
#ifndef PIDTEMP
|
||||||
float Kp,Ki,Kd;
|
float Kp,Ki,Kd;
|
||||||
#endif
|
#endif
|
||||||
@ -195,17 +209,17 @@ void Config_RetrieveSettings()
|
|||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
SERIAL_ECHOLNPGM("Stored settings retreived:");
|
SERIAL_ECHOLNPGM("Stored settings retreived:");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Config_ResetDefault();
|
Config_ResetDefault();
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
SERIAL_ECHOLN("Using Default settings:");
|
SERIAL_ECHOLN("Using Default settings:");
|
||||||
}
|
}
|
||||||
Config_PrintSettings();
|
Config_PrintSettings();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Config_ResetDefault()
|
void Config_ResetDefault()
|
||||||
{
|
{
|
||||||
float tmp1[]=DEFAULT_AXIS_STEPS_PER_UNIT;
|
float tmp1[]=DEFAULT_AXIS_STEPS_PER_UNIT;
|
||||||
float tmp2[]=DEFAULT_MAX_FEEDRATE;
|
float tmp2[]=DEFAULT_MAX_FEEDRATE;
|
||||||
@ -234,9 +248,19 @@ void Config_ResetDefault()
|
|||||||
absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
|
absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
|
||||||
#endif
|
#endif
|
||||||
#ifdef PIDTEMP
|
#ifdef PIDTEMP
|
||||||
Kp = DEFAULT_Kp;
|
Kp[0] = DEFAULT_Kp;
|
||||||
Ki = (DEFAULT_Ki*PID_dT);
|
Ki[0] = (DEFAULT_Ki*PID_dT);
|
||||||
Kd = (DEFAULT_Kd/PID_dT);
|
Kd[0] = (DEFAULT_Kd/PID_dT);
|
||||||
|
#if EXTRUDERS > 1
|
||||||
|
Kp[1] = DEFAULT_Kp_E1;
|
||||||
|
Ki[1] = (DEFAULT_Ki_E1*PID_dT);
|
||||||
|
Kd[1] = (DEFAULT_Kd_E1/PID_dT);
|
||||||
|
#endif
|
||||||
|
#if EXTRUDERS > 2
|
||||||
|
Kp[2] = DEFAULT_Kp_E2;
|
||||||
|
Ki[2] = (DEFAULT_Ki_E2*PID_dT);
|
||||||
|
Kd[2] = (DEFAULT_Kd_E2/PID_dT);
|
||||||
|
#endif
|
||||||
#ifdef PID_ADD_EXTRUSION_RATE
|
#ifdef PID_ADD_EXTRUSION_RATE
|
||||||
Kc = DEFAULT_Kc;
|
Kc = DEFAULT_Kc;
|
||||||
#endif//PID_ADD_EXTRUSION_RATE
|
#endif//PID_ADD_EXTRUSION_RATE
|
||||||
|
@ -1401,20 +1401,23 @@ void process_commands()
|
|||||||
#ifdef PIDTEMP
|
#ifdef PIDTEMP
|
||||||
case 301: // M301
|
case 301: // M301
|
||||||
{
|
{
|
||||||
if(code_seen('P')) Kp = code_value();
|
if(setTargetedHotend(301)){
|
||||||
if(code_seen('I')) Ki = code_value()*PID_dT;
|
break;
|
||||||
if(code_seen('D')) Kd = code_value()/PID_dT;
|
}
|
||||||
|
if(code_seen('P')) Kp[tmp_extruder] = code_value();
|
||||||
|
if(code_seen('I')) Ki[tmp_extruder] = code_value()*PID_dT;
|
||||||
|
if(code_seen('D')) Kd[tmp_extruder] = code_value()/PID_dT;
|
||||||
#ifdef PID_ADD_EXTRUSION_RATE
|
#ifdef PID_ADD_EXTRUSION_RATE
|
||||||
if(code_seen('C')) Kc = code_value();
|
if(code_seen('C')) Kc = code_value();
|
||||||
#endif
|
#endif
|
||||||
updatePID();
|
updatePID();
|
||||||
SERIAL_PROTOCOL(MSG_OK);
|
SERIAL_PROTOCOL(MSG_OK);
|
||||||
SERIAL_PROTOCOL(" p:");
|
SERIAL_PROTOCOL(" p:");
|
||||||
SERIAL_PROTOCOL(Kp);
|
SERIAL_PROTOCOL(Kp[tmp_extruder]);
|
||||||
SERIAL_PROTOCOL(" i:");
|
SERIAL_PROTOCOL(" i:");
|
||||||
SERIAL_PROTOCOL(Ki/PID_dT);
|
SERIAL_PROTOCOL(Ki[tmp_extruder]/PID_dT);
|
||||||
SERIAL_PROTOCOL(" d:");
|
SERIAL_PROTOCOL(" d:");
|
||||||
SERIAL_PROTOCOL(Kd*PID_dT);
|
SERIAL_PROTOCOL(Kd[tmp_extruder]*PID_dT);
|
||||||
#ifdef PID_ADD_EXTRUSION_RATE
|
#ifdef PID_ADD_EXTRUSION_RATE
|
||||||
SERIAL_PROTOCOL(" c:");
|
SERIAL_PROTOCOL(" c:");
|
||||||
SERIAL_PROTOCOL(Kc*PID_dT);
|
SERIAL_PROTOCOL(Kc*PID_dT);
|
||||||
@ -1936,6 +1939,9 @@ bool setTargetedHotend(int code){
|
|||||||
case 109:
|
case 109:
|
||||||
SERIAL_ECHO(MSG_M109_INVALID_EXTRUDER);
|
SERIAL_ECHO(MSG_M109_INVALID_EXTRUDER);
|
||||||
break;
|
break;
|
||||||
|
case 301:
|
||||||
|
SERIAL_ECHO(MSG_M301_INVALID_EXTRUDER);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
SERIAL_ECHOLN(tmp_extruder);
|
SERIAL_ECHOLN(tmp_extruder);
|
||||||
return true;
|
return true;
|
||||||
|
@ -139,6 +139,7 @@
|
|||||||
#define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder "
|
#define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder "
|
||||||
#define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature"
|
#define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature"
|
||||||
#define MSG_M109_INVALID_EXTRUDER "M109 Invalid extruder "
|
#define MSG_M109_INVALID_EXTRUDER "M109 Invalid extruder "
|
||||||
|
#define MSG_M301_INVALID_EXTRUDER "M301 Invalid extruder "
|
||||||
#define MSG_HEATING "Heating..."
|
#define MSG_HEATING "Heating..."
|
||||||
#define MSG_HEATING_COMPLETE "Heating done."
|
#define MSG_HEATING_COMPLETE "Heating done."
|
||||||
#define MSG_BED_HEATING "Bed Heating."
|
#define MSG_BED_HEATING "Bed Heating."
|
||||||
@ -293,6 +294,7 @@
|
|||||||
#define MSG_M105_INVALID_EXTRUDER "M105 Niepoprawny ekstruder "
|
#define MSG_M105_INVALID_EXTRUDER "M105 Niepoprawny ekstruder "
|
||||||
#define MSG_ERR_NO_THERMISTORS "Brak termistorow - brak temperatury :("
|
#define MSG_ERR_NO_THERMISTORS "Brak termistorow - brak temperatury :("
|
||||||
#define MSG_M109_INVALID_EXTRUDER "M109 Niepoprawny ekstruder "
|
#define MSG_M109_INVALID_EXTRUDER "M109 Niepoprawny ekstruder "
|
||||||
|
#define MSG_M301_INVALID_EXTRUDER "M301 Niepoprawny ekstruder "
|
||||||
#define MSG_HEATING "Nagrzewanie ekstrudera..."
|
#define MSG_HEATING "Nagrzewanie ekstrudera..."
|
||||||
#define MSG_HEATING_COMPLETE "Nagrzewanie ekstrudera zakonczone."
|
#define MSG_HEATING_COMPLETE "Nagrzewanie ekstrudera zakonczone."
|
||||||
#define MSG_BED_HEATING "Nagrzewanie loza..."
|
#define MSG_BED_HEATING "Nagrzewanie loza..."
|
||||||
@ -452,6 +454,7 @@
|
|||||||
#define MSG_M105_INVALID_EXTRUDER "M105 Extruder invalide"
|
#define MSG_M105_INVALID_EXTRUDER "M105 Extruder invalide"
|
||||||
#define MSG_ERR_NO_THERMISTORS "Pas de thermistor, pas de temperature"
|
#define MSG_ERR_NO_THERMISTORS "Pas de thermistor, pas de temperature"
|
||||||
#define MSG_M109_INVALID_EXTRUDER "M109 Extruder invalide "
|
#define MSG_M109_INVALID_EXTRUDER "M109 Extruder invalide "
|
||||||
|
#define MSG_M301_INVALID_EXTRUDER "M301 Extruder invalide "
|
||||||
#define MSG_HEATING "En chauffe..."
|
#define MSG_HEATING "En chauffe..."
|
||||||
#define MSG_HEATING_COMPLETE "Chauffe terminee."
|
#define MSG_HEATING_COMPLETE "Chauffe terminee."
|
||||||
#define MSG_BED_HEATING "Chauffe du lit."
|
#define MSG_BED_HEATING "Chauffe du lit."
|
||||||
@ -570,7 +573,7 @@
|
|||||||
#define MSG_NO_CARD "Keine SDKarte"
|
#define MSG_NO_CARD "Keine SDKarte"
|
||||||
#define MSG_DWELL "Warten..."
|
#define MSG_DWELL "Warten..."
|
||||||
#define MSG_USERWAIT "Warte auf Nutzer..."
|
#define MSG_USERWAIT "Warte auf Nutzer..."
|
||||||
#define MSG_RESUMING "Druck fortsetzung"
|
#define MSG_RESUMING "Druck fortsetzung"
|
||||||
#define MSG_NO_MOVE "Kein Zug."
|
#define MSG_NO_MOVE "Kein Zug."
|
||||||
#define MSG_PART_RELEASE "Stepper tlw frei"
|
#define MSG_PART_RELEASE "Stepper tlw frei"
|
||||||
#define MSG_KILLED "KILLED"
|
#define MSG_KILLED "KILLED"
|
||||||
@ -609,6 +612,7 @@
|
|||||||
#define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder "
|
#define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder "
|
||||||
#define MSG_ERR_NO_THERMISTORS "No thermistors - no temp"
|
#define MSG_ERR_NO_THERMISTORS "No thermistors - no temp"
|
||||||
#define MSG_M109_INVALID_EXTRUDER "M109 Invalid extruder "
|
#define MSG_M109_INVALID_EXTRUDER "M109 Invalid extruder "
|
||||||
|
#define MSG_M301_INVALID_EXTRUDER "M301 Invalid extruder "
|
||||||
#define MSG_HEATING "Heating..."
|
#define MSG_HEATING "Heating..."
|
||||||
#define MSG_HEATING_COMPLETE "Heating done."
|
#define MSG_HEATING_COMPLETE "Heating done."
|
||||||
#define MSG_BED_HEATING "Bed Heating."
|
#define MSG_BED_HEATING "Bed Heating."
|
||||||
@ -767,6 +771,7 @@
|
|||||||
#define MSG_M105_INVALID_EXTRUDER "M105 Extrusor Invalido "
|
#define MSG_M105_INVALID_EXTRUDER "M105 Extrusor Invalido "
|
||||||
#define MSG_ERR_NO_THERMISTORS "No hay termistores - no temp"
|
#define MSG_ERR_NO_THERMISTORS "No hay termistores - no temp"
|
||||||
#define MSG_M109_INVALID_EXTRUDER "M109 Extrusor Invalido "
|
#define MSG_M109_INVALID_EXTRUDER "M109 Extrusor Invalido "
|
||||||
|
#define MSG_M301_INVALID_EXTRUDER "M301 Extrusor Invalido "
|
||||||
#define MSG_HEATING "Calentando..."
|
#define MSG_HEATING "Calentando..."
|
||||||
#define MSG_HEATING_COMPLETE "Calentamiento Hecho."
|
#define MSG_HEATING_COMPLETE "Calentamiento Hecho."
|
||||||
#define MSG_BED_HEATING "Calentando la base."
|
#define MSG_BED_HEATING "Calentando la base."
|
||||||
@ -916,7 +921,8 @@
|
|||||||
#define MSG_M104_INVALID_EXTRUDER "M104 ошибка экструдера "
|
#define MSG_M104_INVALID_EXTRUDER "M104 ошибка экструдера "
|
||||||
#define MSG_M105_INVALID_EXTRUDER "M105 ошибка экструдера "
|
#define MSG_M105_INVALID_EXTRUDER "M105 ошибка экструдера "
|
||||||
#define MSG_ERR_NO_THERMISTORS "Нет термистра - нет температуры"
|
#define MSG_ERR_NO_THERMISTORS "Нет термистра - нет температуры"
|
||||||
#define MSG_M109_INVALID_EXTRUDER "M109 ошибка экструдера "
|
#define MSG_M109_INVALID_EXTRUDER "M109 ошибка экструдера "
|
||||||
|
#define MSG_M301_INVALID_EXTRUDER "M301 ошибка экструдера "
|
||||||
#define MSG_HEATING "Нагрев... "
|
#define MSG_HEATING "Нагрев... "
|
||||||
#define MSG_HEATING_COMPLETE "Наргето. "
|
#define MSG_HEATING_COMPLETE "Наргето. "
|
||||||
#define MSG_BED_HEATING "Нагрев стола... "
|
#define MSG_BED_HEATING "Нагрев стола... "
|
||||||
@ -1235,6 +1241,7 @@
|
|||||||
#define MSG_M105_INVALID_EXTRUDER "M105 Extrusor inválido "
|
#define MSG_M105_INVALID_EXTRUDER "M105 Extrusor inválido "
|
||||||
#define MSG_ERR_NO_THERMISTORS "Nao ha termistor - no temp"
|
#define MSG_ERR_NO_THERMISTORS "Nao ha termistor - no temp"
|
||||||
#define MSG_M109_INVALID_EXTRUDER "M109 Extrusor inválido "
|
#define MSG_M109_INVALID_EXTRUDER "M109 Extrusor inválido "
|
||||||
|
#define MSG_M301_INVALID_EXTRUDER "M301 Extrusor inválido "
|
||||||
#define MSG_HEATING "Aquecendo..."
|
#define MSG_HEATING "Aquecendo..."
|
||||||
#define MSG_HEATING_COMPLETE "Aquecido."
|
#define MSG_HEATING_COMPLETE "Aquecido."
|
||||||
#define MSG_BED_HEATING "Aquecendo a Base."
|
#define MSG_BED_HEATING "Aquecendo a Base."
|
||||||
|
@ -478,8 +478,8 @@ void check_axes_activity()
|
|||||||
if((DISABLE_Z) && (z_active == 0)) disable_z();
|
if((DISABLE_Z) && (z_active == 0)) disable_z();
|
||||||
if(DISABLE_E) {
|
if(DISABLE_E) {
|
||||||
if(e0_active == 0) disable_e0();
|
if(e0_active == 0) disable_e0();
|
||||||
if(e1_active == 0) disable_e1();
|
if(e1_active == 1) disable_e1();
|
||||||
if(e2_active == 0) disable_e2();
|
if(e2_active == 2) disable_e2();
|
||||||
}
|
}
|
||||||
#if FAN_PIN > -1
|
#if FAN_PIN > -1
|
||||||
#ifndef FAN_SOFT_PWM
|
#ifndef FAN_SOFT_PWM
|
||||||
|
@ -34,6 +34,16 @@
|
|||||||
#include "temperature.h"
|
#include "temperature.h"
|
||||||
#include "watchdog.h"
|
#include "watchdog.h"
|
||||||
|
|
||||||
|
#if EXTRUDERS > 3
|
||||||
|
# error Unsupported number of extruders
|
||||||
|
#elif EXTRUDERS > 2
|
||||||
|
# define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1, v2, v3 }
|
||||||
|
#elif EXTRUDERS > 1
|
||||||
|
# define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1, v2 }
|
||||||
|
#else
|
||||||
|
# define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1 }
|
||||||
|
#endif
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//=============================public variables============================
|
//=============================public variables============================
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
@ -44,10 +54,10 @@ float current_temperature[EXTRUDERS] = { 0 };
|
|||||||
int current_temperature_bed_raw = 0;
|
int current_temperature_bed_raw = 0;
|
||||||
float current_temperature_bed = 0;
|
float current_temperature_bed = 0;
|
||||||
|
|
||||||
#ifdef PIDTEMP
|
#ifdef PIDTEMP
|
||||||
float Kp=DEFAULT_Kp;
|
float Kp[EXTRUDERS] = ARRAY_BY_EXTRUDERS(DEFAULT_Kp, DEFAULT_Kp_E1, DEFAULT_Kp_E2);
|
||||||
float Ki=(DEFAULT_Ki*PID_dT);
|
float Ki[EXTRUDERS] = ARRAY_BY_EXTRUDERS(DEFAULT_Ki*PID_dT, DEFAULT_Ki_E1*PID_dT, DEFAULT_Ki_E2*PID_dT);
|
||||||
float Kd=(DEFAULT_Kd/PID_dT);
|
float Kd[EXTRUDERS] = ARRAY_BY_EXTRUDERS(DEFAULT_Kd/PID_dT, DEFAULT_Kd_E1/PID_dT, DEFAULT_Kd_E2/PID_dT);
|
||||||
#ifdef PID_ADD_EXTRUSION_RATE
|
#ifdef PID_ADD_EXTRUSION_RATE
|
||||||
float Kc=DEFAULT_Kc;
|
float Kc=DEFAULT_Kc;
|
||||||
#endif
|
#endif
|
||||||
@ -102,15 +112,7 @@ static volatile bool temp_meas_ready = false;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if EXTRUDERS > 3
|
|
||||||
# error Unsupported number of extruders
|
|
||||||
#elif EXTRUDERS > 2
|
|
||||||
# define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1, v2, v3 }
|
|
||||||
#elif EXTRUDERS > 1
|
|
||||||
# define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1, v2 }
|
|
||||||
#else
|
|
||||||
# define ARRAY_BY_EXTRUDERS(v1, v2, v3) { v1 }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Init min and max temp with extreme values to prevent false errors during startup
|
// Init min and max temp with extreme values to prevent false errors during startup
|
||||||
static int minttemp_raw[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_RAW_LO_TEMP , HEATER_1_RAW_LO_TEMP , HEATER_2_RAW_LO_TEMP );
|
static int minttemp_raw[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_RAW_LO_TEMP , HEATER_1_RAW_LO_TEMP , HEATER_2_RAW_LO_TEMP );
|
||||||
@ -292,7 +294,7 @@ void updatePID()
|
|||||||
{
|
{
|
||||||
#ifdef PIDTEMP
|
#ifdef PIDTEMP
|
||||||
for(int e = 0; e < EXTRUDERS; e++) {
|
for(int e = 0; e < EXTRUDERS; e++) {
|
||||||
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / Ki;
|
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / Ki[e];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef PIDTEMPBED
|
#ifdef PIDTEMPBED
|
||||||
@ -337,14 +339,14 @@ void manage_heater()
|
|||||||
temp_iState[e] = 0.0;
|
temp_iState[e] = 0.0;
|
||||||
pid_reset[e] = false;
|
pid_reset[e] = false;
|
||||||
}
|
}
|
||||||
pTerm[e] = Kp * pid_error[e];
|
pTerm[e] = Kp[e] * pid_error[e];
|
||||||
temp_iState[e] += pid_error[e];
|
temp_iState[e] += pid_error[e];
|
||||||
temp_iState[e] = constrain(temp_iState[e], temp_iState_min[e], temp_iState_max[e]);
|
temp_iState[e] = constrain(temp_iState[e], temp_iState_min[e], temp_iState_max[e]);
|
||||||
iTerm[e] = Ki * temp_iState[e];
|
iTerm[e] = Ki[e] * temp_iState[e];
|
||||||
|
|
||||||
//K1 defined in Configuration.h in the PID settings
|
//K1 defined in Configuration.h in the PID settings
|
||||||
#define K2 (1.0-K1)
|
#define K2 (1.0-K1)
|
||||||
dTerm[e] = (Kd * (pid_input - temp_dState[e]))*K2 + (K1 * dTerm[e]);
|
dTerm[e] = (Kd[e] * (pid_input - temp_dState[e]))*K2 + (K1 * dTerm[e]);
|
||||||
temp_dState[e] = pid_input;
|
temp_dState[e] = pid_input;
|
||||||
|
|
||||||
pid_output = constrain(pTerm[e] + iTerm[e] - dTerm[e], 0, PID_MAX);
|
pid_output = constrain(pTerm[e] + iTerm[e] - dTerm[e], 0, PID_MAX);
|
||||||
@ -577,7 +579,7 @@ void tp_init()
|
|||||||
maxttemp[e] = maxttemp[0];
|
maxttemp[e] = maxttemp[0];
|
||||||
#ifdef PIDTEMP
|
#ifdef PIDTEMP
|
||||||
temp_iState_min[e] = 0.0;
|
temp_iState_min[e] = 0.0;
|
||||||
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / Ki;
|
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / Ki[e];
|
||||||
#endif //PIDTEMP
|
#endif //PIDTEMP
|
||||||
#ifdef PIDTEMPBED
|
#ifdef PIDTEMPBED
|
||||||
temp_iState_min_bed = 0.0;
|
temp_iState_min_bed = 0.0;
|
||||||
|
@ -39,7 +39,10 @@ extern int target_temperature_bed;
|
|||||||
extern float current_temperature_bed;
|
extern float current_temperature_bed;
|
||||||
|
|
||||||
#ifdef PIDTEMP
|
#ifdef PIDTEMP
|
||||||
extern float Kp,Ki,Kd,Kc;
|
extern float Kp[EXTRUDERS];
|
||||||
|
extern float Ki[EXTRUDERS];
|
||||||
|
extern float Kd[EXTRUDERS];
|
||||||
|
extern float Kc;
|
||||||
#endif
|
#endif
|
||||||
#ifdef PIDTEMPBED
|
#ifdef PIDTEMPBED
|
||||||
extern float bedKp,bedKi,bedKd;
|
extern float bedKp,bedKi,bedKd;
|
||||||
|
Loading…
Reference in New Issue
Block a user