Merge pull request #7204 from thinkyhead/bf_update_ubl_lcd
UBL radar map corrections
This commit is contained in:
commit
3e78a01262
@ -273,6 +273,12 @@
|
|||||||
#define LCD_FEEDRATE_CHAR 0x06
|
#define LCD_FEEDRATE_CHAR 0x06
|
||||||
#define LCD_CLOCK_CHAR 0x07
|
#define LCD_CLOCK_CHAR 0x07
|
||||||
#define LCD_STR_ARROW_RIGHT ">" /* from the default character set */
|
#define LCD_STR_ARROW_RIGHT ">" /* from the default character set */
|
||||||
|
|
||||||
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
|
#define LCD_UBL_BOXTOP_CHAR 0x01
|
||||||
|
#define LCD_UBL_BOXBOT_CHAR 0x02
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -333,7 +333,6 @@
|
|||||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
#include "ubl.h"
|
#include "ubl.h"
|
||||||
extern bool defer_return_to_status;
|
extern bool defer_return_to_status;
|
||||||
extern bool ubl_lcd_map_control;
|
|
||||||
unified_bed_leveling ubl;
|
unified_bed_leveling ubl;
|
||||||
#define UBL_MESH_VALID !( ( ubl.z_values[0][0] == ubl.z_values[0][1] && ubl.z_values[0][1] == ubl.z_values[0][2] \
|
#define UBL_MESH_VALID !( ( ubl.z_values[0][0] == ubl.z_values[0][1] && ubl.z_values[0][1] == ubl.z_values[0][2] \
|
||||||
&& ubl.z_values[1][0] == ubl.z_values[1][1] && ubl.z_values[1][1] == ubl.z_values[1][2] \
|
&& ubl.z_values[1][0] == ubl.z_values[1][1] && ubl.z_values[1][1] == ubl.z_values[1][2] \
|
||||||
@ -7742,11 +7741,9 @@ inline void gcode_M18_M84() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD) //only needed if have an LCD
|
#if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD) // Only needed with an LCD
|
||||||
ubl_lcd_map_control = false;
|
ubl_lcd_map_control = defer_return_to_status = false;
|
||||||
defer_return_to_status = false;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12637,9 +12634,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
|
|||||||
#if ENABLED(DISABLE_INACTIVE_E)
|
#if ENABLED(DISABLE_INACTIVE_E)
|
||||||
disable_e_steppers();
|
disable_e_steppers();
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD) //only needed if have an LCD
|
#if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD) // Only needed with an LCD
|
||||||
ubl_lcd_map_control = false;
|
ubl_lcd_map_control = defer_return_to_status = false;
|
||||||
defer_return_to_status = false;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,9 +45,7 @@
|
|||||||
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);
|
||||||
#if ENABLED(DOGLCD)
|
extern void _lcd_ubl_output_map_lcd();
|
||||||
extern void _lcd_ubl_output_map_lcd();
|
|
||||||
#endif
|
|
||||||
float lcd_z_offset_edit();
|
float lcd_z_offset_edit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -56,7 +54,6 @@
|
|||||||
extern float probe_pt(const float &x, const float &y, bool, int);
|
extern float probe_pt(const float &x, const float &y, bool, int);
|
||||||
extern bool set_probe_deployed(bool);
|
extern bool set_probe_deployed(bool);
|
||||||
extern void set_bed_leveling_enabled(bool);
|
extern void set_bed_leveling_enabled(bool);
|
||||||
extern bool ubl_lcd_map_control;
|
|
||||||
typedef void (*screenFunc_t)();
|
typedef void (*screenFunc_t)();
|
||||||
extern void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder = 0);
|
extern void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder = 0);
|
||||||
|
|
||||||
@ -1522,7 +1519,7 @@
|
|||||||
idle();
|
idle();
|
||||||
} while (!ubl_lcd_clicked());
|
} while (!ubl_lcd_clicked());
|
||||||
|
|
||||||
lcd_return_to_status();
|
if (!ubl_lcd_map_control) lcd_return_to_status();
|
||||||
|
|
||||||
// The technique used here generates a race condition for the encoder click.
|
// The technique used here generates a race condition for the encoder click.
|
||||||
// It could get detected in lcd_mesh_edit (actually _lcd_mesh_fine_tune) or here.
|
// It could get detected in lcd_mesh_edit (actually _lcd_mesh_fine_tune) or here.
|
||||||
@ -1569,12 +1566,10 @@
|
|||||||
LCD_MESSAGEPGM(MSG_UBL_DONE_EDITING_MESH);
|
LCD_MESSAGEPGM(MSG_UBL_DONE_EDITING_MESH);
|
||||||
SERIAL_ECHOLNPGM("Done Editing Mesh");
|
SERIAL_ECHOLNPGM("Done Editing Mesh");
|
||||||
|
|
||||||
if (ubl_lcd_map_control) {
|
if (ubl_lcd_map_control)
|
||||||
#if ENABLED(DOGLCD)
|
lcd_goto_screen(_lcd_ubl_output_map_lcd);
|
||||||
lcd_goto_screen(_lcd_ubl_output_map_lcd);
|
else
|
||||||
#endif
|
lcd_return_to_status();
|
||||||
}
|
|
||||||
else lcd_return_to_status();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // NEWPANEL
|
#endif // NEWPANEL
|
||||||
|
@ -470,8 +470,14 @@ uint16_t max_display_update_time = 0;
|
|||||||
screen_history_depth = 0;
|
screen_history_depth = 0;
|
||||||
}
|
}
|
||||||
lcd_implementation_clear();
|
lcd_implementation_clear();
|
||||||
#if ENABLED(LCD_PROGRESS_BAR)
|
// Re-initialize custom characters that may be re-used
|
||||||
// For LCD_PROGRESS_BAR re-initialize custom characters
|
#if DISABLED(DOGLCD) && ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
|
if (!ubl_lcd_map_control) lcd_set_custom_characters(
|
||||||
|
#if ENABLED(LCD_PROGRESS_BAR)
|
||||||
|
screen == lcd_status_screen
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
#elif ENABLED(LCD_PROGRESS_BAR)
|
||||||
lcd_set_custom_characters(screen == lcd_status_screen);
|
lcd_set_custom_characters(screen == lcd_status_screen);
|
||||||
#endif
|
#endif
|
||||||
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
||||||
@ -2142,6 +2148,7 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
void _lcd_ubl_output_map_lcd();
|
void _lcd_ubl_output_map_lcd();
|
||||||
|
|
||||||
void _lcd_ubl_map_homing() {
|
void _lcd_ubl_map_homing() {
|
||||||
|
defer_return_to_status = true;
|
||||||
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_HOMING), NULL);
|
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_HOMING), NULL);
|
||||||
lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
|
lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
|
||||||
if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) {
|
if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) {
|
||||||
@ -2158,8 +2165,6 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
void _lcd_ubl_map_lcd_edit_cmd() {
|
void _lcd_ubl_map_lcd_edit_cmd() {
|
||||||
char ubl_lcd_gcode [50], str[10], str2[10];
|
char ubl_lcd_gcode [50], str[10], str2[10];
|
||||||
|
|
||||||
ubl_lcd_map_control = true; // Used for returning to the map screen
|
|
||||||
|
|
||||||
dtostrf(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]), 0, 2, str);
|
dtostrf(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]), 0, 2, str);
|
||||||
dtostrf(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]), 0, 2, str2);
|
dtostrf(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]), 0, 2, str2);
|
||||||
snprintf_P(ubl_lcd_gcode, sizeof(ubl_lcd_gcode), PSTR("G29 P4 X%s Y%s R%i"), str, str2, n_edit_pts);
|
snprintf_P(ubl_lcd_gcode, sizeof(ubl_lcd_gcode), PSTR("G29 P4 X%s Y%s R%i"), str, str2, n_edit_pts);
|
||||||
@ -2183,76 +2188,62 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
|
|
||||||
void _lcd_ubl_output_map_lcd() {
|
void _lcd_ubl_output_map_lcd() {
|
||||||
static int16_t step_scaler = 0;
|
static int16_t step_scaler = 0;
|
||||||
int32_t signed_enc_pos;
|
|
||||||
|
|
||||||
defer_return_to_status = true;
|
if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
|
||||||
|
return lcd_goto_screen(_lcd_ubl_map_homing);
|
||||||
|
|
||||||
if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]) {
|
if (lcd_clicked) return _lcd_ubl_map_lcd_edit_cmd();
|
||||||
|
ENCODER_DIRECTION_NORMAL();
|
||||||
|
|
||||||
if (lcd_clicked) { return _lcd_ubl_map_lcd_edit_cmd(); }
|
if (encoderPosition) {
|
||||||
ENCODER_DIRECTION_NORMAL();
|
step_scaler += (int32_t)encoderPosition;
|
||||||
|
x_plot += step_scaler / (ENCODER_STEPS_PER_MENU_ITEM);
|
||||||
if (encoderPosition) {
|
if (abs(step_scaler) >= ENCODER_STEPS_PER_MENU_ITEM)
|
||||||
signed_enc_pos = (int32_t)encoderPosition;
|
step_scaler = 0;
|
||||||
step_scaler += signed_enc_pos;
|
refresh_cmd_timeout();
|
||||||
x_plot += step_scaler / (ENCODER_STEPS_PER_MENU_ITEM);
|
|
||||||
if (abs(step_scaler) >= ENCODER_STEPS_PER_MENU_ITEM)
|
|
||||||
step_scaler = 0;
|
|
||||||
refresh_cmd_timeout();
|
|
||||||
|
|
||||||
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
|
||||||
}
|
|
||||||
|
|
||||||
encoderPosition = 0;
|
encoderPosition = 0;
|
||||||
|
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
||||||
// Encoder to the right (++)
|
}
|
||||||
if (x_plot >= GRID_MAX_POINTS_X) { x_plot = 0; y_plot++; }
|
|
||||||
if (y_plot >= GRID_MAX_POINTS_Y) y_plot = 0;
|
// Encoder to the right (++)
|
||||||
|
if (x_plot >= GRID_MAX_POINTS_X) { x_plot = 0; y_plot++; }
|
||||||
// Encoder to the left (--)
|
if (y_plot >= GRID_MAX_POINTS_Y) y_plot = 0;
|
||||||
if (x_plot <= GRID_MAX_POINTS_X - (GRID_MAX_POINTS_X + 1)) { x_plot = GRID_MAX_POINTS_X - 1; y_plot--; }
|
|
||||||
if (y_plot <= GRID_MAX_POINTS_Y - (GRID_MAX_POINTS_Y + 1)) y_plot = GRID_MAX_POINTS_Y - 1;
|
// Encoder to the left (--)
|
||||||
|
if (x_plot <= GRID_MAX_POINTS_X - (GRID_MAX_POINTS_X + 1)) { x_plot = GRID_MAX_POINTS_X - 1; y_plot--; }
|
||||||
// Prevent underrun/overrun of plot numbers
|
if (y_plot <= GRID_MAX_POINTS_Y - (GRID_MAX_POINTS_Y + 1)) y_plot = GRID_MAX_POINTS_Y - 1;
|
||||||
x_plot = constrain(x_plot, GRID_MAX_POINTS_X - (GRID_MAX_POINTS_X + 1), GRID_MAX_POINTS_X + 1);
|
|
||||||
y_plot = constrain(y_plot, GRID_MAX_POINTS_Y - (GRID_MAX_POINTS_Y + 1), GRID_MAX_POINTS_Y + 1);
|
// Prevent underrun/overrun of plot numbers
|
||||||
|
x_plot = constrain(x_plot, GRID_MAX_POINTS_X - (GRID_MAX_POINTS_X + 1), GRID_MAX_POINTS_X + 1);
|
||||||
// Determine number of points to edit
|
y_plot = constrain(y_plot, GRID_MAX_POINTS_Y - (GRID_MAX_POINTS_Y + 1), GRID_MAX_POINTS_Y + 1);
|
||||||
#if IS_KINEMATIC
|
|
||||||
n_edit_pts = 9; //TODO: Delta accessible edit points
|
// Determine number of points to edit
|
||||||
#else
|
#if IS_KINEMATIC
|
||||||
const bool xc = WITHIN(x_plot, 1, GRID_MAX_POINTS_X - 2),
|
n_edit_pts = 9; //TODO: Delta accessible edit points
|
||||||
yc = WITHIN(y_plot, 1, GRID_MAX_POINTS_Y - 2);
|
#else
|
||||||
n_edit_pts = yc ? (xc ? 9 : 6) : (xc ? 6 : 4); // Corners
|
const bool xc = WITHIN(x_plot, 1, GRID_MAX_POINTS_X - 2),
|
||||||
#endif
|
yc = WITHIN(y_plot, 1, GRID_MAX_POINTS_Y - 2);
|
||||||
|
n_edit_pts = yc ? (xc ? 9 : 6) : (xc ? 6 : 4); // Corners
|
||||||
if (lcdDrawUpdate) {
|
#endif
|
||||||
lcd_implementation_ubl_plot(x_plot, y_plot);
|
|
||||||
|
if (lcdDrawUpdate) {
|
||||||
ubl_map_move_to_xy(); // Move to current location
|
lcd_implementation_ubl_plot(x_plot, y_plot);
|
||||||
|
|
||||||
if (planner.movesplanned() > 1) { // if the nozzle is moving, cancel the move. There is a new location
|
ubl_map_move_to_xy(); // Move to current location
|
||||||
#define ENABLE_STEPPER_DRIVER_INTERRUPT() SBI(TIMSK1, OCIE1A)
|
|
||||||
#define DISABLE_STEPPER_DRIVER_INTERRUPT() CBI(TIMSK1, OCIE1A)
|
if (planner.movesplanned() > 1) { // if the nozzle is moving, cancel the move. There is a new location
|
||||||
DISABLE_STEPPER_DRIVER_INTERRUPT();
|
quickstop_stepper();
|
||||||
while (planner.blocks_queued()) planner.discard_current_block();
|
ubl_map_move_to_xy(); // Move to new location
|
||||||
stepper.current_block = NULL;
|
}
|
||||||
planner.clear_block_buffer_runtime();
|
|
||||||
ENABLE_STEPPER_DRIVER_INTERRUPT();
|
|
||||||
set_current_from_steppers_for_axis(ALL_AXES);
|
|
||||||
sync_plan_position();
|
|
||||||
ubl_map_move_to_xy(); // Move to new location
|
|
||||||
}
|
|
||||||
}
|
|
||||||
safe_delay(10);
|
|
||||||
}
|
}
|
||||||
else lcd_goto_screen(_lcd_ubl_map_homing);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UBL Homing before LCD map
|
* UBL Homing before LCD map
|
||||||
*/
|
*/
|
||||||
void _lcd_ubl_output_map_lcd_cmd() {
|
void _lcd_ubl_output_map_lcd_cmd() {
|
||||||
|
ubl_lcd_map_control = true; // Return to the map screen (and don't restore the character set)
|
||||||
if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
|
if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
|
||||||
enqueue_and_echo_commands_P(PSTR("G28"));
|
enqueue_and_echo_commands_P(PSTR("G28"));
|
||||||
lcd_goto_screen(_lcd_ubl_map_homing);
|
lcd_goto_screen(_lcd_ubl_map_homing);
|
||||||
@ -2393,6 +2384,8 @@ void kill_screen(const char* lcd_msg) {
|
|||||||
if (!g29_in_progress)
|
if (!g29_in_progress)
|
||||||
#endif
|
#endif
|
||||||
MENU_ITEM(submenu, MSG_BED_LEVELING, lcd_bed_leveling);
|
MENU_ITEM(submenu, MSG_BED_LEVELING, lcd_bed_leveling);
|
||||||
|
#elif PLANNER_LEVELING
|
||||||
|
MENU_ITEM(gcode, MSG_BED_LEVELING, PSTR("G28\nG29"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_M206_COMMAND
|
#if HAS_M206_COMMAND
|
||||||
|
@ -188,6 +188,7 @@
|
|||||||
void lcd_reset_status();
|
void lcd_reset_status();
|
||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
|
extern bool ubl_lcd_map_control;
|
||||||
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);
|
||||||
|
@ -1085,151 +1085,151 @@ static void lcd_implementation_status_screen() {
|
|||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These are just basic data for the 20x4 LCD work that
|
* These are just basic data for the 20x4 LCD work that
|
||||||
* is coming up very soon.
|
* is coming up very soon.
|
||||||
* Soon this will morph into a map code.
|
* Soon this will morph into a map code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Possible map screens:
|
Possible map screens:
|
||||||
|
|
||||||
16x2 |X000.00 Y000.00|
|
16x2 |X000.00 Y000.00|
|
||||||
|(00,00) Z00.000|
|
|(00,00) Z00.000|
|
||||||
|
|
||||||
20x2 | X:000.00 Y:000.00 |
|
20x2 | X:000.00 Y:000.00 |
|
||||||
| (00,00) Z:00.000 |
|
| (00,00) Z:00.000 |
|
||||||
|
|
||||||
16x4 |+-------+(00,00)|
|
16x4 |+-------+(00,00)|
|
||||||
|| |X000.00|
|
|| |X000.00|
|
||||||
|| |Y000.00|
|
|| |Y000.00|
|
||||||
|+-------+Z00.000|
|
|+-------+Z00.000|
|
||||||
|
|
||||||
20x4 | +-------+ (00,00) |
|
20x4 | +-------+ (00,00) |
|
||||||
| | | X:000.00|
|
| | | X:000.00|
|
||||||
| | | Y:000.00|
|
| | | Y:000.00|
|
||||||
| +-------+ Z:00.000|
|
| +-------+ Z:00.000|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void lcd_set_ubl_map_plot_chars() {
|
void lcd_set_ubl_map_plot_chars() {
|
||||||
#if LCD_HEIGHT > 3
|
#if LCD_HEIGHT > 3
|
||||||
//#include "_ubl_lcd_map_characters.h"
|
//#include "_ubl_lcd_map_characters.h"
|
||||||
const static byte _lcd_box_top[8] PROGMEM = {
|
const static byte _lcd_box_top[8] PROGMEM = {
|
||||||
B11111,
|
B11111,
|
||||||
B00000,
|
B00000,
|
||||||
B00000,
|
B00000,
|
||||||
B00000,
|
B00000,
|
||||||
B00000,
|
B00000,
|
||||||
B00000,
|
B00000,
|
||||||
B00000,
|
B00000,
|
||||||
B00000
|
B00000
|
||||||
};
|
};
|
||||||
const static byte _lcd_box_bottom[8] PROGMEM = {
|
const static byte _lcd_box_bottom[8] PROGMEM = {
|
||||||
B00000,
|
B00000,
|
||||||
B00000,
|
B00000,
|
||||||
B00000,
|
B00000,
|
||||||
B00000,
|
B00000,
|
||||||
B00000,
|
B00000,
|
||||||
B00000,
|
B00000,
|
||||||
B00000,
|
B00000,
|
||||||
B11111
|
B11111
|
||||||
};
|
};
|
||||||
createChar_P(1, _lcd_box_top);
|
createChar_P(LCD_UBL_BOXTOP_CHAR, _lcd_box_top);
|
||||||
createChar_P(2, _lcd_box_bottom);
|
createChar_P(LCD_UBL_BOXBOT_CHAR, _lcd_box_bottom);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_implementation_ubl_plot(const uint8_t x_plot, const uint8_t y_plot) {
|
void lcd_implementation_ubl_plot(const uint8_t x_plot, const uint8_t y_plot) {
|
||||||
|
|
||||||
#if LCD_WIDTH >= 20
|
#if LCD_WIDTH >= 20
|
||||||
#define _LCD_W_POS 12
|
#define _LCD_W_POS 12
|
||||||
#define _PLOT_X 1
|
#define _PLOT_X 1
|
||||||
#define _MAP_X 3
|
#define _MAP_X 3
|
||||||
#define _LABEL(C,X,Y) lcd.setCursor(X, Y); lcd.print(C)
|
#define _LABEL(C,X,Y) lcd.setCursor(X, Y); lcd.print(C)
|
||||||
#define _XLABEL(X,Y) _LABEL("X:",X,Y)
|
#define _XLABEL(X,Y) _LABEL("X:",X,Y)
|
||||||
#define _YLABEL(X,Y) _LABEL("Y:",X,Y)
|
#define _YLABEL(X,Y) _LABEL("Y:",X,Y)
|
||||||
#define _ZLABEL(X,Y) _LABEL("Z:",X,Y)
|
#define _ZLABEL(X,Y) _LABEL("Z:",X,Y)
|
||||||
#else
|
#else
|
||||||
#define _LCD_W_POS 8
|
#define _LCD_W_POS 8
|
||||||
#define _PLOT_X 0
|
#define _PLOT_X 0
|
||||||
#define _MAP_X 1
|
#define _MAP_X 1
|
||||||
#define _LABEL(X,Y,C) lcd.setCursor(X, Y); lcd.write(C)
|
#define _LABEL(X,Y,C) lcd.setCursor(X, Y); lcd.write(C)
|
||||||
#define _XLABEL(X,Y) _LABEL('X',X,Y)
|
#define _XLABEL(X,Y) _LABEL('X',X,Y)
|
||||||
#define _YLABEL(X,Y) _LABEL('Y',X,Y)
|
#define _YLABEL(X,Y) _LABEL('Y',X,Y)
|
||||||
#define _ZLABEL(X,Y) _LABEL('Z',X,Y)
|
#define _ZLABEL(X,Y) _LABEL('Z',X,Y)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LCD_HEIGHT <= 3 // 16x2 or 20x2 display
|
#if LCD_HEIGHT <= 3 // 16x2 or 20x2 display
|
||||||
|
|
||||||
/**
|
|
||||||
* Show X and Y positions
|
|
||||||
*/
|
|
||||||
_XLABEL(_PLOT_X, 0);
|
|
||||||
lcd.print(ftostr32(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]))));
|
|
||||||
|
|
||||||
_YLABEL(_LCD_W_POS, 0);
|
|
||||||
lcd.print(ftostr32(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]))));
|
|
||||||
|
|
||||||
lcd.setCursor(_PLOT_X, 0);
|
|
||||||
|
|
||||||
#else // 16x4 or 20x4 display
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draw the Mesh Map Box
|
|
||||||
*/
|
|
||||||
uint8_t m;
|
|
||||||
lcd.setCursor(_MAP_X, 0); for (m = 0; m < 5; m++) lcd.write(1); // Top
|
|
||||||
lcd.setCursor(_MAP_X, 3); for (m = 0; m < 5; m++) lcd.write(2); // Bottom
|
|
||||||
for (m = 0; m <= 3; m++) {
|
|
||||||
lcd.setCursor(2, m); lcd.write('|'); // Left
|
|
||||||
lcd.setCursor(8, m); lcd.write('|'); // Right
|
|
||||||
}
|
|
||||||
|
|
||||||
lcd.setCursor(_LCD_W_POS, 0);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print plot position
|
* Show X and Y positions
|
||||||
*/
|
*/
|
||||||
lcd.write('(');
|
_XLABEL(_PLOT_X, 0);
|
||||||
lcd.print(x_plot);
|
lcd.print(ftostr32(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]))));
|
||||||
lcd.write(',');
|
|
||||||
lcd.print(y_plot);
|
|
||||||
lcd.write(')');
|
|
||||||
|
|
||||||
#if LCD_HEIGHT <= 3 // 16x2 or 20x2 display
|
_YLABEL(_LCD_W_POS, 0);
|
||||||
|
lcd.print(ftostr32(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]))));
|
||||||
|
|
||||||
/**
|
lcd.setCursor(_PLOT_X, 0);
|
||||||
* Print Z values
|
|
||||||
*/
|
|
||||||
_ZLABEL(_LCD_W_POS, 1);
|
|
||||||
if (!isnan(ubl.z_values[x_plot][y_plot]))
|
|
||||||
lcd.print(ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
|
||||||
else
|
|
||||||
lcd_printPGM(PSTR(" -----"));
|
|
||||||
|
|
||||||
#else // 16x4 or 20x4 display
|
#else // 16x4 or 20x4 display
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show all values at right of screen
|
* Draw the Mesh Map Box
|
||||||
*/
|
*/
|
||||||
_XLABEL(_LCD_W_POS, 1);
|
uint8_t m;
|
||||||
lcd.print(ftostr32(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]))));
|
lcd.setCursor(_MAP_X, 0); for (m = 0; m < 5; m++) lcd.write(LCD_UBL_BOXTOP_CHAR); // Top
|
||||||
_YLABEL(_LCD_W_POS, 2);
|
lcd.setCursor(_MAP_X, 3); for (m = 0; m < 5; m++) lcd.write(LCD_UBL_BOXBOT_CHAR); // Bottom
|
||||||
lcd.print(ftostr32(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]))));
|
for (m = 0; m <= 3; m++) {
|
||||||
|
lcd.setCursor(2, m); lcd.write('|'); // Left
|
||||||
|
lcd.setCursor(8, m); lcd.write('|'); // Right
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
lcd.setCursor(_LCD_W_POS, 0);
|
||||||
* Show the location value
|
|
||||||
*/
|
|
||||||
_ZLABEL(_LCD_W_POS, 3);
|
|
||||||
if (!isnan(ubl.z_values[x_plot][y_plot]))
|
|
||||||
lcd.print(ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
|
||||||
else
|
|
||||||
lcd_printPGM(PSTR(" -----"));
|
|
||||||
|
|
||||||
#endif // LCD_HEIGHT > 3
|
#endif
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* Print plot position
|
||||||
|
*/
|
||||||
|
lcd.write('(');
|
||||||
|
lcd.print(x_plot);
|
||||||
|
lcd.write(',');
|
||||||
|
lcd.print(y_plot);
|
||||||
|
lcd.write(')');
|
||||||
|
|
||||||
|
#if LCD_HEIGHT <= 3 // 16x2 or 20x2 display
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print Z values
|
||||||
|
*/
|
||||||
|
_ZLABEL(_LCD_W_POS, 1);
|
||||||
|
if (!isnan(ubl.z_values[x_plot][y_plot]))
|
||||||
|
lcd.print(ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||||
|
else
|
||||||
|
lcd_printPGM(PSTR(" -----"));
|
||||||
|
|
||||||
|
#else // 16x4 or 20x4 display
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show all values at right of screen
|
||||||
|
*/
|
||||||
|
_XLABEL(_LCD_W_POS, 1);
|
||||||
|
lcd.print(ftostr32(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]))));
|
||||||
|
_YLABEL(_LCD_W_POS, 2);
|
||||||
|
lcd.print(ftostr32(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]))));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the location value
|
||||||
|
*/
|
||||||
|
_ZLABEL(_LCD_W_POS, 3);
|
||||||
|
if (!isnan(ubl.z_values[x_plot][y_plot]))
|
||||||
|
lcd.print(ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||||
|
else
|
||||||
|
lcd_printPGM(PSTR(" -----"));
|
||||||
|
|
||||||
|
#endif // LCD_HEIGHT > 3
|
||||||
|
}
|
||||||
|
|
||||||
#endif // AUTO_BED_LEVELING_UBL
|
#endif // AUTO_BED_LEVELING_UBL
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user