Explorar el Código

Some cleanups for ubl lcd mesh map

Scott Lahteine hace 8 años
padre
commit
abd6ba62b4
Se han modificado 3 ficheros con 17 adiciones y 26 borrados
  1. 6
    0
      Marlin/Conditionals_LCD.h
  2. 7
    22
      Marlin/ultralcd.cpp
  3. 4
    4
      Marlin/ultralcd_impl_HD44780.h

+ 6
- 0
Marlin/Conditionals_LCD.h Ver fichero

@@ -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
   /**

+ 7
- 22
Marlin/ultralcd.cpp Ver fichero

@@ -2188,28 +2188,24 @@ void kill_screen(const char* lcd_msg) {
2188 2188
 
2189 2189
     void _lcd_ubl_output_map_lcd() {
2190 2190
       static int16_t step_scaler = 0;
2191
-      int32_t signed_enc_pos;
2192 2191
 
2193
-      defer_return_to_status = true;
2194
-
2195
-      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);
2196 2194
 
2197
-        if (lcd_clicked) { return _lcd_ubl_map_lcd_edit_cmd(); }
2195
+        if (lcd_clicked) return _lcd_ubl_map_lcd_edit_cmd();
2198 2196
         ENCODER_DIRECTION_NORMAL();
2199 2197
 
2200 2198
         if (encoderPosition) {
2201
-          signed_enc_pos = (int32_t)encoderPosition;
2202
-          step_scaler += signed_enc_pos;
2199
+          step_scaler += (int32_t)encoderPosition;
2203 2200
           x_plot += step_scaler / (ENCODER_STEPS_PER_MENU_ITEM);
2204 2201
           if (abs(step_scaler) >= ENCODER_STEPS_PER_MENU_ITEM)
2205 2202
             step_scaler = 0;
2206 2203
           refresh_cmd_timeout();
2207 2204
 
2205
+          encoderPosition = 0;
2208 2206
           lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
2209 2207
         }
2210 2208
 
2211
-        encoderPosition = 0;
2212
-
2213 2209
         // Encoder to the right (++)
2214 2210
         if (x_plot >= GRID_MAX_POINTS_X) { x_plot = 0; y_plot++; }
2215 2211
         if (y_plot >= GRID_MAX_POINTS_Y) y_plot = 0;
@@ -2236,22 +2232,11 @@ void kill_screen(const char* lcd_msg) {
2236 2232
 
2237 2233
           ubl_map_move_to_xy(); // Move to current location
2238 2234
 
2239
-          if (planner.movesplanned() > 1) { // if the nozzle is moving, cancel the move.  There is a new location
2240
-            #define ENABLE_STEPPER_DRIVER_INTERRUPT()  SBI(TIMSK1, OCIE1A)
2241
-            #define DISABLE_STEPPER_DRIVER_INTERRUPT() CBI(TIMSK1, OCIE1A)
2242
-            DISABLE_STEPPER_DRIVER_INTERRUPT();
2243
-            while (planner.blocks_queued()) planner.discard_current_block();
2244
-            stepper.current_block = NULL;
2245
-            planner.clear_block_buffer_runtime();
2246
-            ENABLE_STEPPER_DRIVER_INTERRUPT();
2247
-            set_current_from_steppers_for_axis(ALL_AXES);
2248
-            sync_plan_position();
2235
+          if (planner.movesplanned() > 1) { // if the nozzle is moving, cancel the move. There is a new location
2236
+            quickstop_stepper();
2249 2237
             ubl_map_move_to_xy(); // Move to new location
2250 2238
           }
2251 2239
         }
2252
-        safe_delay(10);
2253
-      }
2254
-      else lcd_goto_screen(_lcd_ubl_map_homing);
2255 2240
     }
2256 2241
 
2257 2242
     /**

+ 4
- 4
Marlin/ultralcd_impl_HD44780.h Ver fichero

@@ -1134,8 +1134,8 @@ static void lcd_implementation_status_screen() {
1134 1134
           B00000,
1135 1135
           B11111
1136 1136
         };
1137
-        createChar_P(1, _lcd_box_top);
1138
-        createChar_P(2, _lcd_box_bottom);
1137
+        createChar_P(LCD_UBL_BOXTOP_CHAR, _lcd_box_top);
1138
+        createChar_P(LCD_UBL_BOXBOT_CHAR, _lcd_box_bottom);
1139 1139
       #endif
1140 1140
     }
1141 1141
 
@@ -1178,8 +1178,8 @@ static void lcd_implementation_status_screen() {
1178 1178
          * Draw the Mesh Map Box
1179 1179
          */
1180 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
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 1183
         for (m = 0; m <= 3; m++) {
1184 1184
           lcd.setCursor(2, m); lcd.write('|'); // Left
1185 1185
           lcd.setCursor(8, m); lcd.write('|'); // Right

Loading…
Cancelar
Guardar