MeshBed Leveling Fail

Z-leveling after MeshBed leveling failing
This commit is contained in:
MRprusa3d 2018-11-02 23:03:14 +01:00
parent 6a82af487e
commit 73794b56cf
4 changed files with 58 additions and 5 deletions

View File

@ -332,6 +332,9 @@ bool wizard_active = false; //autoload temporarily disabled during wizard
//===========================================================================
//=============================Private Variables=============================
//===========================================================================
#define MSG_BED_LEVELING_FAILED "Some problem encountered, Z-leveling enforced ..."
#define MSG_BED_LEVELING_FAILED_TIMEOUT 30
const char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'};
float destination[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0};
@ -4491,8 +4494,24 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], Z_LIFT_FEEDRATE, active_extruder);
st_synchronize();
if (mesh_point != MESH_MEAS_NUM_X_POINTS * MESH_MEAS_NUM_Y_POINTS) {
kill(kill_message);
SERIAL_ECHOLNPGM("killed");
Sound_MakeSound(e_SOUND_TYPE_StandardAlert);
lcd_display_message_fullscreen_P(_i(MSG_BED_LEVELING_FAILED));
lcd_wait_for_click_delay(MSG_BED_LEVELING_FAILED_TIMEOUT);
#ifdef TMC2130
calibrate_z_auto(); // Z-leveling (X-assembly stay up!!!)
#else // TMC2130
lcd_calibrate_z_end_stop_manual(true); // Z-leveling (X-assembly stay up!!!)
#endif // TMC2130
// ~ Z-homing (can not be used "G28", because X & Y-homing would have been done before (Z-homing))
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40, active_extruder);
st_synchronize();
//
custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery
lcd_update_enable(true); // display / status-line recovery
gcode_G28(true, true, false); // X & Y-homing (must be after Z-homing (problem with spool-holder)!)
repeatcommand_front(); // re-run (i.e. of "G80")
break;
}
clean_up_after_endstop_move(l_feedmultiply);
// SERIAL_ECHOLNPGM("clean up finished ");

View File

@ -16,6 +16,7 @@ eSOUND_MODE eSoundMode; //=e_SOUND_MODE_DEFAULT;
static void Sound_SaveMode(void);
static void Sound_DoSound_Echo(void);
static void Sound_DoSound_Prompt(void);
static void Sound_DoSound_Alert(bool bOnce);
void Sound_Init(void)
@ -68,14 +69,20 @@ switch(eSoundMode)
Sound_DoSound_Echo();
if(eSoundType==e_SOUND_TYPE_StandardPrompt)
Sound_DoSound_Prompt();
if(eSoundType==e_SOUND_TYPE_StandardAlert)
Sound_DoSound_Alert(false);
break;
case e_SOUND_MODE_ONCE:
if(eSoundType==e_SOUND_TYPE_ButtonEcho)
Sound_DoSound_Echo();
if(eSoundType==e_SOUND_TYPE_StandardPrompt)
Sound_DoSound_Prompt();
if(eSoundType==e_SOUND_TYPE_StandardAlert)
Sound_DoSound_Alert(true);
break;
case e_SOUND_MODE_SILENT:
if(eSoundType==e_SOUND_TYPE_StandardAlert)
Sound_DoSound_Alert(true);
break;
case e_SOUND_MODE_MUTE:
break;
@ -104,3 +111,17 @@ WRITE(BEEPER,HIGH);
delay_keep_alive(500);
WRITE(BEEPER,LOW);
}
static void Sound_DoSound_Alert(bool bOnce)
{
uint8_t nI,nMax;
nMax=bOnce?1:3;
for(nI=0;nI<nMax;nI++)
{
WRITE(BEEPER,HIGH);
delay_keep_alive(200);
WRITE(BEEPER,LOW);
delay_keep_alive(500);
}
}

View File

@ -3309,19 +3309,31 @@ void lcd_show_fullscreen_message_and_wait_P(const char *msg)
}
}
void lcd_wait_for_click()
bool lcd_wait_for_click_delay(uint16_t nDelay)
// nDelay :: timeout [s] (0 ~ no timeout)
// true ~ clicked, false ~ delayed
{
bool bDelayed;
long nTime0 = millis()/1000;
KEEPALIVE_STATE(PAUSED_FOR_USER);
for (;;) {
manage_heater();
manage_inactivity(true);
if (lcd_clicked()) {
bDelayed = ((millis()/1000-nTime0) > nDelay);
bDelayed = (bDelayed && (nDelay != 0)); // 0 ~ no timeout, always waiting for click
if (lcd_clicked() || bDelayed) {
KEEPALIVE_STATE(IN_HANDLER);
return;
return(!bDelayed);
}
}
}
void lcd_wait_for_click()
{
lcd_wait_for_click_delay(0);
}
//! @brief Show multiple screen message with yes and no possible choices and wait with possible timeout
//! @param msg Message to show
//! @param allow_timeouting if true, allows time outing of the screen

View File

@ -49,6 +49,7 @@ extern const char* lcd_display_message_fullscreen_P(const char *msg);
extern void lcd_return_to_status();
extern void lcd_wait_for_click();
extern bool lcd_wait_for_click_delay(uint16_t nDelay);
extern void lcd_show_fullscreen_message_and_wait_P(const char *msg);
// 0: no, 1: yes, -1: timeouted
extern int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false);