Remove unused code guarded by WATCH_TEMP_PERIOD macro as most of the functionality is duplicate to what is implemented in temp_runaway_check(). This will release us from porting setWatch() to unified preheat menu and maintaining it.

This commit is contained in:
Marek Bel 2019-08-27 20:05:10 +02:00
parent 3da43ae8c2
commit 269aef1696
6 changed files with 2 additions and 97 deletions

View file

@ -113,11 +113,6 @@ extern PGM_P sPrinterName;
// #define PS_DEFAULT_OFF
// This makes temp sensor 1 a redundant sensor for sensor 0. If the temperatures difference between these sensors is to high the print will be aborted.
//#define TEMP_SENSOR_1_AS_REDUNDANT
#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10
// Actual temperature must be close to target for this long before M109 returns success
#define TEMP_RESIDENCY_TIME 3 // (seconds)
#define TEMP_HYSTERESIS 5 // (degC) range of +/- temperatures considered "close" to the target one

View file

@ -10,14 +10,6 @@
#endif
#define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
//// Heating sanity check:
// This waits for the watch period in milliseconds whenever an M104 or M109 increases the target temperatureLCD_PROGRESS_BAR
// If the temperature has not increased at the end of that period, the target temperature is set to zero.
// It can be reset with another M104/M109. This check is also only triggered if the target temperature and the current temperature
// differ by at least 2x WATCH_TEMP_INCREASE
//#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.
@ -400,10 +392,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
//============================= Define Defines ============================
//===========================================================================
#if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT
#error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
#endif
#if EXTRUDERS > 1 && defined HEATERS_PARALLEL
#error "You cannot use HEATERS_PARALLEL if EXTRUDERS > 1"
#endif

View file

@ -5880,7 +5880,6 @@ Sigma_Exit:
{
setTargetHotendSafe(code_value(), extruder);
}
setWatch();
break;
}
@ -6025,7 +6024,6 @@ Sigma_Exit:
}
#endif
setWatch();
codenum = _millis();
/* See if we are heating up or cooling down */

View file

@ -73,10 +73,6 @@ int current_voltage_raw_bed = 0;
int current_temperature_bed_raw = 0;
float current_temperature_bed = 0.0;
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
int redundant_temperature_raw = 0;
float redundant_temperature = 0.0;
#endif
#ifdef PIDTEMP
@ -175,13 +171,8 @@ static int bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP;
static int bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP;
#endif
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
static void *heater_ttbl_map[2] = {(void *)HEATER_0_TEMPTABLE, (void *)HEATER_1_TEMPTABLE };
static uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN };
#else
static void *heater_ttbl_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( (void *)HEATER_0_TEMPTABLE, (void *)HEATER_1_TEMPTABLE, (void *)HEATER_2_TEMPTABLE );
static uint8_t heater_ttbllen_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN, HEATER_2_TEMPTABLE_LEN );
#endif
static void *heater_ttbl_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( (void *)HEATER_0_TEMPTABLE, (void *)HEATER_1_TEMPTABLE, (void *)HEATER_2_TEMPTABLE );
static uint8_t heater_ttbllen_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN, HEATER_2_TEMPTABLE_LEN );
static float analog2temp(int raw, uint8_t e);
static float analog2tempBed(int raw);
@ -195,11 +186,6 @@ enum TempRunawayStates
TempRunaway_ACTIVE = 2,
};
#ifdef WATCH_TEMP_PERIOD
int watch_start_temp[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0,0,0);
unsigned long watchmillis[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0,0,0);
#endif //WATCH_TEMP_PERIOD
#ifndef SOFT_PWM_SCALE
#define SOFT_PWM_SCALE 0
#endif
@ -728,34 +714,6 @@ void manage_heater()
{
soft_pwm[e] = 0;
}
#ifdef WATCH_TEMP_PERIOD
if(watchmillis[e] && _millis() - watchmillis[e] > WATCH_TEMP_PERIOD)
{
if(degHotend(e) < watch_start_temp[e] + WATCH_TEMP_INCREASE)
{
setTargetHotend(0, e);
LCD_MESSAGEPGM("Heating failed");
SERIAL_ECHO_START;
SERIAL_ECHOLN("Heating failed");
}else{
watchmillis[e] = 0;
}
}
#endif
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
if(fabs(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) {
disable_heater();
if(IsStopped() == false) {
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM("Extruder switched off. Temperature difference between temp sensors is too high !");
LCD_ALERTMESSAGEPGM("Err: REDUNDANT TEMP ERROR");
}
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
Stop();
#endif
}
#endif
} // End extruder for loop
#define FAN_CHECK_PERIOD 5000 //5s
@ -907,11 +865,7 @@ void manage_heater()
// Derived from RepRap FiveD extruder::getTemperature()
// For hot end temperature measurement.
static float analog2temp(int raw, uint8_t e) {
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
if(e > EXTRUDERS)
#else
if(e >= EXTRUDERS)
#endif
{
SERIAL_ERROR_START;
SERIAL_ERROR((int)e);
@ -1054,10 +1008,6 @@ static void updateTemperaturesFromRawValues()
current_temperature_bed = analog2tempBed(current_temperature_bed_raw);
#endif //DEBUG_HEATER_BED_SIM
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
redundant_temperature = analog2temp(redundant_temperature_raw, 1);
#endif
CRITICAL_SECTION_START;
temp_meas_ready = false;
CRITICAL_SECTION_END;
@ -1221,20 +1171,6 @@ void tp_init()
#endif //BED_MAXTEMP
}
void setWatch()
{
#ifdef WATCH_TEMP_PERIOD
for (int e = 0; e < EXTRUDERS; e++)
{
if(degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE * 2))
{
watch_start_temp[e] = degHotend(e);
watchmillis[e] = _millis();
}
}
#endif
}
#if (defined (TEMP_RUNAWAY_BED_HYSTERESIS) && TEMP_RUNAWAY_BED_TIMEOUT > 0) || (defined (TEMP_RUNAWAY_EXTRUDER_HYSTERESIS) && TEMP_RUNAWAY_EXTRUDER_TIMEOUT > 0)
void temp_runaway_check(int _heater_id, float _target_temperature, float _current_temperature, float _output, bool _isbed)
{

View file

@ -74,9 +74,6 @@ extern int current_voltage_raw_pwr;
extern int current_voltage_raw_bed;
#endif
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
extern float redundant_temperature;
#endif
#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
extern unsigned char soft_pwm_bed;
@ -220,7 +217,6 @@ FORCE_INLINE bool isCoolingBed() {
int getHeaterPower(int heater);
void disable_heater();
void setWatch();
void updatePID();

View file

@ -1670,7 +1670,6 @@ static void lcd_preheat_pla()
setTargetHotend0(PLA_PREHEAT_HOTEND_TEMP);
if (!wizard_active) setTargetBed(PLA_PREHEAT_HPB_TEMP);
lcd_return_to_status();
setWatch(); // heater sanity check timer
if (wizard_active) lcd_wizard(WizState::Unload);
}
@ -1679,7 +1678,6 @@ static void lcd_preheat_asa()
setTargetHotend0(ASA_PREHEAT_HOTEND_TEMP);
if (!wizard_active) setTargetBed(ASA_PREHEAT_HPB_TEMP);
lcd_return_to_status();
setWatch(); // heater sanity check timer
if (wizard_active) lcd_wizard(WizState::Unload);
}
@ -1688,7 +1686,6 @@ static void lcd_preheat_abs()
setTargetHotend0(ABS_PREHEAT_HOTEND_TEMP);
if (!wizard_active) setTargetBed(ABS_PREHEAT_HPB_TEMP);
lcd_return_to_status();
setWatch(); // heater sanity check timer
if (wizard_active) lcd_wizard(WizState::Unload);
}
@ -1697,7 +1694,6 @@ static void lcd_preheat_pp()
setTargetHotend0(PP_PREHEAT_HOTEND_TEMP);
if (!wizard_active) setTargetBed(PP_PREHEAT_HPB_TEMP);
lcd_return_to_status();
setWatch(); // heater sanity check timer
if (wizard_active) lcd_wizard(WizState::Unload);
}
@ -1706,7 +1702,6 @@ static void lcd_preheat_pet()
setTargetHotend0(PET_PREHEAT_HOTEND_TEMP);
if (!wizard_active) setTargetBed(PET_PREHEAT_HPB_TEMP);
lcd_return_to_status();
setWatch(); // heater sanity check timer
if (wizard_active) lcd_wizard(WizState::Unload);
}
@ -1715,7 +1710,6 @@ static void lcd_preheat_hips()
setTargetHotend0(HIPS_PREHEAT_HOTEND_TEMP);
if (!wizard_active) setTargetBed(HIPS_PREHEAT_HPB_TEMP);
lcd_return_to_status();
setWatch(); // heater sanity check timer
if (wizard_active) lcd_wizard(WizState::Unload);
}
@ -1724,7 +1718,6 @@ static void lcd_preheat_flex()
setTargetHotend0(FLEX_PREHEAT_HOTEND_TEMP);
if (!wizard_active) setTargetBed(FLEX_PREHEAT_HPB_TEMP);
lcd_return_to_status();
setWatch(); // heater sanity check timer
if (wizard_active) lcd_wizard(WizState::Unload);
}
@ -2330,7 +2323,6 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed)
if (eFilamentAction == FilamentAction::Preheat)
{
eFilamentAction = FilamentAction::None;
setWatch();
lcd_return_to_status();
return;
}