@ -481,21 +481,35 @@ uint16_t max_display_update_time = 0;
/**
* Show " Moving... " till moves are done , then revert to previous display .
*/
inline void lcd_synchronize ( const char * const msg = NULL ) {
static const char moving [ ] PROGMEM = MSG_MOVING ;
static const char * sync_message = moving ;
//
// Display the synchronize screen until moves are
// finished, and don't return to the caller until
// done. ** This blocks the command queue! **
//
void _lcd_synchronize ( ) {
static bool no_reentry = false ;
const static char moving [ ] PROGMEM = MSG_MOVING ;
lcd_implementation_drawmenu_static ( LCD_HEIGHT > = 4 ? 1 : 0 , msg ? msg : moving ) ;
if ( lcdDrawUpdate ) lcd_implementation_drawmenu_static ( LCD_HEIGHT > = 4 ? 1 : 0 , sync_message ) ;
if ( no_reentry ) return ;
// Make this the current handler till all moves are done
no_reentry = true ;
screenFunc_t old_screen = currentScreen ;
lcd_goto_screen ( lcd_synchronize) ;
lcd_goto_screen ( _ lcd_synchronize) ;
stepper . synchronize ( ) ;
no_reentry = false ;
lcd_goto_screen ( old_screen ) ;
}
// Display the synchronize screen with a custom message
// ** This blocks the command queue! **
void lcd_synchronize ( const char * const msg = NULL ) {
sync_message = msg ? msg : moving ;
_lcd_synchronize ( ) ;
}
void lcd_return_to_status ( ) { lcd_goto_screen ( lcd_status_screen ) ; }
void lcd_save_previous_screen ( ) {
@ -680,7 +694,7 @@ void kill_screen(const char* lcd_msg) {
# if ENABLED(PARK_HEAD_ON_PAUSE)
enqueue_and_echo_commands_P ( PSTR ( " M125 " ) ) ;
# endif
lcd_setstatus pgm( PSTR ( MSG_PRINT_PAUSED ) , true ) ;
lcd_setstatus PGM( PSTR ( MSG_PRINT_PAUSED ) , - 1 ) ;
}
void lcd_sdcard_resume ( ) {
@ -690,7 +704,7 @@ void kill_screen(const char* lcd_msg) {
card . startFileprint ( ) ;
print_job_timer . start ( ) ;
# endif
lcd_setstatus pgm( PSTR ( " " ) , true ) ;
lcd_setstatus PGM( PSTR ( " " ) , - 1 ) ;
}
void lcd_sdcard_stop ( ) {
@ -703,7 +717,7 @@ void kill_screen(const char* lcd_msg) {
for ( uint8_t i = 0 ; i < FAN_COUNT ; i + + ) fanSpeeds [ i ] = 0 ;
# endif
wait_for_heatup = false ;
LCD_MESSAGEPGM( MSG_PRINT_ABORTED ) ;
lcd_setstatusPGM( PSTR ( MSG_PRINT_PAUSED ) , - 1 ) ;
}
# endif // SDSUPPORT
@ -1420,6 +1434,26 @@ void kill_screen(const char* lcd_msg) {
# endif
) ;
//
// Raise Z to the "manual probe height"
// Don't return until done.
// ** This blocks the command queue! **
//
void _lcd_after_probing ( ) {
# if MANUAL_PROBE_HEIGHT > 0
current_position [ Z_AXIS ] = LOGICAL_Z_POSITION ( Z_MIN_POS ) + MANUAL_PROBE_HEIGHT ;
line_to_current ( Z_AXIS ) ;
# endif
// Display "Done" screen and wait for moves to complete
# if MANUAL_PROBE_HEIGHT > 0 || ENABLED(MESH_BED_LEVELING)
lcd_synchronize ( PSTR ( MSG_LEVEL_BED_DONE ) ) ;
# endif
lcd_goto_previous_menu ( ) ;
lcd_completion_feedback ( ) ;
defer_return_to_status = false ;
//LCD_MESSAGEPGM(MSG_LEVEL_BED_DONE);
}
# if ENABLED(MESH_BED_LEVELING)
// Utility to go to the next mesh point
@ -1432,18 +1466,28 @@ void kill_screen(const char* lcd_msg) {
current_position [ Y_AXIS ] = LOGICAL_Y_POSITION ( y ) ;
planner . buffer_line_kinematic ( current_position , MMM_TO_MMS ( XY_PROBE_SPEED ) , active_extruder ) ;
# if MANUAL_PROBE_HEIGHT > 0
current_position [ Z_AXIS ] = LOGICAL_Z_POSITION ( Z_MIN_POS ) + 0.2 ;
current_position [ Z_AXIS ] = LOGICAL_Z_POSITION ( Z_MIN_POS ) ;
line_to_current ( Z_AXIS ) ;
# endif
lcd_synchronize ( ) ;
}
# e ndif // MESH_BED_LEVELING
# e lif ENABLED(PROBE_MANUALLY)
void _lcd_level_bed_done ( ) {
if ( lcdDrawUpdate ) lcd_implementation_drawedit ( PSTR ( MSG_LEVEL_BED_DONE ) ) ;
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT ;
}
bool lcd_wait_for_move ;
//
// Bed leveling is done. Wait for G29 to complete.
// A flag is used so that this can release control
// and allow the command queue to be processed.
//
void _lcd_level_bed_done ( ) {
if ( ! lcd_wait_for_move ) _lcd_after_probing ( ) ;
if ( lcdDrawUpdate ) lcd_implementation_drawedit ( PSTR ( MSG_LEVEL_BED_DONE ) ) ;
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT ;
}
# endif
void _lcd_level_goto_next_point ( ) ;
@ -1455,59 +1499,55 @@ void kill_screen(const char* lcd_msg) {
if ( lcd_clicked ) {
// Use a hook to set the probe point z
//
// Save the current Z position
//
# if ENABLED(MESH_BED_LEVELING)
//
// MBL records the position but doesn't move to the next one
mbl . set_zigzag_z ( manual_probe_index , current_position [ Z_AXIS ] ) ;
//
# elif ENABLED(PROBE_MANUALLY)
// The last G29 will record but not move
if ( manual_probe_index = = total_probe_points - 1 )
enqueue_and_echo_commands_P ( PSTR ( " G29 V1 " ) ) ;
mbl . set_zigzag_z ( manual_probe_index , current_position [ Z_AXIS ] ) ;
# endif
// If done...
if ( + + manual_probe_index > = total_probe_points ) {
// Say "Done!"
lcd_goto_screen ( _lcd_level_bed_done ) ;
# if ENABLED(PROBE_MANUALLY)
// Raise Z to the "manual probe height"
# if MANUAL_PROBE_HEIGHT > 0
current_position [ Z_AXIS ] = LOGICAL_Z_POSITION ( Z_MIN_POS ) + MANUAL_PROBE_HEIGHT ;
line_to_current ( Z_AXIS ) ;
# endif
//
// The last G29 will record and enable but not move.
// Since G29 is deferred,
//
lcd_wait_for_move = true ;
enqueue_and_echo_commands_P ( PSTR ( " G29 V1 " ) ) ;
lcd_goto_screen ( _lcd_level_bed_done ) ;
# if MANUAL_PROBE_HEIGHT > 0 || ENABLED(MESH_BED_LEVELING)
lcd_synchronize ( PSTR ( MSG_LEVEL_BED_DONE ) ) ;
# endif
# elif ENABLED(MESH_BED_LEVELING)
// Enable leveling, if needed
# if ENABLED(MESH_BED_LEVELING)
_lcd_after_probing ( ) ;
mbl . set_has_mesh ( true ) ;
mesh_probing_done ( ) ;
# elif ENABLED(PROBE_MANUALLY)
// ABL will be enabled due to "G29".
# endif
lcd_return_to_status ( ) ;
//LCD_MESSAGEPGM(MSG_LEVEL_BED_DONE);
lcd_completion_feedback ( ) ;
}
else
else {
// MESH_BED_LEVELING: Z already stored, just move
// PROBE_MANUALLY: Send G29 to record Z, then move
_lcd_level_goto_next_point ( ) ;
}
return ;
}
//
// Encoder knob or keypad buttons adjust the Z position
//
if ( encoderPosition ) {
refresh_cmd_timeout ( ) ;
current_position [ Z_AXIS ] + = float ( ( int32_t ) encoderPosition ) * ( MBL_Z_STEP ) ;
@ -1518,8 +1558,9 @@ void kill_screen(const char* lcd_msg) {
encoderPosition = 0 ;
}
// Update on first display, then only on updates to Z position
// Show message above on clicks instead
//
// Draw on first display, then only on Z change
//
if ( lcdDrawUpdate ) {
const float v = current_position [ Z_AXIS ] ;
lcd_implementation_drawedit ( PSTR ( MSG_MOVE_Z ) , ftostr43sign ( v + ( v < 0 ? - 0.0001 : 0.0001 ) , ' + ' ) ) ;
@ -1530,10 +1571,6 @@ void kill_screen(const char* lcd_msg) {
* Step 6 : Display " Next point: 1 / 9 " while waiting for move to finish
*/
# if ENABLED(PROBE_MANUALLY)
bool lcd_wait_for_move ;
# endif
void _lcd_level_bed_moving ( ) {
if ( lcdDrawUpdate ) {
char msg [ 10 ] ;
@ -1570,7 +1607,7 @@ void kill_screen(const char* lcd_msg) {
# elif ENABLED(PROBE_MANUALLY)
// G29 will signal when it's done
// G29 Records Z, moves, and signals when it pauses
lcd_wait_for_move = true ;
enqueue_and_echo_commands_P ( PSTR ( " G29 V1 " ) ) ;
@ -1620,19 +1657,22 @@ void kill_screen(const char* lcd_msg) {
/**
* Step 1 : Bed Level entry - point
* - Cancel
* - Auto Home ( if homing needed )
* - Leveling On / Off ( if data exists , and homed )
* - Level Bed >
* - Leveling On / Off ( if there is leveling data )
* - Fade Height ( Req : ENABLE_LEVELING_FADE_HEIGHT )
* - Mesh Z Offset ( Req : MESH_BED_LEVELING )
* - Z Probe Offset ( Req : HAS_BED_PROBE , Opt : BABYSTEP_ZPROBE_OFFSET )
* - Load Settings ( Req : EEPROM_SETTINGS )
* - Save Settings ( Req : EEPROM_SETTINGS )
* - Fade Height ( Req : ENABLE_LEVELING_FADE_HEIGHT )
* - Mesh Z Offset ( Req : MESH_BED_LEVELING )
* - Z Probe Offset ( Req : HAS_BED_PROBE , Opt : BABYSTEP_ZPROBE_OFFSET )
* - Load Settings ( Req : EEPROM_SETTINGS )
* - Save Settings ( Req : EEPROM_SETTINGS )
*/
void lcd_ level_bed ( ) {
void lcd_ bed_leveling ( ) {
START_MENU ( ) ;
MENU_BACK ( MSG_PREPARE ) ;
MENU_ITEM ( submenu , MSG_LEVEL_BED , _lcd_level_bed_continue ) ;
if ( leveling_is_valid ( ) ) { // Leveling data exists? Show more options.
if ( ! ( axis_known_position [ X_AXIS ] & & axis_known_position [ Y_AXIS ] & & axis_known_position [ Z_AXIS ] ) )
MENU_ITEM ( gcode , MSG_AUTO_HOME , PSTR ( " G28 " ) ) ;
else if ( leveling_is_valid ( ) ) {
_level_state = leveling_is_active ( ) ;
MENU_ITEM_EDIT_CALLBACK ( bool , MSG_BED_LEVELING , & _level_state , _lcd_toggle_bed_leveling ) ;
}
@ -1642,7 +1682,9 @@ void kill_screen(const char* lcd_msg) {
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK ( float62 , MSG_Z_FADE_HEIGHT , & planner . z_fade_height , 0.0 , 100.0 , _lcd_set_z_fade_height ) ;
# endif
// Manual bed leveling, Bed Z:
//
// MBL Z Offset
//
# if ENABLED(MESH_BED_LEVELING)
MENU_ITEM_EDIT ( float43 , MSG_BED_Z , & mbl . z_offset , - 1 , 1 ) ;
# endif
@ -1653,6 +1695,8 @@ void kill_screen(const char* lcd_msg) {
MENU_ITEM_EDIT_CALLBACK ( float32 , MSG_ZPROBE_ZOFFSET , & zprobe_zoffset , Z_PROBE_OFFSET_RANGE_MIN , Z_PROBE_OFFSET_RANGE_MAX , lcd_refresh_zprobe_zoffset ) ;
# endif
MENU_ITEM ( submenu , MSG_LEVEL_BED , _lcd_level_bed_continue ) ;
# if ENABLED(EEPROM_SETTINGS)
MENU_ITEM ( function , MSG_LOAD_EEPROM , lcd_load_settings ) ;
MENU_ITEM ( function , MSG_STORE_EEPROM , lcd_store_settings ) ;
@ -2063,7 +2107,7 @@ void kill_screen(const char* lcd_msg) {
# if ENABLED(PROBE_MANUALLY)
if ( ! g29_in_progress )
# endif
MENU_ITEM ( submenu , MSG_BED_LEVELING , lcd_ level_bed ) ;
MENU_ITEM ( submenu , MSG_BED_LEVELING , lcd_ bed_leveling ) ;
# endif
# if HAS_M206_COMMAND
@ -2826,8 +2870,8 @@ void kill_screen(const char* lcd_msg) {
static void lcd_refresh_zprobe_zoffset ( ) { refresh_zprobe_zoffset ( ) ; }
# endif
// M203 / M205 Feedrate s
void lcd_control_motion_ feedrate _menu( ) {
// M203 / M205 Velocity option s
void lcd_control_motion_ velocity _menu( ) {
START_MENU ( ) ;
MENU_BACK ( MSG_MOTION ) ;
@ -2957,18 +3001,19 @@ void kill_screen(const char* lcd_msg) {
MENU_ITEM_EDIT_CALLBACK ( float32 , MSG_ZPROBE_ZOFFSET , & zprobe_zoffset , Z_PROBE_OFFSET_RANGE_MIN , Z_PROBE_OFFSET_RANGE_MAX , lcd_refresh_zprobe_zoffset ) ;
# endif
// M203 / M205 Feedrate items
MENU_ITEM ( submenu , MSG_ FEEDRATE, lcd_control_motion_feedrate _menu) ;
// M203 / M205 - Feedrate items
MENU_ITEM ( submenu , MSG_ VELOCITY, lcd_control_motion_velocity _menu) ;
// M201 Acceleration items
// M201 - Acceleration items
MENU_ITEM ( submenu , MSG_ACCELERATION , lcd_control_motion_acceleration_menu ) ;
// M205 Max Jerk
// M205 - Max Jerk
MENU_ITEM ( submenu , MSG_JERK , lcd_control_motion_jerk_menu ) ;
// M92 Steps Per mm
// M92 - Steps Per mm
MENU_ITEM ( submenu , MSG_STEPS_PER_MM , lcd_control_motion_steps_per_mm_menu ) ;
// M540 S - Abort on endstop hit when SD printing
# if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
MENU_ITEM_EDIT ( bool , MSG_ENDSTOP_ABORT , & stepper . abort_on_endstop_hit ) ;
# endif
@ -4095,7 +4140,8 @@ void lcd_setstatus(const char * const message, const bool persist) {
lcd_finishstatus ( persist ) ;
}
void lcd_setstatuspgm ( const char * const message , const uint8_t level ) {
void lcd_setstatusPGM ( const char * const message , int8_t level ) {
if ( level < 0 ) level = lcd_status_message_level = 0 ;
if ( level < lcd_status_message_level ) return ;
lcd_status_message_level = level ;
strncpy_P ( lcd_status_message , message , 3 * ( LCD_WIDTH ) ) ;
@ -4113,7 +4159,7 @@ void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) {
}
void lcd_setalertstatuspgm ( const char * const message ) {
lcd_setstatus pgm ( message , 1 ) ;
lcd_setstatus PGM ( message , 1 ) ;
# if ENABLED(ULTIPANEL)
lcd_return_to_status ( ) ;
# endif