Skip to content

Commit

Permalink
TM: Restore extruder autofan state when stopping/resuming
Browse files Browse the repository at this point in the history
During thermal errors all fans are set to full speed.

When the print is resumed or stopped *and* the thermal error is gone,
also restore the autofan state.

Fixes prusa3d#3893
  • Loading branch information
wavexx committed Jan 15, 2023
1 parent fffb15c commit 193884a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
10 changes: 10 additions & 0 deletions Firmware/fancheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,3 +294,13 @@ void hotendFanSetFullSpeed()
#endif //FAN_SOFT_PWM
fanSpeed = 255;
}

void hotendDefaultAutoFanState()
{
#if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1)
#ifdef EXTRUDER_ALTFAN_DETECT
altfanStatus.altfanOverride = eeprom_read_byte((uint8_t*)EEPROM_ALTFAN_OVERRIDE);
#endif
setExtruderAutoFanState(1);
#endif
}
1 change: 1 addition & 0 deletions Firmware/fancheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ void checkExtruderAutoFans();

void checkFans();
void hotendFanSetFullSpeed();
void hotendDefaultAutoFanState();
10 changes: 9 additions & 1 deletion Firmware/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5436,7 +5436,12 @@ void lcd_resume_print()
st_synchronize();
custom_message_type = CustomMsg::Resuming;
isPrintPaused = false;
Stopped = false; // resume processing USB commands again

// resume processing USB commands again and restore hotend fan state (in case the print was
// stopped due to a thermal error)
hotendDefaultAutoFanState();
Stopped = false;

restore_print_from_ram_and_continue(default_retraction);
pause_time += (_millis() - start_pause_print); //accumulate time when print is paused for correct statistics calculation
refresh_cmd_timeout();
Expand Down Expand Up @@ -6074,6 +6079,9 @@ void lcd_print_stop_finish()
} else {
// Turn off the print fan
fanSpeed = 0;

// restore the auto hotend state
hotendDefaultAutoFanState();
}

if (mmu_enabled) extr_unload(); //M702 C
Expand Down

0 comments on commit 193884a

Please sign in to comment.