From 062131554f37ad78850be621890e96f6327d86e1 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 16 Jun 2017 13:01:52 -0500 Subject: [PATCH] Followup to #7045 --- Marlin/language_en.h | 6 +++--- Marlin/ubl.cpp | 25 +++++++++++++------------ Marlin/ubl_G29.cpp | 2 +- Marlin/ultralcd.cpp | 17 ++++++++--------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Marlin/language_en.h b/Marlin/language_en.h index dfad170a7..17d7e77d2 100644 --- a/Marlin/language_en.h +++ b/Marlin/language_en.h @@ -280,9 +280,9 @@ #ifndef MSG_UBL_OUTPUT_MAP_CSV #define MSG_UBL_OUTPUT_MAP_CSV _UxGT("Output for CSV") #endif - #ifndef MSG_UBL_OUTPUT_MAP_BACKUP - #define MSG_UBL_OUTPUT_MAP_BACKUP _UxGT("Off Printer Backup") - #endif +#ifndef MSG_UBL_OUTPUT_MAP_BACKUP + #define MSG_UBL_OUTPUT_MAP_BACKUP _UxGT("Off Printer Backup") +#endif #ifndef MSG_UBL_INFO_UBL #define MSG_UBL_INFO_UBL _UxGT("Output UBL Info") #endif diff --git a/Marlin/ubl.cpp b/Marlin/ubl.cpp index 14d411e5c..9805aff3f 100644 --- a/Marlin/ubl.cpp +++ b/Marlin/ubl.cpp @@ -115,8 +115,9 @@ void unified_bed_leveling::display_map(const int map_type) { constexpr uint8_t spaces = 8 * (GRID_MAX_POINTS_X - 2); + SERIAL_PROTOCOLPGM("\nBed Topography Report"); if (map_type == 0) { - SERIAL_PROTOCOLLNPGM("\nBed Topography Report:\n"); + SERIAL_PROTOCOLPGM(":\n\n"); serial_echo_xy(0, GRID_MAX_POINTS_Y - 1); SERIAL_ECHO_SP(spaces + 3); serial_echo_xy(GRID_MAX_POINTS_X - 1, GRID_MAX_POINTS_Y - 1); @@ -126,9 +127,10 @@ serial_echo_xy(UBL_MESH_MAX_X, UBL_MESH_MAX_Y); SERIAL_EOL(); } - - if (map_type == 1) { SERIAL_PROTOCOLLNPGM("\nBed Topography Report for CSV:"); SERIAL_EOL(); } - if (map_type == 2) { SERIAL_PROTOCOLLNPGM("\nBed Topography Report for LCD:"); SERIAL_EOL(); } + else { + SERIAL_PROTOCOLPGM(" for "); + serialprintPGM(map_type == 1 ? PSTR("CSV:\n\n") : PSTR("LCD:\n\n")); + } const float current_xi = get_cell_index_x(current_position[X_AXIS] + (MESH_X_DIST) / 2.0), current_yi = get_cell_index_y(current_position[Y_AXIS] + (MESH_Y_DIST) / 2.0); @@ -142,14 +144,14 @@ const float f = z_values[i][j]; if (isnan(f)) { - serialprintPGM((map_type == 0) ? PSTR(" . ") : PSTR("NAN")); + serialprintPGM(map_type == 0 ? PSTR(" . ") : PSTR("NAN")); } - else { + else if (map_type <= 1) { // if we don't do this, the columns won't line up nicely - if ((map_type == 0) && f >= 0.0) SERIAL_CHAR(' '); - if (map_type <= 1) SERIAL_PROTOCOL_F(f, 3); - idle(); + if (map_type == 0 && f >= 0.0) SERIAL_CHAR(' '); + SERIAL_PROTOCOL_F(f, 3); } + idle(); if (map_type == 1 && i < GRID_MAX_POINTS_X - 1) SERIAL_CHAR(','); #if TX_BUFFER_SIZE > 0 @@ -162,7 +164,7 @@ } } SERIAL_EOL(); - if (j && (map_type == 0)) { // we want the (0,0) up tight against the block of numbers + if (j && map_type == 0) { // we want the (0,0) up tight against the block of numbers SERIAL_CHAR(' '); SERIAL_EOL(); } @@ -183,8 +185,7 @@ bool unified_bed_leveling::sanity_check() { uint8_t error_flag = 0; - const int a = settings.calc_num_meshes(); - if (a < 1) { + if (settings.calc_num_meshes() < 1) { SERIAL_PROTOCOLLNPGM("?Insufficient EEPROM storage for a mesh of this size."); error_flag++; } diff --git a/Marlin/ubl_G29.cpp b/Marlin/ubl_G29.cpp index e15c8d772..8e047defb 100644 --- a/Marlin/ubl_G29.cpp +++ b/Marlin/ubl_G29.cpp @@ -1576,7 +1576,7 @@ if (ubl_lcd_map_control) { #if ENABLED(DOGLCD) - lcd_goto_screen(_lcd_ubl_output_map_lcd); + lcd_goto_screen(_lcd_ubl_output_map_lcd); #endif } else lcd_return_to_status(); diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 94a757625..71deaa1ee 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -2094,11 +2094,11 @@ void kill_screen(const char* lcd_msg) { /*********************************************************/ /************ Scale the box pixels appropriately *********/ /*********************************************************/ - x_map_pixels = ((MAP_MAX_PIXELS_X - 4) / GRID_MAX_POINTS_X) * GRID_MAX_POINTS_X; - y_map_pixels = ((MAP_MAX_PIXELS_Y - 4) / GRID_MAX_POINTS_Y) * GRID_MAX_POINTS_Y; + x_map_pixels = ((MAP_MAX_PIXELS_X - 4) / (GRID_MAX_POINTS_X)) * (GRID_MAX_POINTS_X); + y_map_pixels = ((MAP_MAX_PIXELS_Y - 4) / (GRID_MAX_POINTS_Y)) * (GRID_MAX_POINTS_Y); - pixels_per_X_mesh_pnt = x_map_pixels / GRID_MAX_POINTS_X; - pixels_per_Y_mesh_pnt = y_map_pixels / GRID_MAX_POINTS_Y; + pixels_per_X_mesh_pnt = x_map_pixels / (GRID_MAX_POINTS_X); + pixels_per_Y_mesh_pnt = y_map_pixels / (GRID_MAX_POINTS_Y); x_offset = MAP_UPPER_LEFT_CORNER_X + 1 + (MAP_MAX_PIXELS_X - x_map_pixels - 2) / 2; y_offset = MAP_UPPER_LEFT_CORNER_Y + 1 + (MAP_MAX_PIXELS_Y - y_map_pixels - 2) / 2; @@ -2184,7 +2184,7 @@ void kill_screen(const char* lcd_msg) { void sync_plan_position(); void _lcd_ubl_output_map_lcd() { - static int step_scaler=0; + static int16_t step_scaler = 0; int32_t signed_enc_pos; defer_return_to_status = true; @@ -2194,11 +2194,10 @@ void kill_screen(const char* lcd_msg) { if (lcd_clicked) { return _lcd_ubl_map_lcd_edit_cmd(); } ENCODER_DIRECTION_NORMAL(); - if (encoderPosition != 0) { + if (encoderPosition) { signed_enc_pos = (int32_t)encoderPosition; step_scaler += signed_enc_pos; - x_plot = (x_plot + step_scaler / ENCODER_STEPS_PER_MENU_ITEM); - + x_plot += step_scaler / (ENCODER_STEPS_PER_MENU_ITEM); if (abs(step_scaler) >= ENCODER_STEPS_PER_MENU_ITEM) step_scaler = 0; refresh_cmd_timeout(); @@ -2240,7 +2239,7 @@ void kill_screen(const char* lcd_msg) { ubl_map_move_to_xy(); // Move to current location - if (planner.movesplanned()>1) { // if the nozzle is moving, cancel the move. There is a new location + if (planner.movesplanned() > 1) { // if the nozzle is moving, cancel the move. There is a new location #define ENABLE_STEPPER_DRIVER_INTERRUPT() SBI(TIMSK1, OCIE1A) #define DISABLE_STEPPER_DRIVER_INTERRUPT() CBI(TIMSK1, OCIE1A) DISABLE_STEPPER_DRIVER_INTERRUPT();