From 8fb30f886a6090fa5bab5beb73a63af3a82e6c28 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Mon, 15 Jul 2019 14:30:21 +0200 Subject: [PATCH 1/3] octoprint stop fix --- Firmware/Marlin_main.cpp | 6 +++++- Firmware/temperature.cpp | 2 +- Firmware/ultralcd.cpp | 1 - 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 3bde72397..6f43c7f87 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -6734,6 +6734,10 @@ Sigma_Exit: } break; + case 603: { //! M603 - Stop print + lcd_print_stop(); + } + #ifdef PINDA_THERMISTOR case 860: // M860 - Wait for PINDA thermistor to reach target temperature. { @@ -9501,7 +9505,6 @@ void restore_print_from_ram_and_continue(float e_move) card.setIndex(saved_sdpos); sdpos_atomic = saved_sdpos; card.sdprinting = true; - printf_P(PSTR("ok\n")); //dummy response because of octoprint is waiting for this } else if (saved_printing_type == PRINTING_TYPE_USB) { //was usb printing gcode_LastN = saved_sdpos; //saved_sdpos was reused for storing line number when usb printing @@ -9511,6 +9514,7 @@ void restore_print_from_ram_and_continue(float e_move) else { //not sd printing nor usb printing } + printf_P(PSTR("ok\n")); //dummy response because of octoprint is waiting for this lcd_setstatuspgm(_T(WELCOME_MSG)); saved_printing = false; } diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 779bee32c..536e96bfd 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -547,7 +547,7 @@ void fanSpeedError(unsigned char _fan) { } else { fan_check_error = EFCE_DETECTED; - + SERIAL_ECHOLNPGM("// action:pause"); //for octoprint } } else { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e1d9e0abc..e87908867 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6952,7 +6952,6 @@ void lcd_print_stop() if(!card.sdprinting) { SERIAL_ECHOLNPGM("// action:cancel"); // for Octoprint - return; } saved_printing = false; cancel_heatup = true; From e6255e8451acfec30c363561869deac8465f0710 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Tue, 16 Jul 2019 19:18:31 +0200 Subject: [PATCH 2/3] octoprint fan error work --- Firmware/Marlin_main.cpp | 1 - Firmware/messages.c | 1 + Firmware/messages.h | 1 + Firmware/temperature.cpp | 9 +++++---- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 6f43c7f87..35827021d 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9432,7 +9432,6 @@ void stop_and_save_print_to_ram(float z_move, float e_move) if(!saved_extruder_relative_mode){ enquecommand(PSTR("M83"), true); } - //retract 45mm/s // A single sprintf may not be faster, but is definitely 20B shorter // than a sequence of commands building the string piece by piece diff --git a/Firmware/messages.c b/Firmware/messages.c index 0a7506121..5c6cb7960 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -128,3 +128,4 @@ 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"; //// diff --git a/Firmware/messages.h b/Firmware/messages.h index 6260e0d30..1dc4880cb 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -129,6 +129,7 @@ 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[]; #if defined(__cplusplus) } diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 536e96bfd..f9bb11f80 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -40,7 +40,7 @@ #include #include "adc.h" #include "ConfigurationStore.h" - +#include "messages.h" #include "Timer.h" #include "Configuration_prusa.h" @@ -541,18 +541,18 @@ 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 (card.sdprinting) { + if (card.sdprinting || is_usb_printing) { if (heating_status != 0) { lcd_print_stop(); } else { fan_check_error = EFCE_DETECTED; - SERIAL_ECHOLNPGM("// action:pause"); //for octoprint + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); } } else { + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); //for octoprint setTargetHotend0(0); - SERIAL_ECHOLNPGM("// action:pause"); //for octoprint } switch (_fan) { case 0: // extracting the same code from case 0 and case 1 into a function saves 72B @@ -562,6 +562,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); } #endif //(defined(TACH_0) && TACH_0 >-1) || (defined(TACH_1) && TACH_1 > -1) From b8fec59f216a020c0e28dcdfe06f75d891ea6c68 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Wed, 17 Jul 2019 19:59:31 +0200 Subject: [PATCH 3/3] octoprint fan error fix --- Firmware/Marlin_main.cpp | 11 +++++++++-- Firmware/temperature.cpp | 3 ++- Firmware/ultralcd.cpp | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 35827021d..e536df96d 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3393,8 +3393,15 @@ void process_commands() if (fan_check_error){ if( fan_check_error == EFCE_DETECTED ){ fan_check_error = EFCE_REPORTED; - lcd_pause_print(); - } // otherwise it has already been reported, so just ignore further processing + + 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 diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index f9bb11f80..1ef855492 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -524,6 +524,8 @@ void checkFanSpeed() fan_speed_errors[1] = 0; fanSpeedError(1); //print fan } + + SERIAL_PROTOCOLLNRPGM(MSG_OK); //for octoprint } //! Prints serialMsg to serial port, displays lcdMsg onto the LCD and beeps. @@ -547,7 +549,6 @@ void fanSpeedError(unsigned char _fan) { } else { fan_check_error = EFCE_DETECTED; - SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); } } else { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e87908867..c70fe8fc2 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1658,6 +1658,7 @@ void lcd_pause_print() { lcd_commands_type = LcdCommands::LongPause; } + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); //pause for octoprint }