mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-07-14 18:27:50 -06:00
Merge remote-tracking branch 'origin/Marlin_v1' into Marlin_v1
Conflicts: Marlin/Configuration.h Marlin/EEPROMwrite.h Marlin/Marlin.h Marlin/Marlin.pde Marlin/temperature.cpp Marlin/temperature.h Marlin/thermistortables.h
This commit is contained in:
commit
04d3b5537f
33 changed files with 11273 additions and 11073 deletions
|
@ -97,14 +97,15 @@ void manage_heater()
|
|||
|
||||
float pid_input;
|
||||
float pid_output;
|
||||
if(temp_meas_ready == true) {
|
||||
if(temp_meas_ready != true) //better readability
|
||||
return;
|
||||
|
||||
CRITICAL_SECTION_START;
|
||||
temp_meas_ready = false;
|
||||
CRITICAL_SECTION_END;
|
||||
|
||||
#ifdef PIDTEMP
|
||||
pid_input = analog2temp(current_raw[0]);
|
||||
pid_input = analog2temp(current_raw[TEMPSENSOR_HOTEND]);
|
||||
|
||||
#ifndef PID_OPENLOOP
|
||||
pid_error = pid_setpoint - pid_input;
|
||||
|
@ -125,10 +126,13 @@ CRITICAL_SECTION_END;
|
|||
temp_iState += pid_error;
|
||||
temp_iState = constrain(temp_iState, temp_iState_min, temp_iState_max);
|
||||
iTerm = Ki * temp_iState;
|
||||
#define K1 0.95
|
||||
//K1 defined in Configuration.h in the PID settings
|
||||
#define K2 (1.0-K1)
|
||||
dTerm = (Kd * (pid_input - temp_dState))*K2 + (K1 * dTerm);
|
||||
temp_dState = pid_input;
|
||||
#ifdef PID_ADD_EXTRUSION_RATE
|
||||
pTerm+=Kc*current_block->speed_e; //additional heating if extrusion speed is high
|
||||
#endif
|
||||
pid_output = constrain(pTerm + iTerm - dTerm, 0, PID_MAX);
|
||||
}
|
||||
#endif //PID_OPENLOOP
|
||||
|
@ -164,7 +168,7 @@ CRITICAL_SECTION_END;
|
|||
previous_millis_bed_heater = millis();
|
||||
|
||||
#if TEMP_1_PIN > -1
|
||||
if(current_raw[1] >= target_raw[1])
|
||||
if(current_raw[TEMPSENSOR_BED] >= target_raw[TEMPSENSOR_BED])
|
||||
{
|
||||
WRITE(HEATER_1_PIN,LOW);
|
||||
}
|
||||
|
@ -174,7 +178,6 @@ CRITICAL_SECTION_END;
|
|||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Takes hot end temperature value as input and returns corresponding raw value.
|
||||
// For a thermistor, it uses the RepRap thermistor temp table.
|
||||
|
@ -325,15 +328,18 @@ void tp_init()
|
|||
TIMSK0 |= (1<<OCIE0B);
|
||||
}
|
||||
|
||||
static unsigned char temp_count = 0;
|
||||
static unsigned long raw_temp_0_value = 0;
|
||||
static unsigned long raw_temp_1_value = 0;
|
||||
static unsigned long raw_temp_2_value = 0;
|
||||
static unsigned char temp_state = 0;
|
||||
|
||||
|
||||
// Timer 0 is shared with millies
|
||||
ISR(TIMER0_COMPB_vect)
|
||||
{
|
||||
//these variables are only accesible from the ISR, but static, so they don't loose their value
|
||||
static unsigned char temp_count = 0;
|
||||
static unsigned long raw_temp_0_value = 0;
|
||||
static unsigned long raw_temp_1_value = 0;
|
||||
static unsigned long raw_temp_2_value = 0;
|
||||
static unsigned char temp_state = 0;
|
||||
|
||||
switch(temp_state) {
|
||||
case 0: // Prepare TEMP_0
|
||||
#if (TEMP_0_PIN > -1)
|
||||
|
@ -434,18 +440,17 @@ ISR(TIMER0_COMPB_vect)
|
|||
raw_temp_2_value = 0;
|
||||
#ifdef HEATER_0_MAXTEMP
|
||||
#if (HEATER_0_PIN > -1)
|
||||
if(current_raw[0] >= maxttemp_0) {
|
||||
target_raw[0] = 0;
|
||||
if(current_raw[TEMPSENSOR_HOTEND] >= maxttemp) {
|
||||
target_raw[TEMPSENSOR_HOTEND] = 0;
|
||||
analogWrite(HEATER_0_PIN, 0);
|
||||
Serial.println("!! Temperature extruder 0 switched off. MAXTEMP triggered !!");
|
||||
kill();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HEATER_1_MAXTEMP
|
||||
#if (HEATER_1_PIN > -1)
|
||||
if(current_raw[TEMPSENSOR_AUX] >= maxttemp) {
|
||||
target_raw[TEMPSENSOR_AUX] = 0;
|
||||
if(current_raw[2] >= maxttemp_1) {
|
||||
target_raw[2] = 0;
|
||||
analogWrite(HEATER_2_PIN, 0);
|
||||
Serial.println("!! Temperature extruder 1 switched off. MAXTEMP triggered !!");
|
||||
kill()
|
||||
|
@ -454,8 +459,8 @@ ISR(TIMER0_COMPB_vect)
|
|||
#endif //MAXTEMP
|
||||
#ifdef HEATER_0_MINTEMP
|
||||
#if (HEATER_0_PIN > -1)
|
||||
if(current_raw[0] <= minttemp_0) {
|
||||
target_raw[0] = 0;
|
||||
if(current_raw[TEMPSENSOR_HOTEND] <= minttemp) {
|
||||
target_raw[TEMPSENSOR_HOTEND] = 0;
|
||||
analogWrite(HEATER_0_PIN, 0);
|
||||
Serial.println("!! Temperature extruder 0 switched off. MINTEMP triggered !!");
|
||||
kill();
|
||||
|
@ -464,8 +469,8 @@ ISR(TIMER0_COMPB_vect)
|
|||
#endif
|
||||
#ifdef HEATER_1_MINTEMP
|
||||
#if (HEATER_2_PIN > -1)
|
||||
if(current_raw[2] <= minttemp_1) {
|
||||
target_raw[2] = 0;
|
||||
if(current_raw[TEMPSENSOR_AUX] <= minttemp) {
|
||||
target_raw[TEMPSENSOR_AUX] = 0;
|
||||
analogWrite(HEATER_2_PIN, 0);
|
||||
Serial.println("!! Temperature extruder 1 switched off. MINTEMP triggered !!");
|
||||
kill();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue