Skip to content

Commit

Permalink
Fix for false detection of THERMAL RUNAWAY
Browse files Browse the repository at this point in the history
The idea is that if it is detected that the extruder cannot keep
the temperature, but well before reaching the alarm limit, the cooling
fan is throttled. If that does not help, and the alarm limit is reached,
the THERMAL RUNAWAY alarm is triggered as usual.
This avoids the frustration of having large prints destroyed by a falsely
detected thermal runaway when the only problem was that the cooling fan
speed was set too high.
  • Loading branch information
egilkv committed Aug 7, 2019
1 parent 61161b7 commit b91f3ff
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Firmware/Marlin.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ extern float max_pos[3];
extern bool axis_known_position[3];
extern float zprobe_zoffset;
extern int fanSpeed;
#ifdef TEMP_RUNAWAY_SAFETY_NET
extern unsigned char fanSpeedReduce; // reduction of fan speed due to "safety net"
#endif
extern void homeaxis(int axis);


Expand Down
3 changes: 3 additions & 0 deletions Firmware/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ float extruder_offset[NUM_EXTRUDER_OFFSETS][EXTRUDERS] = {

uint8_t active_extruder = 0;
int fanSpeed=0;
#ifdef TEMP_RUNAWAY_SAFETY_NET
unsigned char fanSpeedReduce=0; // reduction of fan speed due to "safety net"
#endif

#ifdef FWRETRACT
bool autoretract_enabled=false;
Expand Down
4 changes: 4 additions & 0 deletions Firmware/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,10 @@ void check_axes_activity()
disable_e1();
disable_e2();
}
#ifdef TEMP_RUNAWAY_SAFETY_NET
if (tail_fan_speed >= fanSpeedReduce) tail_fan_speed -= fanSpeedReduce;
else tail_fan_speed = 0;
#endif
#if defined(FAN_PIN) && FAN_PIN > -1
#ifdef FAN_KICK_START_TIME
static bool fan_kick = false;
Expand Down
31 changes: 31 additions & 0 deletions Firmware/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,9 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren
{
__hysteresis = TEMP_RUNAWAY_EXTRUDER_HYSTERESIS;
__timeout = TEMP_RUNAWAY_EXTRUDER_TIMEOUT;
#ifdef TEMP_RUNAWAY_SAFETY_NET
fanSpeedReduce = 0; // default assumption is no reduction in fan speed
#endif
}
#endif

Expand Down Expand Up @@ -1215,6 +1218,30 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren

if (temp_runaway_check_active)
{
#if defined(TEMP_RUNAWAY_SAFETY_NET) && TEMP_RUNAWAY_SAFETY_NET < TEMP_RUNAWAY_EXTRUDER_HYSTERESIS
if (!_isbed)
{
if (fanSpeed > 0 && _current_temperature < (_target_temperature - TEMP_RUNAWAY_SAFETY_NET))
{
// into safety net and beyond.
// implement trivial P regulator of fan speed against temperature
// over 60% of temperature span where runaway shutdown kicks in.
// this will reduce actual filament temperature when this mechanism is triggered
// which may happen to be not a bad thing for instance when bridging.
int reduce = (255.0 * (_target_temperature - TEMP_RUNAWAY_SAFETY_NET - _current_temperature)) /
(0.6 * (TEMP_RUNAWAY_EXTRUDER_HYSTERESIS - TEMP_RUNAWAY_SAFETY_NET));
fanSpeedReduce = (reduce < 255) ? reduce : 255;
#if 0 // DEBUG
static unsigned char did_warn; // reset when?
if (!did_warn)
{
LCD_ALERTMESSAGEPGM("FAN THROTTLED");
did_warn = 1;
}
#endif
}
}
#endif
// we are in range
if ((_isbed && (_target_temperature > TEMP_MAX_CHECKED_BED) && (_current_temperature > TEMP_MAX_CHECKED_BED)) || ((_current_temperature > (_target_temperature - __hysteresis)) && (_current_temperature < (_target_temperature + __hysteresis))))
{
Expand Down Expand Up @@ -1324,6 +1351,10 @@ void disable_heater()
WRITE(HEATER_BED_PIN,LOW);
#endif
#endif

#ifdef TEMP_RUNAWAY_SAFETY_NET
fanSpeedReduce = 0;
#endif
}

void max_temp_error(uint8_t e) {
Expand Down
3 changes: 3 additions & 0 deletions Firmware/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4942,6 +4942,9 @@ void lcd_print_stop() {
SET_OUTPUT(FAN_PIN);
WRITE(FAN_PIN, 0);
fanSpeed=0;
#ifdef TEMP_RUNAWAY_SAFETY_NET
fanSpeedReduce = 0;
#endif
}


Expand Down
1 change: 1 addition & 0 deletions Firmware/variants/1_75mm_MK1-RAMBo10a-E3Dv6full.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ ADDITIONAL FEATURES SETTINGS
#define TEMP_RUNAWAY_BED_HYSTERESIS 5
#define TEMP_RUNAWAY_BED_TIMEOUT 360

#define TEMP_RUNAWAY_SAFETY_NET 3 // temperature difference where "fan reduce safety net" feature kicks in
#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15
#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45

Expand Down
1 change: 1 addition & 0 deletions Firmware/variants/1_75mm_MK1-RAMBo13a-E3Dv6full.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ ADDITIONAL FEATURES SETTINGS
#define TEMP_RUNAWAY_BED_HYSTERESIS 5
#define TEMP_RUNAWAY_BED_TIMEOUT 360

#define TEMP_RUNAWAY_SAFETY_NET 3 // temperature difference where "fan reduce safety net" feature kicks in
#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15
#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ ADDITIONAL FEATURES SETTINGS
#define TEMP_RUNAWAY_BED_HYSTERESIS 5
#define TEMP_RUNAWAY_BED_TIMEOUT 360

#define TEMP_RUNAWAY_SAFETY_NET 3 // temperature difference where "fan reduce safety net" feature kicks in
#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15
#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ ADDITIONAL FEATURES SETTINGS
#define TEMP_RUNAWAY_BED_HYSTERESIS 5
#define TEMP_RUNAWAY_BED_TIMEOUT 360

#define TEMP_RUNAWAY_SAFETY_NET 3 // temperature difference where "fan reduce safety net" feature kicks in
#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15
#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45

Expand Down
1 change: 1 addition & 0 deletions Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ ADDITIONAL FEATURES SETTINGS
#define TEMP_RUNAWAY_BED_HYSTERESIS 5
#define TEMP_RUNAWAY_BED_TIMEOUT 360

#define TEMP_RUNAWAY_SAFETY_NET 3 // temperature difference where "fan reduce safety net" feature kicks in
#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15
#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45

Expand Down
1 change: 1 addition & 0 deletions Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ ADDITIONAL FEATURES SETTINGS
#define TEMP_RUNAWAY_BED_HYSTERESIS 5
#define TEMP_RUNAWAY_BED_TIMEOUT 360

#define TEMP_RUNAWAY_SAFETY_NET 3 // temperature difference where "fan reduce safety net" feature kicks in
#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15
#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45

Expand Down

0 comments on commit b91f3ff

Please sign in to comment.