Merge pull request #2017 from NotaRobotexe/octoprint_fix

Octoprint fix
This commit is contained in:
DRracer 2019-07-18 16:02:38 +02:00 committed by GitHub
commit b0c41ec979
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 9 deletions

View File

@ -3392,8 +3392,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
@ -6733,6 +6740,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.
{
@ -9427,7 +9438,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
@ -9511,7 +9521,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
@ -9521,6 +9530,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;
}

View File

@ -129,3 +129,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"; ////

View File

@ -130,6 +130,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)
}

View File

@ -40,7 +40,7 @@
#include <avr/wdt.h>
#include "adc.h"
#include "ConfigurationStore.h"
#include "messages.h"
#include "Timer.h"
#include "Configuration_prusa.h"
@ -525,6 +525,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.
@ -542,18 +544,17 @@ 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;
}
}
else {
SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); //for octoprint
setTargetHotend0(0);
SERIAL_ECHOLNPGM("// action:pause"); //for octoprint
heating_status = 0;
fan_check_error = EFCE_REPORTED;
}
@ -565,6 +566,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)

View File

@ -1658,6 +1658,7 @@ void lcd_pause_print()
{
lcd_commands_type = LcdCommands::LongPause;
}
SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); //pause for octoprint
}
@ -6970,7 +6971,6 @@ void lcd_print_stop()
if(!card.sdprinting)
{
SERIAL_ECHOLNPGM("// action:cancel"); // for Octoprint
return;
}
saved_printing = false;
cancel_heatup = true;