Browse Source

Some cleanups for ubl lcd mesh map

Scott Lahteine 8 years ago
parent
commit
abd6ba62b4
3 changed files with 17 additions and 26 deletions
  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 View File

273
     #define LCD_FEEDRATE_CHAR    0x06
273
     #define LCD_FEEDRATE_CHAR    0x06
274
     #define LCD_CLOCK_CHAR       0x07
274
     #define LCD_CLOCK_CHAR       0x07
275
     #define LCD_STR_ARROW_RIGHT ">"  /* from the default character set */
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
   #endif
282
   #endif
277
 
283
 
278
   /**
284
   /**

+ 7
- 22
Marlin/ultralcd.cpp View File

2188
 
2188
 
2189
     void _lcd_ubl_output_map_lcd() {
2189
     void _lcd_ubl_output_map_lcd() {
2190
       static int16_t step_scaler = 0;
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
         ENCODER_DIRECTION_NORMAL();
2196
         ENCODER_DIRECTION_NORMAL();
2199
 
2197
 
2200
         if (encoderPosition) {
2198
         if (encoderPosition) {
2201
-          signed_enc_pos = (int32_t)encoderPosition;
2202
-          step_scaler += signed_enc_pos;
2199
+          step_scaler += (int32_t)encoderPosition;
2203
           x_plot += step_scaler / (ENCODER_STEPS_PER_MENU_ITEM);
2200
           x_plot += step_scaler / (ENCODER_STEPS_PER_MENU_ITEM);
2204
           if (abs(step_scaler) >= ENCODER_STEPS_PER_MENU_ITEM)
2201
           if (abs(step_scaler) >= ENCODER_STEPS_PER_MENU_ITEM)
2205
             step_scaler = 0;
2202
             step_scaler = 0;
2206
           refresh_cmd_timeout();
2203
           refresh_cmd_timeout();
2207
 
2204
 
2205
+          encoderPosition = 0;
2208
           lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
2206
           lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
2209
         }
2207
         }
2210
 
2208
 
2211
-        encoderPosition = 0;
2212
-
2213
         // Encoder to the right (++)
2209
         // Encoder to the right (++)
2214
         if (x_plot >= GRID_MAX_POINTS_X) { x_plot = 0; y_plot++; }
2210
         if (x_plot >= GRID_MAX_POINTS_X) { x_plot = 0; y_plot++; }
2215
         if (y_plot >= GRID_MAX_POINTS_Y) y_plot = 0;
2211
         if (y_plot >= GRID_MAX_POINTS_Y) y_plot = 0;
2236
 
2232
 
2237
           ubl_map_move_to_xy(); // Move to current location
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
             ubl_map_move_to_xy(); // Move to new location
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 View File

1134
           B00000,
1134
           B00000,
1135
           B11111
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
       #endif
1139
       #endif
1140
     }
1140
     }
1141
 
1141
 
1178
          * Draw the Mesh Map Box
1178
          * Draw the Mesh Map Box
1179
          */
1179
          */
1180
         uint8_t m;
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
         for (m = 0; m <= 3; m++) {
1183
         for (m = 0; m <= 3; m++) {
1184
           lcd.setCursor(2, m); lcd.write('|'); // Left
1184
           lcd.setCursor(2, m); lcd.write('|'); // Left
1185
           lcd.setCursor(8, m); lcd.write('|'); // Right
1185
           lcd.setCursor(8, m); lcd.write('|'); // Right

Loading…
Cancel
Save