Browse Source

Merge pull request #5487 from thinkyhead/rc_easier_move_axis

Rearrange Move Menu, Fix up Delta Calibration
Scott Lahteine 7 years ago
parent
commit
0772c8e55f

+ 2
- 1
Marlin/Marlin.h View File

@@ -322,7 +322,8 @@ float code_value_temp_diff();
322 322
                delta_segments_per_second,
323 323
                delta_diagonal_rod_trim_tower_1,
324 324
                delta_diagonal_rod_trim_tower_2,
325
-               delta_diagonal_rod_trim_tower_3;
325
+               delta_diagonal_rod_trim_tower_3,
326
+               delta_clip_start_height;
326 327
   void recalc_delta_settings(float radius, float diagonal_rod);
327 328
 #elif IS_SCARA
328 329
   void forward_kinematics_SCARA(const float &a, const float &b);

+ 0
- 3
Marlin/example_configurations/delta/biv2.5/Configuration.h View File

@@ -453,10 +453,7 @@
453 453
   #define DELTA_PRINTABLE_RADIUS 160.0
454 454
 
455 455
   // Delta calibration menu
456
-  // uncomment to add three points calibration menu option.
457 456
   // See http://minow.blogspot.com/index.html#4918805519571907051
458
-  // If needed, adjust the X, Y, Z calibration coordinates
459
-  // in ultralcd.cpp@lcd_delta_calibrate_menu()
460 457
   //#define DELTA_CALIBRATION_MENU
461 458
 
462 459
   // After homing move down to a height where XY movement is unconstrained

+ 0
- 3
Marlin/example_configurations/delta/generic/Configuration.h View File

@@ -453,10 +453,7 @@
453 453
   #define DELTA_PRINTABLE_RADIUS 140.0
454 454
 
455 455
   // Delta calibration menu
456
-  // uncomment to add three points calibration menu option.
457 456
   // See http://minow.blogspot.com/index.html#4918805519571907051
458
-  // If needed, adjust the X, Y, Z calibration coordinates
459
-  // in ultralcd.cpp@lcd_delta_calibrate_menu()
460 457
   //#define DELTA_CALIBRATION_MENU
461 458
 
462 459
   // After homing move down to a height where XY movement is unconstrained

+ 0
- 3
Marlin/example_configurations/delta/kossel_mini/Configuration.h View File

@@ -453,10 +453,7 @@
453 453
   #define DELTA_PRINTABLE_RADIUS 90.0
454 454
 
455 455
   // Delta calibration menu
456
-  // uncomment to add three points calibration menu option.
457 456
   // See http://minow.blogspot.com/index.html#4918805519571907051
458
-  // If needed, adjust the X, Y, Z calibration coordinates
459
-  // in ultralcd.cpp@lcd_delta_calibrate_menu()
460 457
   //#define DELTA_CALIBRATION_MENU
461 458
 
462 459
   // After homing move down to a height where XY movement is unconstrained

+ 0
- 3
Marlin/example_configurations/delta/kossel_pro/Configuration.h View File

@@ -440,10 +440,7 @@
440 440
   #define DELTA_PRINTABLE_RADIUS 127.0
441 441
 
442 442
   // Delta calibration menu
443
-  // uncomment to add three points calibration menu option.
444 443
   // See http://minow.blogspot.com/index.html#4918805519571907051
445
-  // If needed, adjust the X, Y, Z calibration coordinates
446
-  // in ultralcd.cpp@lcd_delta_calibrate_menu()
447 444
   //#define DELTA_CALIBRATION_MENU
448 445
 
449 446
   // After homing move down to a height where XY movement is unconstrained

+ 0
- 3
Marlin/example_configurations/delta/kossel_xl/Configuration.h View File

@@ -451,10 +451,7 @@
451 451
   #define DELTA_PRINTABLE_RADIUS 140.0
452 452
 
453 453
   // Delta calibration menu
454
-  // uncomment to add three points calibration menu option.
455 454
   // See http://minow.blogspot.com/index.html#4918805519571907051
456
-  // If needed, adjust the X, Y, Z calibration coordinates
457
-  // in ultralcd.cpp@lcd_delta_calibrate_menu()
458 455
   //#define DELTA_CALIBRATION_MENU
459 456
 
460 457
   // After homing move down to a height where XY movement is unconstrained

+ 6
- 0
Marlin/language_en.h View File

@@ -138,6 +138,12 @@
138 138
 #ifndef MSG_LEVEL_BED
139 139
   #define MSG_LEVEL_BED                       "Level bed"
140 140
 #endif
141
+#ifndef MSG_MOVING
142
+  #define MSG_MOVING                          "Moving..."
143
+#endif
144
+#ifndef MSG_FREE_XY
145
+  #define MSG_FREE_XY                         "Free XY"
146
+#endif
141 147
 #ifndef MSG_MOVE_X
142 148
   #define MSG_MOVE_X                          "Move X"
143 149
 #endif

+ 211
- 104
Marlin/ultralcd.cpp View File

@@ -390,7 +390,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
390 390
   bool screen_changed;
391 391
 
392 392
   // LCD and menu clicks
393
-  bool lcd_clicked, wait_for_unclick, defer_return_to_status;
393
+  bool lcd_clicked, wait_for_unclick, defer_return_to_status, no_reentrance;
394 394
 
395 395
   // Variables used when editing values.
396 396
   const char* editLabel;
@@ -422,6 +422,27 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
422 422
     }
423 423
   }
424 424
 
425
+  /**
426
+   * Synchronize safely while holding the current screen
427
+   * This blocks all further screen or stripe updates once called
428
+   */
429
+  inline void lcd_synchronize() {
430
+    lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_MOVING));
431
+    if (no_reentrance) return;
432
+    no_reentrance = true;
433
+    screenFunc_t old_screen = currentScreen;
434
+    lcd_goto_screen(lcd_synchronize);
435
+    stepper.synchronize();
436
+    no_reentrance = false;
437
+    lcd_goto_screen(old_screen);
438
+  }
439
+
440
+  inline void lcd_wait_for_homing() {
441
+    no_reentrance = true;
442
+    while (!axis_homed[X_AXIS] || !axis_homed[Y_AXIS] || !axis_homed[Z_AXIS]) idle();
443
+    no_reentrance = true;
444
+  }
445
+
425 446
   void lcd_return_to_status() { lcd_goto_screen(lcd_status_screen); }
426 447
 
427 448
   void lcd_save_previous_screen() {
@@ -1063,6 +1084,7 @@ void kill_screen(const char* lcd_msg) {
1063 1084
     // Note: During Manual Bed Leveling the homed Z position is MESH_HOME_SEARCH_Z
1064 1085
     // Z position will be restored with the final action, a G28
1065 1086
     inline void _mbl_goto_xy(float x, float y) {
1087
+      if (no_reentrance) return;
1066 1088
       current_position[Z_AXIS] = LOGICAL_Z_POSITION(MESH_HOME_SEARCH_Z + Z_HOMING_HEIGHT);
1067 1089
       line_to_current(Z_AXIS);
1068 1090
       current_position[X_AXIS] = LOGICAL_X_POSITION(x);
@@ -1072,7 +1094,7 @@ void kill_screen(const char* lcd_msg) {
1072 1094
         current_position[Z_AXIS] = LOGICAL_Z_POSITION(MESH_HOME_SEARCH_Z);
1073 1095
         line_to_current(Z_AXIS);
1074 1096
       #endif
1075
-      stepper.synchronize();
1097
+      lcd_synchronize();
1076 1098
     }
1077 1099
 
1078 1100
     void _lcd_level_goto_next_point();
@@ -1094,6 +1116,8 @@ void kill_screen(const char* lcd_msg) {
1094 1116
     void _lcd_level_bed_get_z() {
1095 1117
       ENCODER_DIRECTION_NORMAL();
1096 1118
 
1119
+      if (no_reentrance) goto KeepDrawing;
1120
+
1097 1121
       // Encoder wheel adjusts the Z position
1098 1122
       if (encoderPosition) {
1099 1123
         refresh_cmd_timeout();
@@ -1121,7 +1145,7 @@ void kill_screen(const char* lcd_msg) {
1121 1145
 
1122 1146
             current_position[Z_AXIS] = MESH_HOME_SEARCH_Z + Z_HOMING_HEIGHT;
1123 1147
             line_to_current(Z_AXIS);
1124
-            stepper.synchronize();
1148
+            lcd_synchronize();
1125 1149
 
1126 1150
             mbl.set_has_mesh(true);
1127 1151
             enqueue_and_echo_commands_P(PSTR("G28"));
@@ -1141,6 +1165,7 @@ void kill_screen(const char* lcd_msg) {
1141 1165
         debounce_click = false;
1142 1166
       }
1143 1167
 
1168
+KeepDrawing:
1144 1169
       // Update on first display, then only on updates to Z position
1145 1170
       // Show message above on clicks instead
1146 1171
       if (lcdDrawUpdate) {
@@ -1215,8 +1240,9 @@ void kill_screen(const char* lcd_msg) {
1215 1240
           LCDVIEW_CALL_NO_REDRAW
1216 1241
         #endif
1217 1242
       ;
1218
-      if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
1219
-        lcd_goto_screen(_lcd_level_bed_homing_done);
1243
+      if (no_reentrance) return;
1244
+      lcd_wait_for_homing();
1245
+      lcd_goto_screen(_lcd_level_bed_homing_done);
1220 1246
     }
1221 1247
 
1222 1248
     /**
@@ -1257,6 +1283,14 @@ void kill_screen(const char* lcd_msg) {
1257 1283
     MENU_BACK(MSG_MAIN);
1258 1284
 
1259 1285
     //
1286
+    // Move Axis
1287
+    //
1288
+    #if ENABLED(DELTA)
1289
+      if (axis_homed[Z_AXIS])
1290
+    #endif
1291
+        MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
1292
+
1293
+    //
1260 1294
     // Auto Home
1261 1295
     //
1262 1296
     MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
@@ -1284,11 +1318,6 @@ void kill_screen(const char* lcd_msg) {
1284 1318
     #endif
1285 1319
 
1286 1320
     //
1287
-    // Move Axis
1288
-    //
1289
-    MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
1290
-
1291
-    //
1292 1321
     // Disable Steppers
1293 1322
     //
1294 1323
     MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84"));
@@ -1341,14 +1370,50 @@ void kill_screen(const char* lcd_msg) {
1341 1370
     END_MENU();
1342 1371
   }
1343 1372
 
1373
+  float move_menu_scale;
1374
+
1344 1375
   #if ENABLED(DELTA_CALIBRATION_MENU)
1345 1376
 
1377
+    void lcd_move_z();
1378
+    void lcd_delta_calibrate_menu();
1379
+
1380
+    void _lcd_calibrate_homing() {
1381
+      if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_LEVEL_BED_HOMING));
1382
+      lcdDrawUpdate =
1383
+        #if ENABLED(DOGLCD)
1384
+          LCDVIEW_CALL_REDRAW_NEXT
1385
+        #else
1386
+          LCDVIEW_CALL_NO_REDRAW
1387
+        #endif
1388
+      ;
1389
+      if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
1390
+        lcd_goto_previous_menu();
1391
+    }
1392
+
1393
+    void _lcd_delta_calibrate_home() {
1394
+      enqueue_and_echo_commands_P(PSTR("G28"));
1395
+      lcd_goto_screen(_lcd_calibrate_homing);
1396
+    }
1397
+
1398
+    // Move directly to the tower position with uninterpolated moves
1399
+    // If we used interpolated moves it would cause this to become re-entrant
1346 1400
     void _goto_tower_pos(const float &a) {
1347
-      do_blocking_move_to(
1348
-        a < 0 ? X_HOME_POS : sin(a) * -(DELTA_PRINTABLE_RADIUS),
1349
-        a < 0 ? Y_HOME_POS : cos(a) *  (DELTA_PRINTABLE_RADIUS),
1350
-        4
1351
-      );
1401
+      if (no_reentrance) return;
1402
+
1403
+      current_position[Z_AXIS] = max(Z_HOMING_HEIGHT, Z_CLEARANCE_BETWEEN_PROBES) + (DELTA_PRINTABLE_RADIUS) / 5;
1404
+      line_to_current(Z_AXIS);
1405
+
1406
+      current_position[X_AXIS] = a < 0 ? X_HOME_POS : sin(a) * -(DELTA_PRINTABLE_RADIUS);
1407
+      current_position[Y_AXIS] = a < 0 ? Y_HOME_POS : cos(a) *  (DELTA_PRINTABLE_RADIUS);
1408
+      line_to_current(Z_AXIS);
1409
+
1410
+      current_position[Z_AXIS] = 4.0;
1411
+      line_to_current(Z_AXIS);
1412
+
1413
+      lcd_synchronize();
1414
+
1415
+      move_menu_scale = 0.1;
1416
+      lcd_goto_screen(lcd_move_z);
1352 1417
     }
1353 1418
 
1354 1419
     void _goto_tower_x() { _goto_tower_pos(RADIANS(120)); }
@@ -1359,18 +1424,18 @@ void kill_screen(const char* lcd_msg) {
1359 1424
     void lcd_delta_calibrate_menu() {
1360 1425
       START_MENU();
1361 1426
       MENU_BACK(MSG_MAIN);
1362
-      MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
1363
-      MENU_ITEM(function, MSG_DELTA_CALIBRATE_X, _goto_tower_x);
1364
-      MENU_ITEM(function, MSG_DELTA_CALIBRATE_Y, _goto_tower_y);
1365
-      MENU_ITEM(function, MSG_DELTA_CALIBRATE_Z, _goto_tower_z);
1366
-      MENU_ITEM(function, MSG_DELTA_CALIBRATE_CENTER, _goto_center);
1427
+      MENU_ITEM(submenu, MSG_AUTO_HOME, _lcd_delta_calibrate_home);
1428
+      if (axis_homed[Z_AXIS]) {
1429
+        MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_X, _goto_tower_x);
1430
+        MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_Y, _goto_tower_y);
1431
+        MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_Z, _goto_tower_z);
1432
+        MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_CENTER, _goto_center);
1433
+      }
1367 1434
       END_MENU();
1368 1435
     }
1369 1436
 
1370 1437
   #endif // DELTA_CALIBRATION_MENU
1371 1438
 
1372
-  float move_menu_scale;
1373
-
1374 1439
   /**
1375 1440
    * If the most recent manual move hasn't been fed to the planner yet,
1376 1441
    * and the planner can accept one, send immediately
@@ -1495,58 +1560,48 @@ void kill_screen(const char* lcd_msg) {
1495 1560
    *
1496 1561
    */
1497 1562
 
1498
-  #if IS_KINEMATIC
1499
-    #define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
1500
-  #else
1501
-    #define _MOVE_XYZ_ALLOWED true
1502
-  #endif
1563
+  screenFunc_t _manual_move_func_ptr;
1503 1564
 
1504
-  void _lcd_move_menu_axis() {
1505
-    START_MENU();
1506
-    MENU_BACK(MSG_MOVE_AXIS);
1507
-
1508
-    if (_MOVE_XYZ_ALLOWED) {
1509
-      MENU_ITEM(submenu, MSG_MOVE_X, lcd_move_x);
1510
-      MENU_ITEM(submenu, MSG_MOVE_Y, lcd_move_y);
1511
-    }
1512
-
1513
-    if (move_menu_scale < 10.0) {
1514
-      if (_MOVE_XYZ_ALLOWED) MENU_ITEM(submenu, MSG_MOVE_Z, lcd_move_z);
1515
-
1516
-      #if ENABLED(SWITCHING_EXTRUDER)
1517
-        if (active_extruder)
1518
-          MENU_ITEM(gcode, MSG_SELECT " " MSG_E1, PSTR("T0"));
1519
-        else
1520
-          MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1"));
1521
-      #endif
1565
+  void lcd_move_menu_10mm() { move_menu_scale = 10.0; lcd_goto_screen(_manual_move_func_ptr); }
1566
+  void lcd_move_menu_1mm()  { move_menu_scale =  1.0; lcd_goto_screen(_manual_move_func_ptr); }
1567
+  void lcd_move_menu_01mm() { move_menu_scale =  0.1; lcd_goto_screen(_manual_move_func_ptr); }
1522 1568
 
1523
-      MENU_ITEM(submenu, MSG_MOVE_E, lcd_move_e);
1524
-      #if E_MANUAL > 1
1525
-        MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E1, lcd_move_e0);
1526
-        MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E2, lcd_move_e1);
1527
-        #if E_MANUAL > 2
1528
-          MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E3, lcd_move_e2);
1529
-          #if E_MANUAL > 3
1530
-            MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E4, lcd_move_e3);
1531
-          #endif
1532
-        #endif
1533
-      #endif
1569
+  void _lcd_move_distance_menu(AxisEnum axis, screenFunc_t func) {
1570
+    _manual_move_func_ptr = func;
1571
+    START_MENU();
1572
+    if (LCD_HEIGHT >= 4) {
1573
+      switch(axis) {
1574
+        case X_AXIS:
1575
+          STATIC_ITEM(MSG_MOVE_X, true, true); break;
1576
+        case Y_AXIS:
1577
+          STATIC_ITEM(MSG_MOVE_Y, true, true); break;
1578
+        case Z_AXIS:
1579
+          STATIC_ITEM(MSG_MOVE_Z, true, true); break;
1580
+        default:
1581
+          STATIC_ITEM(MSG_MOVE_E, true, true); break;
1582
+      }
1534 1583
     }
1584
+    MENU_BACK(MSG_MOVE_AXIS);
1585
+    if (axis == X_AXIS || axis == Y_AXIS)
1586
+      MENU_ITEM(submenu, MSG_MOVE_10MM, lcd_move_menu_10mm);
1587
+    MENU_ITEM(submenu, MSG_MOVE_1MM, lcd_move_menu_1mm);
1588
+    MENU_ITEM(submenu, MSG_MOVE_01MM, lcd_move_menu_01mm);
1535 1589
     END_MENU();
1536 1590
   }
1537
-
1538
-  void lcd_move_menu_10mm() {
1539
-    move_menu_scale = 10.0;
1540
-    _lcd_move_menu_axis();
1541
-  }
1542
-  void lcd_move_menu_1mm() {
1543
-    move_menu_scale = 1.0;
1544
-    _lcd_move_menu_axis();
1545
-  }
1546
-  void lcd_move_menu_01mm() {
1547
-    move_menu_scale = 0.1;
1548
-    _lcd_move_menu_axis();
1549
-  }
1591
+  void lcd_move_get_x_amount()        { _lcd_move_distance_menu(X_AXIS, lcd_move_x); }
1592
+  void lcd_move_get_y_amount()        { _lcd_move_distance_menu(Y_AXIS, lcd_move_y); }
1593
+  void lcd_move_get_z_amount()        { _lcd_move_distance_menu(Z_AXIS, lcd_move_z); }
1594
+  void lcd_move_get_e_amount()        { _lcd_move_distance_menu(E_AXIS, lcd_move_e); }
1595
+  #if E_MANUAL > 1
1596
+    void lcd_move_get_e0_amount()     { _lcd_move_distance_menu(E_AXIS, lcd_move_e0); }
1597
+    void lcd_move_get_e1_amount()     { _lcd_move_distance_menu(E_AXIS, lcd_move_e1); }
1598
+    #if E_MANUAL > 2
1599
+      void lcd_move_get_e2_amount()   { _lcd_move_distance_menu(E_AXIS, lcd_move_e2); }
1600
+      #if E_MANUAL > 3
1601
+        void lcd_move_get_e3_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e3); }
1602
+      #endif
1603
+    #endif
1604
+  #endif
1550 1605
 
1551 1606
   /**
1552 1607
    *
@@ -1554,16 +1609,63 @@ void kill_screen(const char* lcd_msg) {
1554 1609
    *
1555 1610
    */
1556 1611
 
1612
+  #if IS_KINEMATIC
1613
+    #define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
1614
+    #if ENABLED(DELTA)
1615
+      #define _MOVE_XY_ALLOWED (current_position[Z_AXIS] <= delta_clip_start_height)
1616
+      void lcd_lower_z_to_clip_height() {
1617
+        if (!no_reentrance) {
1618
+          current_position[Z_AXIS] = delta_clip_start_height;
1619
+          line_to_current(Z_AXIS);
1620
+          lcd_synchronize();
1621
+        }
1622
+      }
1623
+    #else
1624
+      #define _MOVE_XY_ALLOWED true
1625
+    #endif
1626
+  #else
1627
+    #define _MOVE_XYZ_ALLOWED true
1628
+    #define _MOVE_XY_ALLOWED true
1629
+  #endif
1630
+
1557 1631
   void lcd_move_menu() {
1558 1632
     START_MENU();
1559 1633
     MENU_BACK(MSG_PREPARE);
1560 1634
 
1561
-    if (_MOVE_XYZ_ALLOWED)
1562
-      MENU_ITEM(submenu, MSG_MOVE_10MM, lcd_move_menu_10mm);
1635
+    if (_MOVE_XYZ_ALLOWED) {
1636
+      if (_MOVE_XY_ALLOWED) {
1637
+        MENU_ITEM(submenu, MSG_MOVE_X, lcd_move_get_x_amount);
1638
+        MENU_ITEM(submenu, MSG_MOVE_Y, lcd_move_get_y_amount);
1639
+      }
1640
+      #if ENABLED(DELTA)
1641
+        else
1642
+          MENU_ITEM(function, MSG_FREE_XY, lcd_lower_z_to_clip_height);
1643
+      #endif
1644
+
1645
+      MENU_ITEM(submenu, MSG_MOVE_Z, lcd_move_get_z_amount);
1646
+    }
1647
+    else
1648
+      MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
1649
+
1650
+    #if ENABLED(SWITCHING_EXTRUDER)
1651
+      if (active_extruder)
1652
+        MENU_ITEM(gcode, MSG_SELECT " " MSG_E1, PSTR("T0"));
1653
+      else
1654
+        MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1"));
1655
+    #endif
1656
+
1657
+    MENU_ITEM(submenu, MSG_MOVE_E, lcd_move_get_e_amount);
1658
+    #if E_MANUAL > 1
1659
+      MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E1, lcd_move_get_e0_amount);
1660
+      MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E2, lcd_move_get_e1_amount);
1661
+      #if E_MANUAL > 2
1662
+        MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E3, lcd_move_get_e2_amount);
1663
+        #if E_MANUAL > 3
1664
+          MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E4, lcd_move_get_e3_amount);
1665
+        #endif
1666
+      #endif
1667
+    #endif
1563 1668
 
1564
-    MENU_ITEM(submenu, MSG_MOVE_1MM, lcd_move_menu_1mm);
1565
-    MENU_ITEM(submenu, MSG_MOVE_01MM, lcd_move_menu_01mm);
1566
-    //TODO:X,Y,Z,E
1567 1669
     END_MENU();
1568 1670
   }
1569 1671
 
@@ -2502,6 +2604,39 @@ void kill_screen(const char* lcd_msg) {
2502 2604
     void reprapworld_keypad_move_y_down()  { _reprapworld_keypad_move(Y_AXIS,  1); }
2503 2605
     void reprapworld_keypad_move_home()    { enqueue_and_echo_commands_P(PSTR("G28")); } // move all axes home and wait
2504 2606
     void reprapworld_keypad_move_menu()    { lcd_goto_screen(lcd_move_menu); }
2607
+
2608
+    inline void handle_reprapworld_keypad() {
2609
+
2610
+      static uint8_t keypad_debounce = 0;
2611
+
2612
+      if (!REPRAPWORLD_KEYPAD_PRESSED) {
2613
+        if (keypad_debounce > 0) keypad_debounce--;
2614
+      }
2615
+      else if (!keypad_debounce) {
2616
+        keypad_debounce = 2;
2617
+
2618
+        if (REPRAPWORLD_KEYPAD_MOVE_MENU)       reprapworld_keypad_move_menu();
2619
+
2620
+        #if DISABLED(DELTA) && Z_HOME_DIR == -1
2621
+          if (REPRAPWORLD_KEYPAD_MOVE_Z_UP)     reprapworld_keypad_move_z_up();
2622
+        #endif
2623
+
2624
+        if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) {
2625
+          #if ENABLED(DELTA) || Z_HOME_DIR != -1
2626
+            if (REPRAPWORLD_KEYPAD_MOVE_Z_UP)   reprapworld_keypad_move_z_up();
2627
+          #endif
2628
+          if (REPRAPWORLD_KEYPAD_MOVE_Z_DOWN)   reprapworld_keypad_move_z_down();
2629
+          if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT)   reprapworld_keypad_move_x_left();
2630
+          if (REPRAPWORLD_KEYPAD_MOVE_X_RIGHT)  reprapworld_keypad_move_x_right();
2631
+          if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN)   reprapworld_keypad_move_y_down();
2632
+          if (REPRAPWORLD_KEYPAD_MOVE_Y_UP)     reprapworld_keypad_move_y_up();
2633
+        }
2634
+        else {
2635
+          if (REPRAPWORLD_KEYPAD_MOVE_HOME)     reprapworld_keypad_move_home();
2636
+        }
2637
+      }
2638
+    }
2639
+
2505 2640
   #endif // REPRAPWORLD_KEYPAD
2506 2641
 
2507 2642
   /**
@@ -2773,36 +2908,8 @@ void lcd_update() {
2773 2908
       #endif
2774 2909
 
2775 2910
       #if ENABLED(REPRAPWORLD_KEYPAD)
2776
-
2777
-        static uint8_t keypad_debounce = 0;
2778
-
2779
-        if (!REPRAPWORLD_KEYPAD_PRESSED) {
2780
-          if (keypad_debounce > 0) keypad_debounce--;
2781
-        }
2782
-        else if (!keypad_debounce) {
2783
-          keypad_debounce = 2;
2784
-
2785
-          if (REPRAPWORLD_KEYPAD_MOVE_MENU)       reprapworld_keypad_move_menu();
2786
-
2787
-          #if DISABLED(DELTA) && Z_HOME_DIR == -1
2788
-            if (REPRAPWORLD_KEYPAD_MOVE_Z_UP)     reprapworld_keypad_move_z_up();
2789
-          #endif
2790
-
2791
-          if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) {
2792
-            #if ENABLED(DELTA) || Z_HOME_DIR != -1
2793
-              if (REPRAPWORLD_KEYPAD_MOVE_Z_UP)   reprapworld_keypad_move_z_up();
2794
-            #endif
2795
-            if (REPRAPWORLD_KEYPAD_MOVE_Z_DOWN)   reprapworld_keypad_move_z_down();
2796
-            if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT)   reprapworld_keypad_move_x_left();
2797
-            if (REPRAPWORLD_KEYPAD_MOVE_X_RIGHT)  reprapworld_keypad_move_x_right();
2798
-            if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN)   reprapworld_keypad_move_y_down();
2799
-            if (REPRAPWORLD_KEYPAD_MOVE_Y_UP)     reprapworld_keypad_move_y_up();
2800
-          }
2801
-          else {
2802
-            if (REPRAPWORLD_KEYPAD_MOVE_HOME)     reprapworld_keypad_move_home();
2803
-          }
2804
-        }
2805
-      #endif // REPRAPWORLD_KEYPAD
2911
+        handle_reprapworld_keypad();
2912
+      #endif
2806 2913
 
2807 2914
       bool encoderPastThreshold = (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP);
2808 2915
       if (encoderPastThreshold || lcd_clicked) {

+ 19
- 23
Marlin/ultralcd_impl_DOGM.h View File

@@ -656,34 +656,30 @@ static void lcd_implementation_status_screen() {
656 656
     u8g.setPrintPos((START_COL) * (DOG_CHAR_WIDTH), row_y2);
657 657
   }
658 658
 
659
-  #if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE)
659
+  // Draw a static line of text in the same idiom as a menu item
660
+  static void lcd_implementation_drawmenu_static(const uint8_t row, const char* pstr, const bool center=true, const bool invert=false, const char* valstr=NULL) {
660 661
 
661
-    // Draw a static line of text in the same idiom as a menu item
662
-    static void lcd_implementation_drawmenu_static(const uint8_t row, const char* pstr, const bool center=true, const bool invert=false, const char* valstr=NULL) {
662
+    lcd_implementation_mark_as_selected(row, invert);
663 663
 
664
-      lcd_implementation_mark_as_selected(row, invert);
665
-
666
-      if (!PAGE_CONTAINS(row_y1, row_y2)) return;
664
+    if (!PAGE_CONTAINS(row_y1, row_y2)) return;
667 665
 
668
-      char c;
669
-      int8_t n = LCD_WIDTH - (START_COL);
666
+    char c;
667
+    int8_t n = LCD_WIDTH - (START_COL);
670 668
 
671
-      if (center && !valstr) {
672
-        int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2;
673
-        while (--pad >= 0) { u8g.print(' '); n--; }
674
-      }
675
-      while (n > 0 && (c = pgm_read_byte(pstr))) {
676
-        n -= lcd_print_and_count(c);
677
-        pstr++;
678
-      }
679
-      if (valstr) while (n > 0 && (c = *valstr)) {
680
-        n -= lcd_print_and_count(c);
681
-        valstr++;
682
-      }
683
-      while (n-- > 0) u8g.print(' ');
669
+    if (center && !valstr) {
670
+      int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2;
671
+      while (--pad >= 0) { u8g.print(' '); n--; }
684 672
     }
685
-
686
-  #endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
673
+    while (n > 0 && (c = pgm_read_byte(pstr))) {
674
+      n -= lcd_print_and_count(c);
675
+      pstr++;
676
+    }
677
+    if (valstr) while (n > 0 && (c = *valstr)) {
678
+      n -= lcd_print_and_count(c);
679
+      valstr++;
680
+    }
681
+    while (n-- > 0) u8g.print(' ');
682
+  }
687 683
 
688 684
   // Draw a generic menu item
689 685
   static void lcd_implementation_drawmenu_generic(const bool isSelected, const uint8_t row, const char* pstr, const char pre_char, const char post_char) {

+ 18
- 22
Marlin/ultralcd_impl_HD44780.h View File

@@ -792,29 +792,25 @@ static void lcd_implementation_status_screen() {
792 792
 
793 793
 #if ENABLED(ULTIPANEL)
794 794
 
795
-  #if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE)
796
-
797
-    static void lcd_implementation_drawmenu_static(const uint8_t row, const char* pstr, const bool center=true, const bool invert=false, const char *valstr=NULL) {
798
-      UNUSED(invert);
799
-      char c;
800
-      int8_t n = LCD_WIDTH;
801
-      lcd.setCursor(0, row);
802
-      if (center && !valstr) {
803
-        int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2;
804
-        while (--pad >= 0) { lcd.print(' '); n--; }
805
-      }
806
-      while (n > 0 && (c = pgm_read_byte(pstr))) {
807
-        n -= charset_mapper(c);
808
-        pstr++;
809
-      }
810
-      if (valstr) while (n > 0 && (c = *valstr)) {
811
-        n -= charset_mapper(c);
812
-        valstr++;
813
-      }
814
-      while (n-- > 0) lcd.print(' ');
795
+  static void lcd_implementation_drawmenu_static(const uint8_t row, const char* pstr, const bool center=true, const bool invert=false, const char *valstr=NULL) {
796
+    UNUSED(invert);
797
+    char c;
798
+    int8_t n = LCD_WIDTH;
799
+    lcd.setCursor(0, row);
800
+    if (center && !valstr) {
801
+      int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2;
802
+      while (--pad >= 0) { lcd.print(' '); n--; }
815 803
     }
816
-
817
-  #endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
804
+    while (n > 0 && (c = pgm_read_byte(pstr))) {
805
+      n -= charset_mapper(c);
806
+      pstr++;
807
+    }
808
+    if (valstr) while (n > 0 && (c = *valstr)) {
809
+      n -= charset_mapper(c);
810
+      valstr++;
811
+    }
812
+    while (n-- > 0) lcd.print(' ');
813
+  }
818 814
 
819 815
   static void lcd_implementation_drawmenu_generic(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char post_char) {
820 816
     char c;

Loading…
Cancel
Save