Merge pull request #1716 from PavelSindler/preheat_fix_MK2

Preheat fix mk2
This commit is contained in:
PavelSindler 2019-04-10 13:35:35 +02:00 committed by GitHub
commit 270bed423e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 4 deletions

View File

@ -1113,6 +1113,7 @@ void setWatch()
#if (defined (TEMP_RUNAWAY_BED_HYSTERESIS) && TEMP_RUNAWAY_BED_TIMEOUT > 0) || (defined (TEMP_RUNAWAY_EXTRUDER_HYSTERESIS) && TEMP_RUNAWAY_EXTRUDER_TIMEOUT > 0) #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) void temp_runaway_check(int _heater_id, float _target_temperature, float _current_temperature, float _output, bool _isbed)
{ {
float __delta;
float __hysteresis = 0; float __hysteresis = 0;
int __timeout = 0; int __timeout = 0;
bool temp_runaway_check_active = false; bool temp_runaway_check_active = false;
@ -1172,9 +1173,20 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren
SERIAL_ECHOPGM(" T:"); 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]);
SERIAL_ECHOPGM(" delta:");
MYSERIAL.print(_current_temperature-__preheat_start[_heater_id]);*/
if (_current_temperature - __preheat_start[_heater_id] < 2) { //-// if (_current_temperature - __preheat_start[_heater_id] < 2) {
//-// if (_current_temperature - __preheat_start[_heater_id] < ((_isbed && (_current_temperature>105.0))?0.6:2.0)) {
__delta=2.0;
if(_isbed)
{
__delta=3.0;
if(_current_temperature>90.0) __delta=2.0;
if(_current_temperature>105.0) __delta=0.6;
}
if (_current_temperature - __preheat_start[_heater_id] < __delta) {
__preheat_errors[_heater_id]++; __preheat_errors[_heater_id]++;
/*SERIAL_ECHOPGM(" Preheat errors:"); /*SERIAL_ECHOPGM(" Preheat errors:");
MYSERIAL.println(__preheat_errors[_heater_id]);*/ MYSERIAL.println(__preheat_errors[_heater_id]);*/
@ -1184,7 +1196,7 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren
__preheat_errors[_heater_id] = 0; __preheat_errors[_heater_id] = 0;
} }
if (__preheat_errors[_heater_id] > ((_isbed) ? 2 : 5)) if (__preheat_errors[_heater_id] > ((_isbed) ? 3 : 5))
{ {
if (farm_mode) { prusa_statistics(0); } if (farm_mode) { prusa_statistics(0); }
temp_runaway_stop(true, _isbed); temp_runaway_stop(true, _isbed);
@ -1195,10 +1207,15 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren
} }
} }
if (_current_temperature >= _target_temperature && temp_runaway_status[_heater_id] == TempRunaway_PREHEAT) //-// if (_current_temperature >= _target_temperature && temp_runaway_status[_heater_id] == TempRunaway_PREHEAT)
if ((_current_temperature > (_target_temperature - __hysteresis)) && temp_runaway_status[_heater_id] == TempRunaway_PREHEAT)
{ {
/*SERIAL_ECHOPGM("Heater:");
MYSERIAL.print(_heater_id);
MYSERIAL.println(" ->tempRunaway");*/
temp_runaway_status[_heater_id] = TempRunaway_ACTIVE; temp_runaway_status[_heater_id] = TempRunaway_ACTIVE;
temp_runaway_check_active = false; temp_runaway_check_active = false;
temp_runaway_error_counter[_heater_id] = 0;
} }
if (_output > 0) if (_output > 0)