Browse Source

Patch ubl lcd mesh map indentation

Scott Lahteine 7 years ago
parent
commit
4cb45c10dd
2 changed files with 165 additions and 165 deletions
  1. 35
    35
      Marlin/ultralcd.cpp
  2. 130
    130
      Marlin/ultralcd_impl_HD44780.h

+ 35
- 35
Marlin/ultralcd.cpp View File

@@ -2192,51 +2192,51 @@ void kill_screen(const char* lcd_msg) {
2192 2192
       if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
2193 2193
         return lcd_goto_screen(_lcd_ubl_map_homing);
2194 2194
 
2195
-        if (lcd_clicked) return _lcd_ubl_map_lcd_edit_cmd();
2196
-        ENCODER_DIRECTION_NORMAL();
2195
+      if (lcd_clicked) return _lcd_ubl_map_lcd_edit_cmd();
2196
+      ENCODER_DIRECTION_NORMAL();
2197 2197
 
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();
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();
2204 2204
 
2205
-          encoderPosition = 0;
2206
-          lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
2207
-        }
2205
+        encoderPosition = 0;
2206
+        lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
2207
+      }
2208 2208
 
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;
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;
2212 2212
 
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;
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;
2216 2216
 
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);
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);
2220 2220
 
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
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
2229 2229
 
2230
-        if (lcdDrawUpdate) {
2231
-          lcd_implementation_ubl_plot(x_plot, y_plot);
2230
+      if (lcdDrawUpdate) {
2231
+        lcd_implementation_ubl_plot(x_plot, y_plot);
2232 2232
 
2233
-          ubl_map_move_to_xy(); // Move to current location
2233
+        ubl_map_move_to_xy(); // Move to current location
2234 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
2238
-          }
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
2239 2238
         }
2239
+      }
2240 2240
     }
2241 2241
 
2242 2242
     /**

+ 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(LCD_UBL_BOXTOP_CHAR, _lcd_box_top);
1138
-        createChar_P(LCD_UBL_BOXBOT_CHAR, _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(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
-        }
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