|
@@ -142,10 +142,6 @@
|
|
//Macro for print fan speed
|
|
//Macro for print fan speed
|
|
#define FAN_PULSE_WIDTH_LIMIT ((fanSpeed > 100) ? 3 : 4) //time in ms
|
|
#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
|
|
//filament types
|
|
#define FILAMENT_DEFAULT 0
|
|
#define FILAMENT_DEFAULT 0
|
|
#define FILAMENT_FLEX 1
|
|
#define FILAMENT_FLEX 1
|
|
@@ -375,7 +371,7 @@ boolean chdkActive = false;
|
|
//! @{
|
|
//! @{
|
|
bool saved_printing = false; //!< Print is paused and saved in RAM
|
|
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 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 };
|
|
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.
|
|
//! 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;
|
|
static float saved_feedrate2 = 0;
|
|
@@ -623,7 +619,7 @@ void crashdet_cancel()
|
|
if (saved_printing_type == PRINTING_TYPE_SD) {
|
|
if (saved_printing_type == PRINTING_TYPE_SD) {
|
|
lcd_print_stop();
|
|
lcd_print_stop();
|
|
}else if(saved_printing_type == PRINTING_TYPE_USB){
|
|
}else if(saved_printing_type == PRINTING_TYPE_USB){
|
|
- SERIAL_ECHOLNPGM("// action:cancel"); //for Octoprint: works the same as clicking "Abort" button in Octoprint GUI
|
|
|
|
|
|
+ SERIAL_ECHOLNRPGM(MSG_OCTOPRINT_CANCEL); //for Octoprint: works the same as clicking "Abort" button in Octoprint GUI
|
|
SERIAL_PROTOCOLLNRPGM(MSG_OK);
|
|
SERIAL_PROTOCOLLNRPGM(MSG_OK);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1527,7 +1523,7 @@ void setup()
|
|
calibration_status() == CALIBRATION_STATUS_UNKNOWN ||
|
|
calibration_status() == CALIBRATION_STATUS_UNKNOWN ||
|
|
calibration_status() == CALIBRATION_STATUS_XYZ_CALIBRATION) {
|
|
calibration_status() == CALIBRATION_STATUS_XYZ_CALIBRATION) {
|
|
// Reset the babystepping values, so the printer will not move the Z axis up when the babystepping is enabled.
|
|
// Reset the babystepping values, so the printer will not move the Z axis up when the babystepping is enabled.
|
|
- eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, 0);
|
|
|
|
|
|
+ eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)),0);
|
|
// Show the message.
|
|
// Show the message.
|
|
lcd_show_fullscreen_message_and_wait_P(_T(MSG_FOLLOW_CALIBRATION_FLOW));
|
|
lcd_show_fullscreen_message_and_wait_P(_T(MSG_FOLLOW_CALIBRATION_FLOW));
|
|
}
|
|
}
|
|
@@ -1751,12 +1747,25 @@ void loop()
|
|
{
|
|
{
|
|
is_usb_printing = false;
|
|
is_usb_printing = false;
|
|
}
|
|
}
|
|
|
|
+ if (isPrintPaused && saved_printing_type == PRINTING_TYPE_USB) //keep believing that usb is being printed. Prevents accessing dangerous menus while pausing.
|
|
|
|
+ {
|
|
|
|
+ is_usb_printing = true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+#ifdef FANCHECK
|
|
|
|
+ if (fan_check_error && isPrintPaused)
|
|
|
|
+ {
|
|
|
|
+ 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.
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
|
|
if (prusa_sd_card_upload)
|
|
if (prusa_sd_card_upload)
|
|
{
|
|
{
|
|
//we read byte-by byte
|
|
//we read byte-by byte
|
|
serial_read_stream();
|
|
serial_read_stream();
|
|
- } else
|
|
|
|
|
|
+ }
|
|
|
|
+ else
|
|
{
|
|
{
|
|
|
|
|
|
get_command();
|
|
get_command();
|
|
@@ -2694,6 +2703,7 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon
|
|
previous_millis_cmd = _millis();
|
|
previous_millis_cmd = _millis();
|
|
endstops_hit_on_purpose();
|
|
endstops_hit_on_purpose();
|
|
#ifndef MESH_BED_LEVELING
|
|
#ifndef MESH_BED_LEVELING
|
|
|
|
+//-// Oct 2019 :: this part of code is (from) now probably un-compilable
|
|
// If MESH_BED_LEVELING is not active, then it is the original Prusa i3.
|
|
// If MESH_BED_LEVELING is not active, then it is the original Prusa i3.
|
|
// Offer the user to load the baby step value, which has been adjusted at the previous print session.
|
|
// Offer the user to load the baby step value, which has been adjusted at the previous print session.
|
|
if(card.sdprinting && eeprom_read_word((uint16_t *)EEPROM_BABYSTEP_Z))
|
|
if(card.sdprinting && eeprom_read_word((uint16_t *)EEPROM_BABYSTEP_Z))
|
|
@@ -2886,7 +2896,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
|
|
{
|
|
{
|
|
// Reset the baby step value and the baby step applied flag.
|
|
// Reset the baby step value and the baby step applied flag.
|
|
calibration_status_store(CALIBRATION_STATUS_XYZ_CALIBRATION);
|
|
calibration_status_store(CALIBRATION_STATUS_XYZ_CALIBRATION);
|
|
- eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, 0);
|
|
|
|
|
|
+ eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)),0);
|
|
// Complete XYZ calibration.
|
|
// Complete XYZ calibration.
|
|
uint8_t point_too_far_mask = 0;
|
|
uint8_t point_too_far_mask = 0;
|
|
BedSkewOffsetDetectionResultType result = find_bed_offset_and_skew(verbosity_level, point_too_far_mask);
|
|
BedSkewOffsetDetectionResultType result = find_bed_offset_and_skew(verbosity_level, point_too_far_mask);
|
|
@@ -3450,22 +3460,16 @@ extern uint8_t st_backlash_y;
|
|
|
|
|
|
void process_commands()
|
|
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
|
|
|
|
+ return; //ignore usb stream. It is reenabled by selecting resume from the lcd.
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
|
|
if (!buflen) return; //empty command
|
|
if (!buflen) return; //empty command
|
|
#ifdef FILAMENT_RUNOUT_SUPPORT
|
|
#ifdef FILAMENT_RUNOUT_SUPPORT
|
|
@@ -3736,7 +3740,7 @@ void process_commands()
|
|
lang_reset();
|
|
lang_reset();
|
|
|
|
|
|
} else if(code_seen("Lz")) { // PRUSA Lz
|
|
} else if(code_seen("Lz")) { // PRUSA Lz
|
|
- EEPROM_save_B(EEPROM_BABYSTEP_Z,0);
|
|
|
|
|
|
+ eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)),0);
|
|
|
|
|
|
} else if(code_seen("Beat")) { // PRUSA Beat
|
|
} else if(code_seen("Beat")) { // PRUSA Beat
|
|
// Kick farm link timer
|
|
// Kick farm link timer
|
|
@@ -5503,7 +5507,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
|
|
|
// Reset the baby step value and the baby step applied flag.
|
|
// Reset the baby step value and the baby step applied flag.
|
|
calibration_status_store(CALIBRATION_STATUS_ASSEMBLED);
|
|
calibration_status_store(CALIBRATION_STATUS_ASSEMBLED);
|
|
- eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, 0);
|
|
|
|
|
|
+ eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)),0);
|
|
|
|
|
|
// Reset the skew and offset in both RAM and EEPROM.
|
|
// Reset the skew and offset in both RAM and EEPROM.
|
|
reset_bed_offset_and_skew();
|
|
reset_bed_offset_and_skew();
|
|
@@ -10165,7 +10169,8 @@ void restore_print_from_ram_and_continue(float e_move)
|
|
|
|
|
|
#ifdef FANCHECK
|
|
#ifdef FANCHECK
|
|
// Do not allow resume printing if fans are still not ok
|
|
// 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
|
|
#endif
|
|
|
|
|
|
// for (int axis = X_AXIS; axis <= E_AXIS; axis++)
|
|
// for (int axis = X_AXIS; axis <= E_AXIS; axis++)
|
|
@@ -10219,6 +10224,7 @@ void restore_print_from_ram_and_continue(float e_move)
|
|
}
|
|
}
|
|
SERIAL_PROTOCOLLNRPGM(MSG_OK); //dummy response because of octoprint is waiting for this
|
|
SERIAL_PROTOCOLLNRPGM(MSG_OK); //dummy response because of octoprint is waiting for this
|
|
lcd_setstatuspgm(_T(WELCOME_MSG));
|
|
lcd_setstatuspgm(_T(WELCOME_MSG));
|
|
|
|
+ saved_printing_type = PRINTING_TYPE_NONE;
|
|
saved_printing = false;
|
|
saved_printing = false;
|
|
}
|
|
}
|
|
|
|
|