Fix for Cura pausing after probe on Hibiscus (T2381)

- Added ability in Marlin to execute GCODE macros immediately.
- Reimplemented the G29 functionality for Hibiscus.
- Should no longer cause out-of-order execution of start GCODE lines.
- Properly issues an "ok" so that Cura does not get hung up.
- Added status messages during a probe fail recovery.
master
Marcio Teixeira 7 years ago
parent 9638495ed1
commit 53d2e26aed

@ -13,7 +13,7 @@
* got disabled. * got disabled.
*/ */
#define LULZBOT_FW_VERSION ".29" // Change this with each update #define LULZBOT_FW_VERSION ".30" // Change this with each update
#if ( \ #if ( \
!defined(LULZBOT_Gladiola_Mini) && \ !defined(LULZBOT_Gladiola_Mini) && \
@ -625,7 +625,7 @@
} }
#if defined(LULZBOT_USE_Z_BELT) #if defined(LULZBOT_USE_Z_BELT)
#define LULZBOT_MENU_AXIS_LEVELING_GCODE "G28\nG0 Z5 F6000\nG91\nM211 S0\nM400\nM906 Z600\nG0 Z-15 F500\nG90\nM400\nM906 Z960\nM211 S1\nG28\nM117 Leveling done." #define LULZBOT_MENU_AXIS_LEVELING_GCODE "M117 Leveling X Axis\nG28\nG0 Z5 F6000\nG91\nM211 S0\nM400\nM906 Z600\nG0 Z-15 F500\nG90\nM400\nM906 Z960\nM211 S1\nG28\nM117 Leveling done."
#endif #endif
/*************************** COMMON TOOLHEADS PARAMETERS ***********************/ /*************************** COMMON TOOLHEADS PARAMETERS ***********************/
@ -1542,46 +1542,57 @@
complex recovery sequence */ complex recovery sequence */
#if defined(LULZBOT_USE_Z_BELT) #if defined(LULZBOT_USE_Z_BELT)
#define LULZBOT_REWIPE_GCODE LULZBOT_MENU_AXIS_LEVELING_GCODE "\nG12 P0 S12 T0" #define LULZBOT_REWIPE_GCODE LULZBOT_MENU_AXIS_LEVELING_GCODE "\nM117 Rewiping nozzle\nG12 P0 S12 T0\nM117 Probing bed"
#else #else
#define LULZBOT_REWIPE_GCODE "G0 Z10\nG12 P0 S12 T0" #define LULZBOT_REWIPE_GCODE "G0 Z10\nG12 P0 S12 T0"
#endif #endif
#define LULZBOT_DO_PROBE_MOVE(speed) if (do_probe_move(LULZBOT_BED_PROBE_MIN, speed)) return NAN; #define LULZBOT_DO_PROBE_MOVE(speed) if (do_probe_move(LULZBOT_BED_PROBE_MIN, speed)) return NAN;
#define LULZBOT_PROBE_RETRY_COUNTER_DECL int reprobe_retries_left = LULZBOT_NUM_REWIPES; #define LULZBOT_EXECUTE_IMMEDIATE_DECL \
void execute_commands_immediate_P(const char *pgcode);
#define LULZBOT_EXECUTE_IMMEDIATE_IMPL \
void execute_commands_immediate_P(const char *pgcode) { \
char cmd[30]; \
while(pgm_read_byte_near(pgcode) != '\0') { \
const char *delim = strchr_P(pgcode, '\n'); \
size_t len = delim ? delim - pgcode : strlen_P(pgcode); \
strncpy_P(cmd, pgcode, len); \
cmd[len] = '\0'; \
pgcode += len; \
if(delim) { \
pgcode++; \
} \
parser.parse(cmd); \
process_parsed_command(false); \
} \
}
#define LULZBOT_G29_WITH_RETRY \ #define LULZBOT_G29_WITH_RETRY_DECL \
{ \ void gcode_G29_with_retry();
LULZBOT_ENABLE_PROBE_PINS(true); \
#define LULZBOT_G29_WITH_RETRY_IMPL \
void gcode_G29_with_retry() { \
set_bed_leveling_enabled(false); \ set_bed_leveling_enabled(false); \
for(uint8_t i = 0; i < LULZBOT_NUM_REWIPES; i++) { \
LULZBOT_ENABLE_PROBE_PINS(true); \
gcode_G29(); \ gcode_G29(); \
LULZBOT_ENABLE_PROBE_PINS(false); \
if(planner.leveling_active) break; \
execute_commands_immediate_P(PSTR(LULZBOT_REWIPE_GCODE)); \
} \
if(planner.leveling_active) { \ if(planner.leveling_active) { \
/* Probe succeeded */ \ execute_commands_immediate_P(PSTR("M117 Probe successful")); \
reprobe_retries_left = LULZBOT_NUM_REWIPES; \
} else if(reprobe_retries_left > 0) { \
/* Probe failed, but we still have retries left */ \
reprobe_retries_left--; \
SERIAL_ERRORLNPGM(MSG_REWIPE); \
LCD_MESSAGEPGM(MSG_REWIPE); \
enqueue_and_echo_commands_P(PSTR(LULZBOT_REWIPE_GCODE "\nG29")); \
} else { \ } else { \
/* Probe failed; no retries left */ \ SERIAL_ERRORLNPGM("PROBE FAIL CLEAN NOZZLE"); \
SERIAL_ERRORLNPGM("PROBE FAIL CLEAN NOZZLE"); /* cura listens for this message specifically */ \ execute_commands_immediate_P(PSTR("M117 Bed leveling failed.\nG0 Z10\nG0 E0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1")); \
LCD_MESSAGEPGM(MSG_ERR_PROBING_FAILED); /* use a more friendly message on the LCD */ \ kill(PSTR(MSG_ERR_PROBING_FAILED)); \
BUZZ(25, 880); BUZZ(50, 0); /* play tone */ \
BUZZ(25, 880); BUZZ(50, 0); \
BUZZ(25, 880); BUZZ(50, 0); \
do_blocking_move_to_z(100, MMM_TO_MMS(Z_PROBE_SPEED_FAST)); /* raise head */ \
current_position[E_AXIS] = 0; /* prime nozzle at 75 mm/sec */ \
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 75./60, active_extruder); \
sync_plan_position_e(); \
stepper.synchronize(); \
kill(PSTR(MSG_ERR_PROBING_FAILED)); /* stop print job */ \
} \ } \
LULZBOT_ENABLE_PROBE_PINS(false); \
} }
#define LULZBOT_G29_COMMAND gcode_G29_with_retry();
#else #else
/* Old style rewipe recovery that repeats only the failed probe /* Old style rewipe recovery that repeats only the failed probe
point after a simple nozzle wipe. */ point after a simple nozzle wipe. */
@ -1611,17 +1622,19 @@
Nozzle::clean(0, 12, 0, 0); /* wipe nozzle */ \ Nozzle::clean(0, 12, 0, 0); /* wipe nozzle */ \
} }
#define LULZBOT_G29_WITH_RETRY \ #define LULZBOT_G29_COMMAND \
{ \ { \
LULZBOT_ENABLE_PROBE_PINS(true); \ LULZBOT_ENABLE_PROBE_PINS(true); \
gcode_G29(); \ gcode_G29(); \
LULZBOT_ENABLE_PROBE_PINS(false); \ LULZBOT_ENABLE_PROBE_PINS(false); \
} }
#define LULZBOT_PROBE_RETRY_COUNTER_DECL #define LULZBOT_EXECUTE_IMMEDIATE_DECL
#define LULZBOT_EXECUTE_IMMEDIATE_IMPL
#define LULZBOT_G29_WITH_RETRY_DECL
#define LULZBOT_G29_WITH_RETRY_IMPL
#endif #endif
/******************************** MOTOR CURRENTS *******************************/ /******************************** MOTOR CURRENTS *******************************/
// Values for XYZ vary by printer model, values for E vary by toolhead. // Values for XYZ vary by printer model, values for E vary by toolhead.

@ -360,7 +360,8 @@
#include "AO_FT810_UI_Screens.h" #include "AO_FT810_UI_Screens.h"
#endif #endif
LULZBOT_PROBE_RETRY_COUNTER_DECL LULZBOT_EXECUTE_IMMEDIATE_DECL
LULZBOT_G29_WITH_RETRY_DECL
bool Running = true; bool Running = true;
@ -737,7 +738,11 @@ void stop();
void get_available_commands(); void get_available_commands();
void process_next_command(); void process_next_command();
#if defined(LULZBOT_EXECUTE_IMMEDIATE_IMPL)
void process_parsed_command(bool printok = true);
#else
void process_parsed_command(); void process_parsed_command();
#endif
void get_cartesian_from_steppers(); void get_cartesian_from_steppers();
void set_current_from_steppers_for_axis(const AxisEnum axis); void set_current_from_steppers_for_axis(const AxisEnum axis);
@ -2384,11 +2389,13 @@ static void clean_up_after_endstop_or_probe_move() {
feedrate_mm_s = old_feedrate_mm_s; feedrate_mm_s = old_feedrate_mm_s;
#if !defined(LULZBOT_G29_WITH_RETRY)
if (isnan(measured_z)) { if (isnan(measured_z)) {
LCD_MESSAGEPGM(MSG_ERR_PROBING_FAILED); LCD_MESSAGEPGM(MSG_ERR_PROBING_FAILED);
SERIAL_ERROR_START(); SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_PROBING_FAILED); SERIAL_ERRORLNPGM(MSG_ERR_PROBING_FAILED);
} }
#endif
return measured_z; return measured_z;
} }
@ -11712,7 +11719,11 @@ inline void gcode_T(const uint8_t tmp_extruder) {
/** /**
* Process the parsed command and dispatch it to its handler * Process the parsed command and dispatch it to its handler
*/ */
void process_parsed_command() { void process_parsed_command(
#if defined(LULZBOT_EXECUTE_IMMEDIATE_IMPL)
bool printok
#endif
) {
KEEPALIVE_STATE(IN_HANDLER); KEEPALIVE_STATE(IN_HANDLER);
// Handle a known G, M, or T // Handle a known G, M, or T
@ -11808,8 +11819,8 @@ void process_parsed_command() {
#if HAS_LEVELING #if HAS_LEVELING
case 29: // G29 Detailed Z probe, probes the bed at 3 or more points, case 29: // G29 Detailed Z probe, probes the bed at 3 or more points,
// or provides access to the UBL System if enabled. // or provides access to the UBL System if enabled.
#if defined(LULZBOT_G29_WITH_RETRY) #if defined(LULZBOT_G29_COMMAND)
LULZBOT_G29_WITH_RETRY LULZBOT_G29_COMMAND
#else #else
gcode_G29(); gcode_G29();
#endif #endif
@ -12576,6 +12587,9 @@ void process_parsed_command() {
KEEPALIVE_STATE(NOT_BUSY); KEEPALIVE_STATE(NOT_BUSY);
#if defined(LULZBOT_EXECUTE_IMMEDIATE_IMPL)
if(printok)
#endif
ok_to_send(); ok_to_send();
} }
@ -14748,3 +14762,6 @@ void loop() {
endstops.report_state(); endstops.report_state();
idle(); idle();
} }
LULZBOT_G29_WITH_RETRY_IMPL
LULZBOT_EXECUTE_IMMEDIATE_IMPL

Loading…
Cancel
Save