Merge pull request #1249 from PavelSindler/thermal_protections_v2

New preheat error, EXTRUDE_MINTEMP unified with MK3 and MK2.5
This commit is contained in:
MRprusa3d 2018-10-16 10:45:26 +02:00 committed by GitHub
commit a8e8a30dee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 69 additions and 54 deletions

18
.gitignore vendored Normal file
View File

@ -0,0 +1,18 @@
################################################################################
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
################################################################################
/Firmware/.vs/Firmware/v14
/Firmware/Doc/html/search
/Firmware/Doc/html
/Firmware/Doc/latex
/Firmware/__vm
/html
/latex
/Doxyfile
/Firmware/Configuration_prusa.h
/Firmware/Marlin_main.cpp~RF12cfae7.TMP
/Firmware/Firmware.vcxproj.filters
/Firmware/Firmware.vcxproj
/Firmware/Firmware.sln
/Firmware/Firmware - Shortcut.lnk

View File

@ -1106,6 +1106,9 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren
static int __preheat_errors[2] = { 0,0}; static int __preheat_errors[2] = { 0,0};
if (millis() - temp_runaway_timer[_heater_id] > 2000)
{
#ifdef TEMP_RUNAWAY_BED_TIMEOUT #ifdef TEMP_RUNAWAY_BED_TIMEOUT
if (_isbed) if (_isbed)
{ {
@ -1121,9 +1124,6 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren
} }
#endif #endif
if (millis() - temp_runaway_timer[_heater_id] > 2000)
{
temp_runaway_timer[_heater_id] = millis(); temp_runaway_timer[_heater_id] = millis();
if (_output == 0) if (_output == 0)
{ {
@ -1147,19 +1147,14 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren
} }
} }
if (temp_runaway_status[_heater_id] == TempRunaway_PREHEAT) if ((_current_temperature < _target_temperature) && (temp_runaway_status[_heater_id] == TempRunaway_PREHEAT))
{
if (_current_temperature < ((_isbed) ? (0.8 * _target_temperature) : 150)) //check only in area where temperature is changing fastly for heater, check to 0.8 x target temperature for bed
{ {
__preheat_counter[_heater_id]++; __preheat_counter[_heater_id]++;
//SERIAL_ECHOPGM("counter[0]:"); MYSERIAL.println(__preheat_counter[0]);
//SERIAL_ECHOPGM("counter[1]:"); MYSERIAL.println(__preheat_counter[1]);
//SERIAL_ECHOPGM("_isbed"); MYSERIAL.println(_isbed);
if (__preheat_counter[_heater_id] > ((_isbed) ? 16 : 8)) // periodicaly check if current temperature changes if (__preheat_counter[_heater_id] > ((_isbed) ? 16 : 8)) // periodicaly check if current temperature changes
{ {
/*SERIAL_ECHOLNPGM("Heater:"); /*SERIAL_ECHOPGM("Heater:");
MYSERIAL.print(_heater_id); MYSERIAL.print(_heater_id);
SERIAL_ECHOPGM(" Current temperature:"); SERIAL_ECHOPGM(" T:");
MYSERIAL.print(_current_temperature); MYSERIAL.print(_current_temperature);
SERIAL_ECHOPGM(" Tstart:"); SERIAL_ECHOPGM(" Tstart:");
MYSERIAL.print(__preheat_start[_heater_id]);*/ MYSERIAL.print(__preheat_start[_heater_id]);*/
@ -1184,7 +1179,6 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren
__preheat_counter[_heater_id] = 0; __preheat_counter[_heater_id] = 0;
} }
} }
}
if (_current_temperature >= _target_temperature && temp_runaway_status[_heater_id] == TempRunaway_PREHEAT) if (_current_temperature >= _target_temperature && temp_runaway_status[_heater_id] == TempRunaway_PREHEAT)
{ {
@ -1192,7 +1186,7 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren
temp_runaway_check_active = false; temp_runaway_check_active = false;
} }
if (!temp_runaway_check_active && _output > 0) if (_output > 0)
{ {
temp_runaway_check_active = true; temp_runaway_check_active = true;
} }
@ -1201,7 +1195,7 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren
if (temp_runaway_check_active) if (temp_runaway_check_active)
{ {
// we are in range // we are in range
if (_target_temperature - __hysteresis < _current_temperature && _current_temperature < _target_temperature + __hysteresis) if ((_current_temperature > (_target_temperature - __hysteresis)) && (_current_temperature < (_target_temperature + __hysteresis)))
{ {
temp_runaway_check_active = false; temp_runaway_check_active = false;
temp_runaway_error_counter[_heater_id] = 0; temp_runaway_error_counter[_heater_id] = 0;
@ -1233,6 +1227,9 @@ void temp_runaway_stop(bool isPreheat, bool isBed)
card.sdprinting = false; card.sdprinting = false;
card.closefile(); card.closefile();
} }
// Clean the input command queue
// This is necessary, because in command queue there can be commands which would later set heater or bed temperature.
cmdqueue_reset();
disable_heater(); disable_heater();
disable_x(); disable_x();

View File

@ -114,7 +114,7 @@ EXTRUDER SETTINGS
#endif #endif
// Extrude mintemp // Extrude mintemp
#define EXTRUDE_MINTEMP 130 #define EXTRUDE_MINTEMP 175
// Extruder cooling fans // Extruder cooling fans
#define EXTRUDER_0_AUTO_FAN_PIN 8 #define EXTRUDER_0_AUTO_FAN_PIN 8

View File

@ -114,7 +114,7 @@ EXTRUDER SETTINGS
#endif #endif
// Extrude mintemp // Extrude mintemp
#define EXTRUDE_MINTEMP 130 #define EXTRUDE_MINTEMP 175
// Extruder cooling fans // Extruder cooling fans
#define EXTRUDER_0_AUTO_FAN_PIN 8 #define EXTRUDER_0_AUTO_FAN_PIN 8

View File

@ -114,7 +114,7 @@ EXTRUDER SETTINGS
#endif #endif
// Extrude mintemp // Extrude mintemp
#define EXTRUDE_MINTEMP 130 #define EXTRUDE_MINTEMP 175
// Extruder cooling fans // Extruder cooling fans
#define EXTRUDER_0_AUTO_FAN_PIN 8 #define EXTRUDER_0_AUTO_FAN_PIN 8

View File

@ -114,7 +114,7 @@ EXTRUDER SETTINGS
#endif #endif
// Extrude mintemp // Extrude mintemp
#define EXTRUDE_MINTEMP 130 #define EXTRUDE_MINTEMP 175
// Extruder cooling fans // Extruder cooling fans
#define EXTRUDER_0_AUTO_FAN_PIN 8 #define EXTRUDER_0_AUTO_FAN_PIN 8