@ -40,11 +40,14 @@
extern float destination [ XYZE ] , current_position [ XYZE ] ;
extern float destination [ XYZE ] , current_position [ XYZE ] ;
# if ENABLED(NEWPANEL)
void lcd_return_to_status ( ) ;
void lcd_return_to_status ( ) ;
void lcd_mesh_edit_setup ( float initial ) ;
void lcd_mesh_edit_setup ( float initial ) ;
float lcd_mesh_edit ( ) ;
float lcd_mesh_edit ( ) ;
void lcd_z_offset_edit_setup ( float ) ;
void lcd_z_offset_edit_setup ( float ) ;
float lcd_z_offset_edit ( ) ;
float lcd_z_offset_edit ( ) ;
# endif
extern float meshedit_done ;
extern float meshedit_done ;
extern long babysteps_done ;
extern long babysteps_done ;
extern float probe_pt ( const float & x , const float & y , bool , int ) ;
extern float probe_pt ( const float & x , const float & y , bool , int ) ;
@ -149,9 +152,10 @@
* parameter can be given to prioritize where the command should be trying to measure points .
* parameter can be given to prioritize where the command should be trying to measure points .
* If the X and Y parameters are not specified the current probe position is used .
* If the X and Y parameters are not specified the current probe position is used .
* P1 accepts a ' T ' ( Topology ) parameter so you can observe mesh generation .
* P1 accepts a ' T ' ( Topology ) parameter so you can observe mesh generation .
* P1 also watches for the LCD Panel Encoder Switch to be held down , and will suspend
* P1 also watches for the LCD Panel Encoder Switch to be held down ( assuming you have one ) ,
* generation of the Mesh in that case . ( Note : This check is only done between probe points ,
* and will suspend generation of the Mesh in that case . ( Note : This check is only done
* so you must press and hold the switch until the Phase 1 command detects it . )
* between probe points , so you must press and hold the switch until the Phase 1 command
* detects it . )
*
*
* P2 Phase 2 Probe areas of the Mesh that can ' t be automatically handled . Phase 2 respects an H
* P2 Phase 2 Probe areas of the Mesh that can ' t be automatically handled . Phase 2 respects an H
* parameter to control the height between Mesh points . The default height for movement
* parameter to control the height between Mesh points . The default height for movement
@ -187,6 +191,8 @@
* Phase 2 allows the T ( Map ) parameter to be specified . This helps the user see the progression
* Phase 2 allows the T ( Map ) parameter to be specified . This helps the user see the progression
* of the Mesh being built .
* of the Mesh being built .
*
*
* NOTE : P2 is not available unless you have LCD support enabled !
*
* P3 Phase 3 Fill the unpopulated regions of the Mesh with a fixed value . There are two different paths the
* P3 Phase 3 Fill the unpopulated regions of the Mesh with a fixed value . There are two different paths the
* user can go down . If the user specifies the value using the C parameter , the closest invalid
* user can go down . If the user specifies the value using the C parameter , the closest invalid
* mesh points to the nozzle will be filled . The user can specify a repeat count using the R
* mesh points to the nozzle will be filled . The user can specify a repeat count using the R
@ -204,8 +210,9 @@
* numbers . You should use some scrutiny and caution .
* numbers . You should use some scrutiny and caution .
*
*
* P4 Phase 4 Fine tune the Mesh . The Delta Mesh Compensation System assume the existence of
* P4 Phase 4 Fine tune the Mesh . The Delta Mesh Compensation System assume the existence of
* an LCD Panel . It is possible to fine tune the mesh without the use of an LCD Panel .
* an LCD Panel . It is possible to fine tune the mesh without the use of an LCD Panel using
* ( More work and details on doing this later ! )
* G42 and M421 ; see the UBL documentation for further details .
*
* The System will search for the closest Mesh Point to the nozzle . It will move the
* The System will search for the closest Mesh Point to the nozzle . It will move the
* nozzle to this location . The user can use the LCD Panel to carefully adjust the nozzle
* nozzle to this location . The user can use the LCD Panel to carefully adjust the nozzle
* so it is just barely touching the bed . When the user clicks the control , the System
* so it is just barely touching the bed . When the user clicks the control , the System
@ -228,6 +235,7 @@
* LOWER the Mesh Point at the location . If you did not get good adheasion , you want to
* LOWER the Mesh Point at the location . If you did not get good adheasion , you want to
* RAISE the Mesh Point at that location .
* RAISE the Mesh Point at that location .
*
*
* NOTE : P4 is not available unless you have LCD support enabled !
*
*
* P5 Phase 5 Find Mean Mesh Height and Standard Deviation . Typically , it is easier to use and
* P5 Phase 5 Find Mean Mesh Height and Standard Deviation . Typically , it is easier to use and
* work with the Mesh if it is Mean Adjusted . You can specify a C parameter to
* work with the Mesh if it is Mean Adjusted . You can specify a C parameter to
@ -452,6 +460,7 @@
break ;
break ;
case 2 : {
case 2 : {
# if ENABLED(NEWPANEL)
//
//
// Manually Probe Mesh in areas that can't be reached by the probe
// Manually Probe Mesh in areas that can't be reached by the probe
//
//
@ -498,6 +507,10 @@
manually_probe_remaining_mesh ( g29_x_pos , g29_y_pos , height , g29_card_thickness , parser . seen ( ' T ' ) ) ;
manually_probe_remaining_mesh ( g29_x_pos , g29_y_pos , height , g29_card_thickness , parser . seen ( ' T ' ) ) ;
SERIAL_PROTOCOLLNPGM ( " G29 P2 finished. " ) ;
SERIAL_PROTOCOLLNPGM ( " G29 P2 finished. " ) ;
# else
SERIAL_PROTOCOLLNPGM ( " ?P2 is only available when an LCD is present. " ) ;
return ;
# endif
} break ;
} break ;
case 3 : {
case 3 : {
@ -557,11 +570,13 @@
break ;
break ;
}
}
case 4 :
case 4 : // Fine Tune (i.e., Edit) the Mesh
//
# if ENABLED(NEWPANEL)
// Fine Tune (i.e., Edit) the Mesh
//
fine_tune_mesh ( g29_x_pos , g29_y_pos , parser . seen ( ' T ' ) ) ;
fine_tune_mesh ( g29_x_pos , g29_y_pos , parser . seen ( ' T ' ) ) ;
# else
SERIAL_PROTOCOLLNPGM ( " ?P4 is only available when an LCD is present. " ) ;
return ;
# endif
break ;
break ;
case 5 : find_mean_mesh_height ( ) ; break ;
case 5 : find_mean_mesh_height ( ) ; break ;
@ -716,11 +731,15 @@
LEAVE :
LEAVE :
# if ENABLED(NEWPANEL)
lcd_reset_alert_level ( ) ;
lcd_reset_alert_level ( ) ;
LCD_MESSAGEPGM ( " " ) ;
LCD_MESSAGEPGM ( " " ) ;
lcd_quick_feedback ( ) ;
lcd_quick_feedback ( ) ;
has_control_of_lcd_panel = false ;
has_control_of_lcd_panel = false ;
# endif
return ;
}
}
void unified_bed_leveling : : find_mean_mesh_height ( ) {
void unified_bed_leveling : : find_mean_mesh_height ( ) {
@ -782,6 +801,7 @@
uint16_t max_iterations = GRID_MAX_POINTS ;
uint16_t max_iterations = GRID_MAX_POINTS ;
do {
do {
# if ENABLED(NEWPANEL)
if ( ubl_lcd_clicked ( ) ) {
if ( ubl_lcd_clicked ( ) ) {
SERIAL_PROTOCOLLNPGM ( " \n Mesh only partially populated. \n " ) ;
SERIAL_PROTOCOLLNPGM ( " \n Mesh only partially populated. \n " ) ;
lcd_quick_feedback ( ) ;
lcd_quick_feedback ( ) ;
@ -792,6 +812,7 @@
safe_delay ( 50 ) ; // Debounce the Encoder wheel
safe_delay ( 50 ) ; // Debounce the Encoder wheel
return ;
return ;
}
}
# endif
location = find_closest_mesh_point_of_type ( INVALID , lx , ly , USE_PROBE_AS_REFERENCE , NULL , close_or_far ) ;
location = find_closest_mesh_point_of_type ( INVALID , lx , ly , USE_PROBE_AS_REFERENCE , NULL , close_or_far ) ;
@ -920,6 +941,7 @@
}
}
}
}
# if ENABLED(NEWPANEL)
float unified_bed_leveling : : measure_point_with_encoder ( ) {
float unified_bed_leveling : : measure_point_with_encoder ( ) {
while ( ubl_lcd_clicked ( ) ) delay ( 50 ) ; // wait for user to release encoder wheel
while ( ubl_lcd_clicked ( ) ) delay ( 50 ) ; // wait for user to release encoder wheel
@ -985,11 +1007,13 @@
void unified_bed_leveling : : manually_probe_remaining_mesh ( const float & lx , const float & ly , const float & z_clearance , const float & thick , const bool do_ubl_mesh_map ) {
void unified_bed_leveling : : manually_probe_remaining_mesh ( const float & lx , const float & ly , const float & z_clearance , const float & thick , const bool do_ubl_mesh_map ) {
has_control_of_lcd_panel = true ;
has_control_of_lcd_panel = true ;
save_ubl_active_state_and_disable ( ) ; // we don't do bed level correction because we want the raw data when we probe
save_ubl_active_state_and_disable ( ) ; // we don't do bed level correction because we want the raw data when we probe
do_blocking_move_to_z ( Z_CLEARANCE_BETWEEN_PROBES ) ;
do_blocking_move_to_z ( Z_CLEARANCE_BETWEEN_PROBES ) ;
do_blocking_move_to_xy ( lx , ly ) ;
do_blocking_move_to_xy ( lx , ly ) ;
lcd_return_to_status ( ) ;
lcd_return_to_status ( ) ;
mesh_index_pair location ;
mesh_index_pair location ;
do {
do {
location = find_closest_mesh_point_of_type ( INVALID , lx , ly , USE_NOZZLE_AS_REFERENCE , NULL , false ) ;
location = find_closest_mesh_point_of_type ( INVALID , lx , ly , USE_NOZZLE_AS_REFERENCE , NULL , false ) ;
@ -1039,9 +1063,13 @@
if ( ELAPSED ( millis ( ) , nxt ) ) {
if ( ELAPSED ( millis ( ) , nxt ) ) {
SERIAL_PROTOCOLLNPGM ( " \n Mesh only partially populated. " ) ;
SERIAL_PROTOCOLLNPGM ( " \n Mesh only partially populated. " ) ;
do_blocking_move_to_z ( Z_CLEARANCE_DEPLOY_PROBE ) ;
do_blocking_move_to_z ( Z_CLEARANCE_DEPLOY_PROBE ) ;
# if ENABLED(NEWPANEL)
lcd_quick_feedback ( ) ;
lcd_quick_feedback ( ) ;
while ( ubl_lcd_clicked ( ) ) idle ( ) ;
while ( ubl_lcd_clicked ( ) ) idle ( ) ;
has_control_of_lcd_panel = false ;
has_control_of_lcd_panel = false ;
# endif
KEEPALIVE_STATE ( IN_HANDLER ) ;
KEEPALIVE_STATE ( IN_HANDLER ) ;
restore_ubl_active_state_and_leave ( ) ;
restore_ubl_active_state_and_leave ( ) ;
return ;
return ;
@ -1063,12 +1091,15 @@
do_blocking_move_to_z ( Z_CLEARANCE_DEPLOY_PROBE ) ;
do_blocking_move_to_z ( Z_CLEARANCE_DEPLOY_PROBE ) ;
do_blocking_move_to_xy ( lx , ly ) ;
do_blocking_move_to_xy ( lx , ly ) ;
}
}
# endif
bool unified_bed_leveling : : g29_parameter_parsing ( ) {
bool unified_bed_leveling : : g29_parameter_parsing ( ) {
bool err_flag = false ;
bool err_flag = false ;
# if ENABLED(NEWPANEL)
LCD_MESSAGEPGM ( " Doing G29 UBL! " ) ; // TODO: Make translatable string
LCD_MESSAGEPGM ( " Doing G29 UBL! " ) ; // TODO: Make translatable string
lcd_quick_feedback ( ) ;
lcd_quick_feedback ( ) ;
# endif
g29_constant = 0.0 ;
g29_constant = 0.0 ;
g29_repetition_cnt = 0 ;
g29_repetition_cnt = 0 ;
@ -1174,8 +1205,12 @@
ubl_state_recursion_chk + + ;
ubl_state_recursion_chk + + ;
if ( ubl_state_recursion_chk ! = 1 ) {
if ( ubl_state_recursion_chk ! = 1 ) {
SERIAL_ECHOLNPGM ( " save_ubl_active_state_and_disabled() called multiple times in a row. " ) ;
SERIAL_ECHOLNPGM ( " save_ubl_active_state_and_disabled() called multiple times in a row. " ) ;
# if ENABLED(NEWPANEL)
LCD_MESSAGEPGM ( " save_UBL_active() error " ) ; // TODO: Make translatable string
LCD_MESSAGEPGM ( " save_UBL_active() error " ) ; // TODO: Make translatable string
lcd_quick_feedback ( ) ;
lcd_quick_feedback ( ) ;
# endif
return ;
return ;
}
}
ubl_state_at_invocation = state . active ;
ubl_state_at_invocation = state . active ;
@ -1185,8 +1220,12 @@
void unified_bed_leveling : : restore_ubl_active_state_and_leave ( ) {
void unified_bed_leveling : : restore_ubl_active_state_and_leave ( ) {
if ( - - ubl_state_recursion_chk ) {
if ( - - ubl_state_recursion_chk ) {
SERIAL_ECHOLNPGM ( " restore_ubl_active_state_and_leave() called too many times. " ) ;
SERIAL_ECHOLNPGM ( " restore_ubl_active_state_and_leave() called too many times. " ) ;
# if ENABLED(NEWPANEL)
LCD_MESSAGEPGM ( " restore_UBL_active() error " ) ; // TODO: Make translatable string
LCD_MESSAGEPGM ( " restore_UBL_active() error " ) ; // TODO: Make translatable string
lcd_quick_feedback ( ) ;
lcd_quick_feedback ( ) ;
# endif
return ;
return ;
}
}
set_bed_leveling_enabled ( ubl_state_at_invocation ) ;
set_bed_leveling_enabled ( ubl_state_at_invocation ) ;
@ -1420,6 +1459,7 @@
return out_mesh ;
return out_mesh ;
}
}
# if ENABLED(NEWPANEL)
void unified_bed_leveling : : fine_tune_mesh ( const float & lx , const float & ly , const bool do_ubl_mesh_map ) {
void unified_bed_leveling : : fine_tune_mesh ( const float & lx , const float & ly , const bool do_ubl_mesh_map ) {
if ( ! parser . seen ( ' R ' ) ) // fine_tune_mesh() is special. If no repetition count flag is specified
if ( ! parser . seen ( ' R ' ) ) // fine_tune_mesh() is special. If no repetition count flag is specified
g29_repetition_cnt = 1 ; // do exactly one mesh location. Otherwise use what the parser decided.
g29_repetition_cnt = 1 ; // do exactly one mesh location. Otherwise use what the parser decided.
@ -1528,6 +1568,7 @@
LCD_MESSAGEPGM ( " Done Editing Mesh " ) ; // TODO: Make translatable string
LCD_MESSAGEPGM ( " Done Editing Mesh " ) ; // TODO: Make translatable string
SERIAL_ECHOLNPGM ( " Done Editing Mesh " ) ;
SERIAL_ECHOLNPGM ( " Done Editing Mesh " ) ;
}
}
# endif
/**
/**
* ' Smart Fill ' : Scan from the outward edges of the mesh towards the center .
* ' Smart Fill ' : Scan from the outward edges of the mesh towards the center .