From 0184f06dcf647e7dd18f6bca124a78eb8efc4767 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Thu, 27 Sep 2018 04:23:00 +0200 Subject: [PATCH] preHeatError correction of preHeatError detection --- Firmware/temperature.cpp | 91 +++++++++---------- .../variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h | 2 +- .../variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h | 2 +- .../variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h | 2 +- .../variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h | 2 +- .../variants/1_75mm_MK3-EINSy10a-E3Dv6full.h | 2 +- 6 files changed, 49 insertions(+), 52 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 6a21b825..7e9d4033 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -1210,24 +1210,24 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren static int __preheat_errors[2] = { 0,0}; -#ifdef TEMP_RUNAWAY_BED_TIMEOUT - if (_isbed) - { - __hysteresis = TEMP_RUNAWAY_BED_HYSTERESIS; - __timeout = TEMP_RUNAWAY_BED_TIMEOUT; - } -#endif -#ifdef TEMP_RUNAWAY_EXTRUDER_TIMEOUT - if (!_isbed) - { - __hysteresis = TEMP_RUNAWAY_EXTRUDER_HYSTERESIS; - __timeout = TEMP_RUNAWAY_EXTRUDER_TIMEOUT; - } -#endif - if (millis() - temp_runaway_timer[_heater_id] > 2000) { +#ifdef TEMP_RUNAWAY_BED_TIMEOUT + if (_isbed) + { + __hysteresis = TEMP_RUNAWAY_BED_HYSTERESIS; + __timeout = TEMP_RUNAWAY_BED_TIMEOUT; + } +#endif +#ifdef TEMP_RUNAWAY_EXTRUDER_TIMEOUT + if (!_isbed) + { + __hysteresis = TEMP_RUNAWAY_EXTRUDER_HYSTERESIS; + __timeout = TEMP_RUNAWAY_EXTRUDER_TIMEOUT; + } +#endif + temp_runaway_timer[_heater_id] = millis(); if (_output == 0) { @@ -1251,39 +1251,36 @@ 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]++; + if (__preheat_counter[_heater_id] > ((_isbed) ? 16 : 8)) // periodicaly check if current temperature changes { - __preheat_counter[_heater_id]++; - if (__preheat_counter[_heater_id] > ((_isbed) ? 16 : 8)) // periodicaly check if current temperature changes - { - /*SERIAL_ECHOPGM("Heater:"); - MYSERIAL.print(_heater_id); - SERIAL_ECHOPGM(" T:"); - MYSERIAL.print(_current_temperature); - SERIAL_ECHOPGM(" Tstart:"); - MYSERIAL.print(__preheat_start[_heater_id]);*/ - - if (_current_temperature - __preheat_start[_heater_id] < 2) { - __preheat_errors[_heater_id]++; - /*SERIAL_ECHOPGM(" Preheat errors:"); - MYSERIAL.println(__preheat_errors[_heater_id]);*/ - } - else { - //SERIAL_ECHOLNPGM(""); - __preheat_errors[_heater_id] = 0; - } - - if (__preheat_errors[_heater_id] > ((_isbed) ? 2 : 5)) - { - if (farm_mode) { prusa_statistics(0); } - temp_runaway_stop(true, _isbed); - if (farm_mode) { prusa_statistics(91); } - } - __preheat_start[_heater_id] = _current_temperature; - __preheat_counter[_heater_id] = 0; + /*SERIAL_ECHOPGM("Heater:"); + MYSERIAL.print(_heater_id); + SERIAL_ECHOPGM(" T:"); + MYSERIAL.print(_current_temperature); + SERIAL_ECHOPGM(" Tstart:"); + MYSERIAL.print(__preheat_start[_heater_id]);*/ + + if (_current_temperature - __preheat_start[_heater_id] < 2) { + __preheat_errors[_heater_id]++; + /*SERIAL_ECHOPGM(" Preheat errors:"); + MYSERIAL.println(__preheat_errors[_heater_id]);*/ } + else { + //SERIAL_ECHOLNPGM(""); + __preheat_errors[_heater_id] = 0; + } + + if (__preheat_errors[_heater_id] > ((_isbed) ? 2 : 5)) + { + if (farm_mode) { prusa_statistics(0); } + temp_runaway_stop(true, _isbed); + if (farm_mode) { prusa_statistics(91); } + } + __preheat_start[_heater_id] = _current_temperature; + __preheat_counter[_heater_id] = 0; } } @@ -1293,7 +1290,7 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren temp_runaway_check_active = false; } - if (!temp_runaway_check_active && _output > 0) + if (_output > 0) { temp_runaway_check_active = true; } @@ -1302,7 +1299,7 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren if (temp_runaway_check_active) { // 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_error_counter[_heater_id] = 0; diff --git a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h index 9783e9f6..77814ead 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h @@ -128,7 +128,7 @@ EXTRUDER SETTINGS #endif // Extrude mintemp -#define EXTRUDE_MINTEMP 130 +#define EXTRUDE_MINTEMP 175 // Extruder cooling fans #define EXTRUDER_0_AUTO_FAN_PIN 8 diff --git a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h index 3ac39750..1cc2ff3b 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h @@ -128,7 +128,7 @@ EXTRUDER SETTINGS #endif // Extrude mintemp -#define EXTRUDE_MINTEMP 130 +#define EXTRUDE_MINTEMP 175 // Extruder cooling fans #define EXTRUDER_0_AUTO_FAN_PIN 8 diff --git a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h index 626c64e8..e60f412c 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h @@ -182,7 +182,7 @@ #endif // Extrude mintemp -#define EXTRUDE_MINTEMP 180 +#define EXTRUDE_MINTEMP 175 // Extruder cooling fans #define EXTRUDER_0_AUTO_FAN_PIN 8 diff --git a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h index cb13e8ad..a34941bf 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h @@ -183,7 +183,7 @@ #endif // Extrude mintemp -#define EXTRUDE_MINTEMP 180 +#define EXTRUDE_MINTEMP 175 // Extruder cooling fans #define EXTRUDER_0_AUTO_FAN_PIN 8 diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h index ea1951f4..3b077fe4 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h @@ -299,7 +299,7 @@ #endif // Extrude mintemp -#define EXTRUDE_MINTEMP 190 +#define EXTRUDE_MINTEMP 175 // Extruder cooling fans #define EXTRUDER_0_AUTO_FAN_PIN 8