New config option HEATER_CURRENT to limit current to the nozzle
This commit is contained in:
parent
3ff008c064
commit
0ca62c5596
2 changed files with 8 additions and 2 deletions
|
|
@ -113,13 +113,15 @@ char uuid[] = "00000000-0000-0000-0000-000000000000";
|
|||
// Uncomment the following line to enable PID support. This is untested and could be disastrous. Be careful.
|
||||
//#define PIDTEMP 1
|
||||
#ifdef PIDTEMP
|
||||
#define PID_MAX 255 // limits current to nozzle
|
||||
#define PID_INTEGRAL_DRIVE_MAX 220
|
||||
#define PID_PGAIN 180 //100 is 1.0
|
||||
#define PID_IGAIN 2 //100 is 1.0
|
||||
#define PID_DGAIN 100 //100 is 1.0
|
||||
#endif
|
||||
|
||||
// Change this value (range 1-255) to limit the current to the nozzle
|
||||
#define HEATER_CURRENT 255
|
||||
|
||||
// How often should the heater check for new temp readings, in milliseconds
|
||||
#define HEATER_CHECK_INTERVAL 500
|
||||
#define BED_CHECK_INTERVAL 5000
|
||||
|
|
|
|||
|
|
@ -126,6 +126,9 @@ int tt = 0, bt = 0;
|
|||
int temp_iState_min = 100 * -PID_INTEGRAL_DRIVE_MAX / PID_IGAIN;
|
||||
int temp_iState_max = 100 * PID_INTEGRAL_DRIVE_MAX / PID_IGAIN;
|
||||
#endif
|
||||
#ifndef HEATER_CURRENT
|
||||
#define HEATER_CURRENT 255
|
||||
#endif
|
||||
#ifdef SMOOTHING
|
||||
uint32_t nma = 0;
|
||||
#endif
|
||||
|
|
@ -1443,7 +1446,7 @@ void manage_heater()
|
|||
iTerm = (PID_IGAIN * temp_iState) / 100;
|
||||
dTerm = (PID_DGAIN * (current_raw - temp_dState)) / 100;
|
||||
temp_dState = current_raw;
|
||||
analogWrite(HEATER_0_PIN, constrain(pTerm + iTerm - dTerm, 0, PID_MAX));
|
||||
analogWrite(HEATER_0_PIN, constrain(pTerm + iTerm - dTerm, 0, HEATER_CURRENT));
|
||||
#else
|
||||
if(current_raw >= target_raw)
|
||||
{
|
||||
|
|
@ -1455,6 +1458,7 @@ void manage_heater()
|
|||
else
|
||||
{
|
||||
WRITE(HEATER_0_PIN,HIGH);
|
||||
analogWrite(HEATER_0_PIN, HEATER_CURRENT);
|
||||
#if LED_PIN > -1
|
||||
WRITE(LED_PIN,HIGH);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue