FAN Error fix - Initial
This commit is contained in:
parent
521c5eb8ef
commit
fd01942db8
7 changed files with 55 additions and 40 deletions
|
@ -240,6 +240,11 @@ void prepare_move();
|
|||
void kill(const char *full_screen_message = NULL, unsigned char id = 0);
|
||||
void Stop();
|
||||
|
||||
#define PRINTING_TYPE_SD 0
|
||||
#define PRINTING_TYPE_USB 1
|
||||
#define PRINTING_TYPE_NONE 2
|
||||
extern uint8_t saved_printing_type;
|
||||
|
||||
bool IsStopped();
|
||||
|
||||
//put an ASCII command at the end of the current buffer.
|
||||
|
|
|
@ -142,10 +142,6 @@
|
|||
//Macro for print fan speed
|
||||
#define FAN_PULSE_WIDTH_LIMIT ((fanSpeed > 100) ? 3 : 4) //time in ms
|
||||
|
||||
#define PRINTING_TYPE_SD 0
|
||||
#define PRINTING_TYPE_USB 1
|
||||
#define PRINTING_TYPE_NONE 2
|
||||
|
||||
//filament types
|
||||
#define FILAMENT_DEFAULT 0
|
||||
#define FILAMENT_FLEX 1
|
||||
|
@ -378,7 +374,7 @@ boolean chdkActive = false;
|
|||
//! @{
|
||||
bool saved_printing = false; //!< Print is paused and saved in RAM
|
||||
static uint32_t saved_sdpos = 0; //!< SD card position, or line number in case of USB printing
|
||||
static uint8_t saved_printing_type = PRINTING_TYPE_SD;
|
||||
uint8_t saved_printing_type = PRINTING_TYPE_SD;
|
||||
static float saved_pos[4] = { 0, 0, 0, 0 };
|
||||
//! Feedrate hopefully derived from an active block of the planner at the time the print has been canceled, in mm/min.
|
||||
static float saved_feedrate2 = 0;
|
||||
|
@ -1751,12 +1747,22 @@ void loop()
|
|||
{
|
||||
is_usb_printing = false;
|
||||
}
|
||||
|
||||
|
||||
#ifdef FANCHECK
|
||||
if ((saved_printing_type == PRINTING_TYPE_USB) && fan_check_error)
|
||||
{
|
||||
process_commands(); //used to process pausing
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
host_keepalive(); //prevent timeouts since usb processing is disabled until print is resumed. This is for a crude way of pausing a print on all hosts.
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (prusa_sd_card_upload)
|
||||
{
|
||||
//we read byte-by byte
|
||||
serial_read_stream();
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
get_command();
|
||||
|
@ -3450,22 +3456,16 @@ extern uint8_t st_backlash_y;
|
|||
|
||||
void process_commands()
|
||||
{
|
||||
#ifdef FANCHECK
|
||||
if (fan_check_error){
|
||||
if( fan_check_error == EFCE_DETECTED ){
|
||||
fan_check_error = EFCE_REPORTED;
|
||||
|
||||
if(is_usb_printing){
|
||||
SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE);
|
||||
}
|
||||
else{
|
||||
lcd_pause_print();
|
||||
}
|
||||
|
||||
} // otherwise it has already been reported, so just ignore further processing
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifdef FANCHECK
|
||||
if(fan_check_error){
|
||||
if(fan_check_error == EFCE_DETECTED){
|
||||
fan_check_error = EFCE_REPORTED;
|
||||
// SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED);
|
||||
lcd_pause_print();
|
||||
} // otherwise it has already been reported, so just ignore further processing
|
||||
if(saved_printing_type == PRINTING_TYPE_USB) return; //ignore usb stream.
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!buflen) return; //empty command
|
||||
#ifdef FILAMENT_RUNOUT_SUPPORT
|
||||
|
@ -10154,7 +10154,8 @@ void restore_print_from_ram_and_continue(float e_move)
|
|||
|
||||
#ifdef FANCHECK
|
||||
// Do not allow resume printing if fans are still not ok
|
||||
if( fan_check_error != EFCE_OK )return;
|
||||
if ((fan_check_error != EFCE_OK) && (fan_check_error != EFCE_FIXED)) return;
|
||||
if (fan_check_error == EFCE_FIXED) fan_check_error = EFCE_OK; //reenable serial stream processing if printing from usb
|
||||
#endif
|
||||
|
||||
// for (int axis = X_AXIS; axis <= E_AXIS; axis++)
|
||||
|
@ -10208,6 +10209,7 @@ void restore_print_from_ram_and_continue(float e_move)
|
|||
}
|
||||
SERIAL_PROTOCOLLNRPGM(MSG_OK); //dummy response because of octoprint is waiting for this
|
||||
lcd_setstatuspgm(_T(WELCOME_MSG));
|
||||
saved_printing_type = PRINTING_TYPE_NONE;
|
||||
saved_printing = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -129,4 +129,5 @@ const char MSG_ENDSTOP_OPEN[] PROGMEM_N1 = "open"; ////
|
|||
const char MSG_POWERUP[] PROGMEM_N1 = "PowerUp"; ////
|
||||
const char MSG_ERR_STOPPED[] PROGMEM_N1 = "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"; ////
|
||||
const char MSG_ENDSTOP_HIT[] PROGMEM_N1 = "TRIGGERED"; ////
|
||||
const char MSG_OCTOPRINT_PAUSE[] PROGMEM_N1 = "// action:pause"; ////
|
||||
const char MSG_OCTOPRINT_PAUSED[] PROGMEM_N1 = "// action:paused"; ////
|
||||
const char MSG_OCTOPRINT_RESUMED[] PROGMEM_N1 = "// action:resumed"; ////
|
||||
|
|
|
@ -130,7 +130,8 @@ extern const char MSG_ERR_STOPPED[];
|
|||
extern const char MSG_ENDSTOP_HIT[];
|
||||
extern const char MSG_EJECT_FILAMENT[];
|
||||
extern const char MSG_CUT_FILAMENT[];
|
||||
extern const char MSG_OCTOPRINT_PAUSE[];
|
||||
extern const char MSG_OCTOPRINT_PAUSED[];
|
||||
extern const char MSG_OCTOPRINT_RESUMED[];
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
|
|
@ -503,7 +503,7 @@ void checkFanSpeed()
|
|||
// drop the fan_check_error flag when both fans are ok
|
||||
if( fan_speed_errors[0] == 0 && fan_speed_errors[1] == 0 && fan_check_error == EFCE_REPORTED){
|
||||
// we may even send some info to the LCD from here
|
||||
fan_check_error = EFCE_OK;
|
||||
fan_check_error = EFCE_FIXED;
|
||||
}
|
||||
|
||||
if ((fan_speed_errors[0] > max_extruder_fan_errors) && fans_check_enabled) {
|
||||
|
@ -529,21 +529,21 @@ static void fanSpeedErrorBeep(const char *serialMsg, const char *lcdMsg){
|
|||
}
|
||||
|
||||
void fanSpeedError(unsigned char _fan) {
|
||||
if (get_message_level() != 0 && isPrintPaused) return;
|
||||
//to ensure that target temp. is not set to zero in case taht we are resuming print
|
||||
if (get_message_level() != 0 && isPrintPaused) return;
|
||||
//to ensure that target temp. is not set to zero in case that we are resuming print
|
||||
if (card.sdprinting || is_usb_printing) {
|
||||
if (heating_status != 0) {
|
||||
lcd_print_stop();
|
||||
}
|
||||
else {
|
||||
fan_check_error = EFCE_DETECTED;
|
||||
fan_check_error = EFCE_DETECTED; //plans error for next processed command
|
||||
}
|
||||
}
|
||||
else {
|
||||
SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); //for octoprint
|
||||
setTargetHotend0(0);
|
||||
heating_status = 0;
|
||||
fan_check_error = EFCE_REPORTED;
|
||||
// SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); //Why pause octoprint? is_usb_printing would be true in that case, so there is no need for this.
|
||||
setTargetHotend0(0);
|
||||
heating_status = 0;
|
||||
fan_check_error = EFCE_REPORTED;
|
||||
}
|
||||
switch (_fan) {
|
||||
case 0: // extracting the same code from case 0 and case 1 into a function saves 72B
|
||||
|
@ -553,7 +553,7 @@ void fanSpeedError(unsigned char _fan) {
|
|||
fanSpeedErrorBeep(PSTR("Print fan speed is lower than expected"), PSTR("Err: PRINT FAN ERROR") );
|
||||
break;
|
||||
}
|
||||
SERIAL_PROTOCOLLNRPGM(MSG_OK);
|
||||
// SERIAL_PROTOCOLLNRPGM(MSG_OK); //This ok messes things up with octoprint.
|
||||
}
|
||||
#endif //(defined(TACH_0) && TACH_0 >-1) || (defined(TACH_1) && TACH_1 > -1)
|
||||
|
||||
|
|
|
@ -241,6 +241,7 @@ void checkExtruderAutoFans();
|
|||
|
||||
enum {
|
||||
EFCE_OK = 0, //!< normal operation, both fans are ok
|
||||
EFCE_FIXED, //!< previous fan error was fixed
|
||||
EFCE_DETECTED, //!< fan error detected, but not reported yet
|
||||
EFCE_REPORTED //!< fan error detected and reported to LCD and serial
|
||||
};
|
||||
|
|
|
@ -1650,7 +1650,7 @@ void lcd_pause_print()
|
|||
{
|
||||
lcd_commands_type = LcdCommands::LongPause;
|
||||
}
|
||||
SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); //pause for octoprint
|
||||
SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); //pause for octoprint
|
||||
}
|
||||
|
||||
|
||||
|
@ -6322,13 +6322,14 @@ static void lcd_test_menu()
|
|||
void lcd_resume_print()
|
||||
{
|
||||
lcd_return_to_status();
|
||||
lcd_reset_alert_level();
|
||||
lcd_reset_alert_level();
|
||||
lcd_setstatuspgm(_T(MSG_RESUMING_PRINT));
|
||||
lcd_reset_alert_level(); //for fan speed error
|
||||
restore_print_from_ram_and_continue(0.0);
|
||||
pause_time += (_millis() - start_pause_print); //accumulate time when print is paused for correct statistics calculation
|
||||
refresh_cmd_timeout();
|
||||
isPrintPaused = false;
|
||||
SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_RESUMED); //resume octoprint
|
||||
}
|
||||
|
||||
static void change_sheet()
|
||||
|
@ -6461,6 +6462,11 @@ static void lcd_main_menu()
|
|||
}
|
||||
|
||||
|
||||
#ifdef FANCHECK
|
||||
checkFanSpeed(); //Check manually to get most recent fan speed status
|
||||
if((fan_check_error == EFCE_FIXED) && (saved_printing_type == PRINTING_TYPE_USB))
|
||||
MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT
|
||||
#endif
|
||||
|
||||
#ifdef SDSUPPORT
|
||||
if (card.cardOK || lcd_commands_type == LcdCommands::Layer1Cal)
|
||||
|
@ -6475,9 +6481,8 @@ static void lcd_main_menu()
|
|||
else
|
||||
{
|
||||
#ifdef FANCHECK
|
||||
checkFanSpeed(); //Check manually to get most recent fan speed status
|
||||
if(fan_check_error == EFCE_OK)
|
||||
MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT
|
||||
if(fan_check_error == EFCE_FIXED)
|
||||
MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT
|
||||
#else
|
||||
MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue