Browse Source

Merge pull request #7204 from thinkyhead/bf_update_ubl_lcd

UBL radar map corrections
Scott Lahteine 7 years ago
parent
commit
3e78a01262
6 changed files with 196 additions and 205 deletions
  1. 6
    0
      Marlin/Conditionals_LCD.h
  2. 4
    8
      Marlin/Marlin_main.cpp
  3. 6
    11
      Marlin/ubl_G29.cpp
  4. 49
    56
      Marlin/ultralcd.cpp
  5. 1
    0
      Marlin/ultralcd.h
  6. 130
    130
      Marlin/ultralcd_impl_HD44780.h

+ 6
- 0
Marlin/Conditionals_LCD.h View File

@@ -273,6 +273,12 @@
273 273
     #define LCD_FEEDRATE_CHAR    0x06
274 274
     #define LCD_CLOCK_CHAR       0x07
275 275
     #define LCD_STR_ARROW_RIGHT ">"  /* from the default character set */
276
+
277
+    #if ENABLED(AUTO_BED_LEVELING_UBL)
278
+      #define LCD_UBL_BOXTOP_CHAR 0x01
279
+      #define LCD_UBL_BOXBOT_CHAR 0x02
280
+    #endif
281
+
276 282
   #endif
277 283
 
278 284
   /**

+ 4
- 8
Marlin/Marlin_main.cpp View File

@@ -333,7 +333,6 @@
333 333
 #if ENABLED(AUTO_BED_LEVELING_UBL)
334 334
   #include "ubl.h"
335 335
   extern bool defer_return_to_status;
336
-  extern bool ubl_lcd_map_control;
337 336
   unified_bed_leveling ubl;
338 337
   #define UBL_MESH_VALID !( ( ubl.z_values[0][0] == ubl.z_values[0][1] && ubl.z_values[0][1] == ubl.z_values[0][2] \
339 338
                            && 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() {
7742 7741
       #endif
7743 7742
     }
7744 7743
 
7745
-    #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD)  //only needed if have an LCD
7746
-      ubl_lcd_map_control = false;
7747
-      defer_return_to_status = false;
7744
+    #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD)  // Only needed with an LCD
7745
+      ubl_lcd_map_control = defer_return_to_status = false;
7748 7746
     #endif
7749
-
7750 7747
   }
7751 7748
 }
7752 7749
 
@@ -12637,9 +12634,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
12637 12634
     #if ENABLED(DISABLE_INACTIVE_E)
12638 12635
       disable_e_steppers();
12639 12636
     #endif
12640
-    #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD)  //only needed if have an LCD
12641
-      ubl_lcd_map_control = false;
12642
-      defer_return_to_status = false;
12637
+    #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD)  // Only needed with an LCD
12638
+      ubl_lcd_map_control = defer_return_to_status = false;
12643 12639
     #endif
12644 12640
   }
12645 12641
 

+ 6
- 11
Marlin/ubl_G29.cpp View File

@@ -45,9 +45,7 @@
45 45
     void lcd_mesh_edit_setup(float initial);
46 46
     float lcd_mesh_edit();
47 47
     void lcd_z_offset_edit_setup(float);
48
-    #if ENABLED(DOGLCD)
49
-      extern void _lcd_ubl_output_map_lcd();
50
-    #endif
48
+    extern void _lcd_ubl_output_map_lcd();
51 49
     float lcd_z_offset_edit();
52 50
   #endif
53 51
 
@@ -56,7 +54,6 @@
56 54
   extern float probe_pt(const float &x, const float &y, bool, int);
57 55
   extern bool set_probe_deployed(bool);
58 56
   extern void set_bed_leveling_enabled(bool);
59
-  extern bool ubl_lcd_map_control;
60 57
   typedef void (*screenFunc_t)();
61 58
   extern void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder = 0);
62 59
 
@@ -1522,7 +1519,7 @@
1522 1519
           idle();
1523 1520
         } while (!ubl_lcd_clicked());
1524 1521
 
1525
-        lcd_return_to_status();
1522
+        if (!ubl_lcd_map_control) lcd_return_to_status();
1526 1523
 
1527 1524
         // The technique used here generates a race condition for the encoder click.
1528 1525
         // It could get detected in lcd_mesh_edit (actually _lcd_mesh_fine_tune) or here.
@@ -1569,12 +1566,10 @@
1569 1566
       LCD_MESSAGEPGM(MSG_UBL_DONE_EDITING_MESH);
1570 1567
       SERIAL_ECHOLNPGM("Done Editing Mesh");
1571 1568
 
1572
-      if (ubl_lcd_map_control) {
1573
-        #if ENABLED(DOGLCD)
1574
-          lcd_goto_screen(_lcd_ubl_output_map_lcd);
1575
-        #endif
1576
-      }
1577
-      else lcd_return_to_status();
1569
+      if (ubl_lcd_map_control)
1570
+        lcd_goto_screen(_lcd_ubl_output_map_lcd);
1571
+      else
1572
+        lcd_return_to_status();
1578 1573
     }
1579 1574
 
1580 1575
   #endif // NEWPANEL

+ 49
- 56
Marlin/ultralcd.cpp View File

@@ -470,8 +470,14 @@ uint16_t max_display_update_time = 0;
470 470
         screen_history_depth = 0;
471 471
       }
472 472
       lcd_implementation_clear();
473
-      #if ENABLED(LCD_PROGRESS_BAR)
474
-        // For LCD_PROGRESS_BAR re-initialize custom characters
473
+      // Re-initialize custom characters that may be re-used
474
+      #if DISABLED(DOGLCD) && ENABLED(AUTO_BED_LEVELING_UBL)
475
+        if (!ubl_lcd_map_control) lcd_set_custom_characters(
476
+          #if ENABLED(LCD_PROGRESS_BAR)
477
+            screen == lcd_status_screen
478
+          #endif
479
+        );
480
+      #elif ENABLED(LCD_PROGRESS_BAR)
475 481
         lcd_set_custom_characters(screen == lcd_status_screen);
476 482
       #endif
477 483
       lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
@@ -2142,6 +2148,7 @@ void kill_screen(const char* lcd_msg) {
2142 2148
     void _lcd_ubl_output_map_lcd();
2143 2149
 
2144 2150
     void _lcd_ubl_map_homing() {
2151
+      defer_return_to_status = true;
2145 2152
       if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_HOMING), NULL);
2146 2153
       lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
2147 2154
       if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) {
@@ -2158,8 +2165,6 @@ void kill_screen(const char* lcd_msg) {
2158 2165
     void _lcd_ubl_map_lcd_edit_cmd() {
2159 2166
       char ubl_lcd_gcode [50], str[10], str2[10];
2160 2167
 
2161
-      ubl_lcd_map_control = true; // Used for returning to the map screen
2162
-
2163 2168
       dtostrf(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]), 0, 2, str);
2164 2169
       dtostrf(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]), 0, 2, str2);
2165 2170
       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) {
2183 2188
 
2184 2189
     void _lcd_ubl_output_map_lcd() {
2185 2190
       static int16_t step_scaler = 0;
2186
-      int32_t signed_enc_pos;
2187
-
2188
-      defer_return_to_status = true;
2189 2191
 
2190
-      if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]) {
2192
+      if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
2193
+        return lcd_goto_screen(_lcd_ubl_map_homing);
2191 2194
 
2192
-        if (lcd_clicked) { return _lcd_ubl_map_lcd_edit_cmd(); }
2193
-        ENCODER_DIRECTION_NORMAL();
2195
+      if (lcd_clicked) return _lcd_ubl_map_lcd_edit_cmd();
2196
+      ENCODER_DIRECTION_NORMAL();
2194 2197
 
2195
-        if (encoderPosition) {
2196
-          signed_enc_pos = (int32_t)encoderPosition;
2197
-          step_scaler += signed_enc_pos;
2198
-          x_plot += step_scaler / (ENCODER_STEPS_PER_MENU_ITEM);
2199
-          if (abs(step_scaler) >= ENCODER_STEPS_PER_MENU_ITEM)
2200
-            step_scaler = 0;
2201
-          refresh_cmd_timeout();
2202
-
2203
-          lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
2204
-        }
2198
+      if (encoderPosition) {
2199
+        step_scaler += (int32_t)encoderPosition;
2200
+        x_plot += step_scaler / (ENCODER_STEPS_PER_MENU_ITEM);
2201
+        if (abs(step_scaler) >= ENCODER_STEPS_PER_MENU_ITEM)
2202
+          step_scaler = 0;
2203
+        refresh_cmd_timeout();
2205 2204
 
2206 2205
         encoderPosition = 0;
2206
+        lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
2207
+      }
2207 2208
 
2208
-        // Encoder to the right (++)
2209
-        if (x_plot >= GRID_MAX_POINTS_X) { x_plot = 0; y_plot++; }
2210
-        if (y_plot >= GRID_MAX_POINTS_Y) y_plot = 0;
2209
+      // Encoder to the right (++)
2210
+      if (x_plot >= GRID_MAX_POINTS_X) { x_plot = 0; y_plot++; }
2211
+      if (y_plot >= GRID_MAX_POINTS_Y) y_plot = 0;
2211 2212
 
2212
-        // Encoder to the left (--)
2213
-        if (x_plot <= GRID_MAX_POINTS_X - (GRID_MAX_POINTS_X + 1)) { x_plot = GRID_MAX_POINTS_X - 1; y_plot--; }
2214
-        if (y_plot <= GRID_MAX_POINTS_Y - (GRID_MAX_POINTS_Y + 1)) y_plot = GRID_MAX_POINTS_Y - 1;
2213
+      // Encoder to the left (--)
2214
+      if (x_plot <= GRID_MAX_POINTS_X - (GRID_MAX_POINTS_X + 1)) { x_plot = GRID_MAX_POINTS_X - 1; y_plot--; }
2215
+      if (y_plot <= GRID_MAX_POINTS_Y - (GRID_MAX_POINTS_Y + 1)) y_plot = GRID_MAX_POINTS_Y - 1;
2215 2216
 
2216
-        // Prevent underrun/overrun of plot numbers
2217
-        x_plot = constrain(x_plot, GRID_MAX_POINTS_X - (GRID_MAX_POINTS_X + 1), GRID_MAX_POINTS_X + 1);
2218
-        y_plot = constrain(y_plot, GRID_MAX_POINTS_Y - (GRID_MAX_POINTS_Y + 1), GRID_MAX_POINTS_Y + 1);
2217
+      // Prevent underrun/overrun of plot numbers
2218
+      x_plot = constrain(x_plot, GRID_MAX_POINTS_X - (GRID_MAX_POINTS_X + 1), GRID_MAX_POINTS_X + 1);
2219
+      y_plot = constrain(y_plot, GRID_MAX_POINTS_Y - (GRID_MAX_POINTS_Y + 1), GRID_MAX_POINTS_Y + 1);
2219 2220
 
2220
-        // Determine number of points to edit
2221
-        #if IS_KINEMATIC
2222
-          n_edit_pts = 9; //TODO: Delta accessible edit points
2223
-        #else
2224
-          const bool xc = WITHIN(x_plot, 1, GRID_MAX_POINTS_X - 2),
2225
-                     yc = WITHIN(y_plot, 1, GRID_MAX_POINTS_Y - 2);
2226
-          n_edit_pts = yc ? (xc ? 9 : 6) : (xc ? 6 : 4); // Corners
2227
-        #endif
2221
+      // Determine number of points to edit
2222
+      #if IS_KINEMATIC
2223
+        n_edit_pts = 9; //TODO: Delta accessible edit points
2224
+      #else
2225
+        const bool xc = WITHIN(x_plot, 1, GRID_MAX_POINTS_X - 2),
2226
+                   yc = WITHIN(y_plot, 1, GRID_MAX_POINTS_Y - 2);
2227
+        n_edit_pts = yc ? (xc ? 9 : 6) : (xc ? 6 : 4); // Corners
2228
+      #endif
2228 2229
 
2229
-        if (lcdDrawUpdate) {
2230
-          lcd_implementation_ubl_plot(x_plot, y_plot);
2231
-
2232
-          ubl_map_move_to_xy(); // Move to current location
2233
-
2234
-          if (planner.movesplanned() > 1) { // if the nozzle is moving, cancel the move.  There is a new location
2235
-            #define ENABLE_STEPPER_DRIVER_INTERRUPT()  SBI(TIMSK1, OCIE1A)
2236
-            #define DISABLE_STEPPER_DRIVER_INTERRUPT() CBI(TIMSK1, OCIE1A)
2237
-            DISABLE_STEPPER_DRIVER_INTERRUPT();
2238
-            while (planner.blocks_queued()) planner.discard_current_block();
2239
-            stepper.current_block = NULL;
2240
-            planner.clear_block_buffer_runtime();
2241
-            ENABLE_STEPPER_DRIVER_INTERRUPT();
2242
-            set_current_from_steppers_for_axis(ALL_AXES);
2243
-            sync_plan_position();
2244
-            ubl_map_move_to_xy(); // Move to new location
2245
-          }
2230
+      if (lcdDrawUpdate) {
2231
+        lcd_implementation_ubl_plot(x_plot, y_plot);
2232
+
2233
+        ubl_map_move_to_xy(); // Move to current location
2234
+
2235
+        if (planner.movesplanned() > 1) { // if the nozzle is moving, cancel the move. There is a new location
2236
+          quickstop_stepper();
2237
+          ubl_map_move_to_xy(); // Move to new location
2246 2238
         }
2247
-        safe_delay(10);
2248 2239
       }
2249
-      else lcd_goto_screen(_lcd_ubl_map_homing);
2250 2240
     }
2251 2241
 
2252 2242
     /**
2253 2243
      * UBL Homing before LCD map
2254 2244
      */
2255 2245
     void _lcd_ubl_output_map_lcd_cmd() {
2246
+      ubl_lcd_map_control = true; // Return to the map screen (and don't restore the character set)
2256 2247
       if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
2257 2248
         enqueue_and_echo_commands_P(PSTR("G28"));
2258 2249
       lcd_goto_screen(_lcd_ubl_map_homing);
@@ -2393,6 +2384,8 @@ void kill_screen(const char* lcd_msg) {
2393 2384
         if (!g29_in_progress)
2394 2385
       #endif
2395 2386
       MENU_ITEM(submenu, MSG_BED_LEVELING, lcd_bed_leveling);
2387
+    #elif PLANNER_LEVELING
2388
+      MENU_ITEM(gcode, MSG_BED_LEVELING, PSTR("G28\nG29"));
2396 2389
     #endif
2397 2390
 
2398 2391
     #if HAS_M206_COMMAND

+ 1
- 0
Marlin/ultralcd.h View File

@@ -188,6 +188,7 @@
188 188
 void lcd_reset_status();
189 189
 
190 190
 #if ENABLED(AUTO_BED_LEVELING_UBL)
191
+  extern bool ubl_lcd_map_control;
191 192
   void lcd_mesh_edit_setup(float initial);
192 193
   float lcd_mesh_edit();
193 194
   void lcd_z_offset_edit_setup(float);

+ 130
- 130
Marlin/ultralcd_impl_HD44780.h View File

@@ -1085,151 +1085,151 @@ static void lcd_implementation_status_screen() {
1085 1085
 
1086 1086
 #if ENABLED(AUTO_BED_LEVELING_UBL)
1087 1087
 
1088
-    /* 
1089
-     * These are just basic data for the 20x4 LCD work that
1090
-     * is coming up very soon.
1091
-     * Soon this will morph into a map code.
1092
-     */
1088
+  /* 
1089
+   * These are just basic data for the 20x4 LCD work that
1090
+   * is coming up very soon.
1091
+   * Soon this will morph into a map code.
1092
+   */
1093
+
1094
+  /**
1095
+  Possible map screens:
1096
+
1097
+  16x2   |X000.00  Y000.00|
1098
+         |(00,00)  Z00.000|
1099
+
1100
+  20x2   | X:000.00  Y:000.00 |
1101
+         | (00,00)   Z:00.000 |
1102
+
1103
+  16x4   |+-------+(00,00)|
1104
+         ||       |X000.00|
1105
+         ||       |Y000.00|
1106
+         |+-------+Z00.000|
1107
+
1108
+  20x4   | +-------+  (00,00) |
1109
+         | |       |  X:000.00|
1110
+         | |       |  Y:000.00|
1111
+         | +-------+  Z:00.000|
1112
+  */
1113
+
1114
+  void lcd_set_ubl_map_plot_chars() {
1115
+    #if LCD_HEIGHT > 3
1116
+      //#include "_ubl_lcd_map_characters.h"
1117
+      const static byte _lcd_box_top[8] PROGMEM = {
1118
+        B11111,
1119
+        B00000,
1120
+        B00000,
1121
+        B00000,
1122
+        B00000,
1123
+        B00000,
1124
+        B00000,
1125
+        B00000
1126
+      };
1127
+      const static byte _lcd_box_bottom[8] PROGMEM = {
1128
+        B00000,
1129
+        B00000,
1130
+        B00000,
1131
+        B00000,
1132
+        B00000,
1133
+        B00000,
1134
+        B00000,
1135
+        B11111
1136
+      };
1137
+      createChar_P(LCD_UBL_BOXTOP_CHAR, _lcd_box_top);
1138
+      createChar_P(LCD_UBL_BOXBOT_CHAR, _lcd_box_bottom);
1139
+    #endif
1140
+  }
1093 1141
 
1094
-    /**
1095
-    Possible map screens:
1096
-
1097
-    16x2   |X000.00  Y000.00|
1098
-           |(00,00)  Z00.000|
1099
-
1100
-    20x2   | X:000.00  Y:000.00 |
1101
-           | (00,00)   Z:00.000 |
1102
-
1103
-    16x4   |+-------+(00,00)|
1104
-           ||       |X000.00|
1105
-           ||       |Y000.00|
1106
-           |+-------+Z00.000|
1107
-
1108
-    20x4   | +-------+  (00,00) |
1109
-           | |       |  X:000.00|
1110
-           | |       |  Y:000.00|
1111
-           | +-------+  Z:00.000|
1112
-    */
1113
-
1114
-    void lcd_set_ubl_map_plot_chars() {
1115
-      #if LCD_HEIGHT > 3
1116
-        //#include "_ubl_lcd_map_characters.h"
1117
-        const static byte _lcd_box_top[8] PROGMEM = {
1118
-          B11111,
1119
-          B00000,
1120
-          B00000,
1121
-          B00000,
1122
-          B00000,
1123
-          B00000,
1124
-          B00000,
1125
-          B00000
1126
-        };
1127
-        const static byte _lcd_box_bottom[8] PROGMEM = {
1128
-          B00000,
1129
-          B00000,
1130
-          B00000,
1131
-          B00000,
1132
-          B00000,
1133
-          B00000,
1134
-          B00000,
1135
-          B11111
1136
-        };
1137
-        createChar_P(1, _lcd_box_top);
1138
-        createChar_P(2, _lcd_box_bottom);
1139
-      #endif
1140
-    }
1142
+  void lcd_implementation_ubl_plot(const uint8_t x_plot, const uint8_t y_plot) {
1141 1143
 
1142
-    void lcd_implementation_ubl_plot(const uint8_t x_plot, const uint8_t y_plot) {
1144
+    #if LCD_WIDTH >= 20
1145
+      #define _LCD_W_POS 12
1146
+      #define _PLOT_X 1
1147
+      #define _MAP_X 3
1148
+      #define _LABEL(C,X,Y) lcd.setCursor(X, Y); lcd.print(C)
1149
+      #define _XLABEL(X,Y) _LABEL("X:",X,Y)
1150
+      #define _YLABEL(X,Y) _LABEL("Y:",X,Y)
1151
+      #define _ZLABEL(X,Y) _LABEL("Z:",X,Y)
1152
+    #else
1153
+      #define _LCD_W_POS 8
1154
+      #define _PLOT_X 0
1155
+      #define _MAP_X 1
1156
+      #define _LABEL(X,Y,C) lcd.setCursor(X, Y); lcd.write(C)
1157
+      #define _XLABEL(X,Y) _LABEL('X',X,Y)
1158
+      #define _YLABEL(X,Y) _LABEL('Y',X,Y)
1159
+      #define _ZLABEL(X,Y) _LABEL('Z',X,Y)
1160
+    #endif
1143 1161
 
1144
-      #if LCD_WIDTH >= 20
1145
-        #define _LCD_W_POS 12
1146
-        #define _PLOT_X 1
1147
-        #define _MAP_X 3
1148
-        #define _LABEL(C,X,Y) lcd.setCursor(X, Y); lcd.print(C)
1149
-        #define _XLABEL(X,Y) _LABEL("X:",X,Y)
1150
-        #define _YLABEL(X,Y) _LABEL("Y:",X,Y)
1151
-        #define _ZLABEL(X,Y) _LABEL("Z:",X,Y)
1152
-      #else
1153
-        #define _LCD_W_POS 8
1154
-        #define _PLOT_X 0
1155
-        #define _MAP_X 1
1156
-        #define _LABEL(X,Y,C) lcd.setCursor(X, Y); lcd.write(C)
1157
-        #define _XLABEL(X,Y) _LABEL('X',X,Y)
1158
-        #define _YLABEL(X,Y) _LABEL('Y',X,Y)
1159
-        #define _ZLABEL(X,Y) _LABEL('Z',X,Y)
1160
-      #endif
1162
+    #if LCD_HEIGHT <= 3   // 16x2 or 20x2 display
1161 1163
 
1162
-      #if LCD_HEIGHT <= 3   // 16x2 or 20x2 display
1164
+      /**
1165
+       * Show X and Y positions
1166
+       */
1167
+      _XLABEL(_PLOT_X, 0);
1168
+      lcd.print(ftostr32(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]))));
1163 1169
 
1164
-        /**
1165
-         * Show X and Y positions
1166
-         */
1167
-        _XLABEL(_PLOT_X, 0);
1168
-        lcd.print(ftostr32(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]))));
1170
+      _YLABEL(_LCD_W_POS, 0);
1171
+      lcd.print(ftostr32(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]))));
1169 1172
 
1170
-        _YLABEL(_LCD_W_POS, 0);
1171
-        lcd.print(ftostr32(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]))));
1173
+      lcd.setCursor(_PLOT_X, 0);
1172 1174
 
1173
-        lcd.setCursor(_PLOT_X, 0);
1175
+    #else                 // 16x4 or 20x4 display
1174 1176
 
1175
-      #else                 // 16x4 or 20x4 display
1177
+      /**
1178
+       * Draw the Mesh Map Box
1179
+       */
1180
+      uint8_t m;
1181
+      lcd.setCursor(_MAP_X, 0); for (m = 0; m < 5; m++) lcd.write(LCD_UBL_BOXTOP_CHAR); // Top
1182
+      lcd.setCursor(_MAP_X, 3); for (m = 0; m < 5; m++) lcd.write(LCD_UBL_BOXBOT_CHAR); // Bottom
1183
+      for (m = 0; m <= 3; m++) {
1184
+        lcd.setCursor(2, m); lcd.write('|'); // Left
1185
+        lcd.setCursor(8, m); lcd.write('|'); // Right
1186
+      }
1176 1187
 
1177
-        /**
1178
-         * Draw the Mesh Map Box
1179
-         */
1180
-        uint8_t m;
1181
-        lcd.setCursor(_MAP_X, 0); for (m = 0; m < 5; m++) lcd.write(1); // Top
1182
-        lcd.setCursor(_MAP_X, 3); for (m = 0; m < 5; m++) lcd.write(2); // Bottom
1183
-        for (m = 0; m <= 3; m++) {
1184
-          lcd.setCursor(2, m); lcd.write('|'); // Left
1185
-          lcd.setCursor(8, m); lcd.write('|'); // Right
1186
-        }
1188
+      lcd.setCursor(_LCD_W_POS, 0);
1187 1189
 
1188
-        lcd.setCursor(_LCD_W_POS, 0);
1190
+    #endif
1189 1191
 
1190
-      #endif
1192
+    /**
1193
+     * Print plot position
1194
+     */
1195
+    lcd.write('(');
1196
+    lcd.print(x_plot);
1197
+    lcd.write(',');
1198
+    lcd.print(y_plot);
1199
+    lcd.write(')');
1200
+
1201
+    #if LCD_HEIGHT <= 3   // 16x2 or 20x2 display
1191 1202
 
1192 1203
       /**
1193
-       * Print plot position
1204
+       * Print Z values
1194 1205
        */
1195
-      lcd.write('(');
1196
-      lcd.print(x_plot);
1197
-      lcd.write(',');
1198
-      lcd.print(y_plot);
1199
-      lcd.write(')');
1200
-
1201
-      #if LCD_HEIGHT <= 3   // 16x2 or 20x2 display
1202
-
1203
-        /**
1204
-         * Print Z values
1205
-         */
1206
-        _ZLABEL(_LCD_W_POS, 1);
1207
-        if (!isnan(ubl.z_values[x_plot][y_plot]))
1208
-          lcd.print(ftostr43sign(ubl.z_values[x_plot][y_plot]));
1209
-        else
1210
-          lcd_printPGM(PSTR(" -----"));
1211
-
1212
-      #else                 // 16x4 or 20x4 display
1213
-
1214
-        /**
1215
-         * Show all values at right of screen
1216
-         */
1217
-        _XLABEL(_LCD_W_POS, 1);
1218
-        lcd.print(ftostr32(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]))));
1219
-        _YLABEL(_LCD_W_POS, 2);
1220
-        lcd.print(ftostr32(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]))));
1221
-
1222
-        /**
1223
-         * Show the location value
1224
-         */
1225
-        _ZLABEL(_LCD_W_POS, 3);
1226
-        if (!isnan(ubl.z_values[x_plot][y_plot]))
1227
-          lcd.print(ftostr43sign(ubl.z_values[x_plot][y_plot]));
1228
-        else
1229
-          lcd_printPGM(PSTR(" -----"));
1206
+      _ZLABEL(_LCD_W_POS, 1);
1207
+      if (!isnan(ubl.z_values[x_plot][y_plot]))
1208
+        lcd.print(ftostr43sign(ubl.z_values[x_plot][y_plot]));
1209
+      else
1210
+        lcd_printPGM(PSTR(" -----"));
1230 1211
 
1231
-      #endif // LCD_HEIGHT > 3
1232
-    }
1212
+    #else                 // 16x4 or 20x4 display
1213
+
1214
+      /**
1215
+       * Show all values at right of screen
1216
+       */
1217
+      _XLABEL(_LCD_W_POS, 1);
1218
+      lcd.print(ftostr32(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]))));
1219
+      _YLABEL(_LCD_W_POS, 2);
1220
+      lcd.print(ftostr32(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]))));
1221
+
1222
+      /**
1223
+       * Show the location value
1224
+       */
1225
+      _ZLABEL(_LCD_W_POS, 3);
1226
+      if (!isnan(ubl.z_values[x_plot][y_plot]))
1227
+        lcd.print(ftostr43sign(ubl.z_values[x_plot][y_plot]));
1228
+      else
1229
+        lcd_printPGM(PSTR(" -----"));
1230
+
1231
+    #endif // LCD_HEIGHT > 3
1232
+  }
1233 1233
 
1234 1234
 #endif // AUTO_BED_LEVELING_UBL
1235 1235
 

Loading…
Cancel
Save