瀏覽代碼

Merge pull request #6773 from thinkyhead/bf_lcd_patch_e5

Patch LCD code for 5th extruder
Scott Lahteine 7 年之前
父節點
當前提交
94a4af1d7f
共有 4 個檔案被更改,包括 55 行新增41 行删除
  1. 16
    13
      Marlin/Marlin_main.cpp
  2. 3
    3
      Marlin/language_en.h
  3. 17
    11
      Marlin/ubl_G29.cpp
  4. 19
    14
      Marlin/ultralcd.cpp

+ 16
- 13
Marlin/Marlin_main.cpp 查看文件

@@ -4788,12 +4788,12 @@ void home_all_axes() { gcode_G28(true); }
4788 4788
           // Retain the last probe position
4789 4789
           xProbe = LOGICAL_X_POSITION(points[i].x);
4790 4790
           yProbe = LOGICAL_Y_POSITION(points[i].y);
4791
-          measured_z = points[i].z = faux ? 0.001 * random(-100, 101) : probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
4792
-        }
4793
-
4794
-        if (isnan(measured_z)) {
4795
-          planner.abl_enabled = abl_should_enable;
4796
-          return;
4791
+          measured_z = faux ? 0.001 * random(-100, 101) : probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
4792
+          if (isnan(measured_z)) {
4793
+            planner.abl_enabled = abl_should_enable;
4794
+            return;
4795
+          }
4796
+          points[i].z = measured_z;
4797 4797
         }
4798 4798
 
4799 4799
         if (!dryrun) {
@@ -5066,9 +5066,11 @@ void home_all_axes() { gcode_G28(true); }
5066 5066
 
5067 5067
     const float measured_z = probe_pt(xpos, ypos, !code_seen('S') || code_value_bool(), 1);
5068 5068
 
5069
-    SERIAL_PROTOCOLPAIR("Bed X: ", FIXFLOAT(xpos));
5070
-    SERIAL_PROTOCOLPAIR(" Y: ", FIXFLOAT(ypos));
5071
-    SERIAL_PROTOCOLLNPAIR(" Z: ", FIXFLOAT(measured_z));
5069
+    if (!isnan(measured_z)) {
5070
+      SERIAL_PROTOCOLPAIR("Bed X: ", FIXFLOAT(xpos));
5071
+      SERIAL_PROTOCOLPAIR(" Y: ", FIXFLOAT(ypos));
5072
+      SERIAL_PROTOCOLLNPAIR(" Z: ", FIXFLOAT(measured_z));
5073
+    }
5072 5074
 
5073 5075
     clean_up_after_endstop_or_probe_move();
5074 5076
 
@@ -5215,13 +5217,13 @@ void home_all_axes() { gcode_G28(true); }
5215 5217
 
5216 5218
         if (!do_all_positions && !do_circle_x3) { // probe the center
5217 5219
           setup_for_endstop_or_probe_move();
5218
-          z_at_pt[0] += probe_pt(0.0, 0.0 , true, 1);
5220
+          z_at_pt[0] += probe_pt(0.0, 0.0 , true, 1);   // TODO: Needs error handling
5219 5221
           clean_up_after_endstop_or_probe_move();
5220 5222
         }
5221 5223
         if (probe_center_plus_3) { // probe extra center points
5222 5224
           for (int8_t axis = probe_center_plus_6 ? 11 : 9; axis > 0; axis -= probe_center_plus_6 ? 2 : 4) {
5223 5225
             setup_for_endstop_or_probe_move();
5224
-            z_at_pt[0] += probe_pt(
5226
+            z_at_pt[0] += probe_pt(                     // TODO: Needs error handling
5225 5227
               cos(RADIANS(180 + 30 * axis)) * (0.1 * delta_calibration_radius),
5226 5228
               sin(RADIANS(180 + 30 * axis)) * (0.1 * delta_calibration_radius), true, 1);
5227 5229
             clean_up_after_endstop_or_probe_move();
@@ -5237,7 +5239,7 @@ void home_all_axes() { gcode_G28(true); }
5237 5239
                                     do_circle_x2 ? (zig_zag ? 0.5 : 0.0) : 0);
5238 5240
             for (float circles = -offset_circles ; circles <= offset_circles; circles++) {
5239 5241
               setup_for_endstop_or_probe_move();
5240
-              z_at_pt[axis] += probe_pt(
5242
+              z_at_pt[axis] += probe_pt(                // TODO: Needs error handling
5241 5243
                 cos(RADIANS(180 + 30 * axis)) * delta_calibration_radius *
5242 5244
                 (1 + circles * 0.1 * (zig_zag ? 1 : -1)),
5243 5245
                 sin(RADIANS(180 + 30 * axis)) * delta_calibration_radius *
@@ -6417,7 +6419,8 @@ inline void gcode_M42() {
6417 6419
     setup_for_endstop_or_probe_move();
6418 6420
 
6419 6421
     // Move to the first point, deploy, and probe
6420
-    probe_pt(X_probe_location, Y_probe_location, stow_probe_after_each, verbose_level);
6422
+    const float t = probe_pt(X_probe_location, Y_probe_location, stow_probe_after_each, verbose_level);
6423
+    if (isnan(t)) return;
6421 6424
 
6422 6425
     randomSeed(millis());
6423 6426
 

+ 3
- 3
Marlin/language_en.h 查看文件

@@ -455,16 +455,16 @@
455 455
   #define MSG_CONTRAST                        _UxGT("LCD contrast")
456 456
 #endif
457 457
 #ifndef MSG_STORE_EEPROM
458
-  #define MSG_STORE_EEPROM                    _UxGT("Store memory")
458
+  #define MSG_STORE_EEPROM                    _UxGT("Store settings")
459 459
 #endif
460 460
 #ifndef MSG_LOAD_EEPROM
461
-  #define MSG_LOAD_EEPROM                     _UxGT("Load memory")
461
+  #define MSG_LOAD_EEPROM                     _UxGT("Load settings")
462 462
 #endif
463 463
 #ifndef MSG_RESTORE_FAILSAFE
464 464
   #define MSG_RESTORE_FAILSAFE                _UxGT("Restore failsafe")
465 465
 #endif
466 466
 #ifndef MSG_INIT_EEPROM
467
-  #define MSG_INIT_EEPROM                     _UxGT("Initalize Memory")
467
+  #define MSG_INIT_EEPROM                     _UxGT("Initialize EEPROM")
468 468
 #endif
469 469
 #ifndef MSG_REFRESH
470 470
   #define MSG_REFRESH                         _UxGT("Refresh")

+ 17
- 11
Marlin/ubl_G29.cpp 查看文件

@@ -393,19 +393,24 @@
393 393
         ubl.save_ubl_active_state_and_disable();
394 394
         ubl.tilt_mesh_based_on_probed_grid(code_seen('T'));
395 395
         ubl.restore_ubl_active_state_and_leave();
396
-      } else { // grid_size==0 which means a 3-Point leveling has been requested
397
-        float z1 = probe_pt(LOGICAL_X_POSITION(UBL_PROBE_PT_1_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_1_Y), false, g29_verbose_level),
398
-              z2 = probe_pt(LOGICAL_X_POSITION(UBL_PROBE_PT_2_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_2_Y), false, g29_verbose_level),
399
-              z3 = probe_pt(LOGICAL_X_POSITION(UBL_PROBE_PT_3_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_3_Y), true, g29_verbose_level);
396
+      }
397
+      else { // grid_size == 0 : A 3-Point leveling has been requested
398
+        float z3, z2, z1 = probe_pt(LOGICAL_X_POSITION(UBL_PROBE_PT_1_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_1_Y), false, g29_verbose_level);
399
+        if (!isnan(z1)) {
400
+          z2 = probe_pt(LOGICAL_X_POSITION(UBL_PROBE_PT_2_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_2_Y), false, g29_verbose_level);
401
+          if (!isnan(z2))
402
+            z3 = probe_pt(LOGICAL_X_POSITION(UBL_PROBE_PT_3_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_3_Y), true, g29_verbose_level);
403
+        }
400 404
 
401
-        if ( isnan(z1) || isnan(z2) || isnan(z3)) {   // probe_pt will return NAN if unreachable
405
+        if (isnan(z1) || isnan(z2) || isnan(z3)) { // probe_pt will return NAN if unreachable
402 406
           SERIAL_ERROR_START;
403 407
           SERIAL_ERRORLNPGM("Attempt to probe off the bed.");
404 408
           goto LEAVE;
405 409
         }
406 410
 
407
-      //  We need to adjust z1, z2, z3 by the Mesh Height at these points. Just because they are non-zero doesn't mean
408
-      //  the Mesh is tilted!  (We need to compensate each probe point by what the Mesh says that location's height is)
411
+        // Adjust z1, z2, z3 by the Mesh Height at these points. Just because they're non-zero
412
+        // doesn't mean the Mesh is tilted! (Compensate each probe point by what the Mesh says
413
+        // its height is.)
409 414
 
410 415
         ubl.save_ubl_active_state_and_disable();
411 416
         z1 -= ubl.get_z_correction(LOGICAL_X_POSITION(UBL_PROBE_PT_1_X), LOGICAL_Y_POSITION(UBL_PROBE_PT_1_Y)) /* + zprobe_zoffset */ ;
@@ -706,7 +711,7 @@
706 711
     const float mean = sum / n;
707 712
 
708 713
     //
709
-    // Now do the sumation of the squares of difference from mean
714
+    // Sum the squares of difference from mean
710 715
     //
711 716
     float sum_of_diff_squared = 0.0;
712 717
     for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
@@ -769,12 +774,13 @@
769 774
         const float rawx = pgm_read_float(&ubl.mesh_index_to_xpos[location.x_index]),
770 775
                     rawy = pgm_read_float(&ubl.mesh_index_to_ypos[location.y_index]);
771 776
 
772
-        const float measured_z = probe_pt(LOGICAL_X_POSITION(rawx), LOGICAL_Y_POSITION(rawy), stow_probe, g29_verbose_level);
777
+        const float measured_z = probe_pt(LOGICAL_X_POSITION(rawx), LOGICAL_Y_POSITION(rawy), stow_probe, g29_verbose_level); // TODO: Needs error handling
773 778
         ubl.z_values[location.x_index][location.y_index] = measured_z;
774 779
       }
775 780
 
776 781
       if (do_ubl_mesh_map) ubl.display_map(map_type);
777
-    } while ((location.x_index >= 0) && (--max_iterations));
782
+
783
+    } while (location.x_index >= 0 && --max_iterations);
778 784
 
779 785
     STOW_PROBE();
780 786
     ubl.restore_ubl_active_state_and_leave();
@@ -1547,7 +1553,7 @@
1547 1553
       const float x = float(x_min) + ix * dx;
1548 1554
       for (int8_t iy = 0; iy < grid_size; iy++) {
1549 1555
         const float y = float(y_min) + dy * (zig_zag ? grid_size - 1 - iy : iy);
1550
-        float measured_z = probe_pt(LOGICAL_X_POSITION(x), LOGICAL_Y_POSITION(y), code_seen('E'), g29_verbose_level);
1556
+        float measured_z = probe_pt(LOGICAL_X_POSITION(x), LOGICAL_Y_POSITION(y), code_seen('E'), g29_verbose_level); // TODO: Needs error handling
1551 1557
         #if ENABLED(DEBUG_LEVELING_FEATURE)
1552 1558
           if (DEBUGGING(LEVELING)) {
1553 1559
             SERIAL_CHAR('(');

+ 19
- 14
Marlin/ultralcd.cpp 查看文件

@@ -1289,7 +1289,7 @@ void kill_screen(const char* lcd_msg) {
1289 1289
     void lcd_preheat_m2_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
1290 1290
   #endif
1291 1291
 
1292
-  #if TEMP_SENSOR_0 != 0 && (TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0)
1292
+  #if TEMP_SENSOR_0 != 0 && (TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_4 != 0 || TEMP_SENSOR_BED != 0)
1293 1293
 
1294 1294
     void lcd_preheat_m1_menu() {
1295 1295
       START_MENU();
@@ -1395,7 +1395,7 @@ void kill_screen(const char* lcd_msg) {
1395 1395
       END_MENU();
1396 1396
     }
1397 1397
 
1398
-  #endif // TEMP_SENSOR_0 && (TEMP_SENSOR_1 || TEMP_SENSOR_2 || TEMP_SENSOR_3 || TEMP_SENSOR_BED)
1398
+  #endif // TEMP_SENSOR_0 && (TEMP_SENSOR_1 || TEMP_SENSOR_2 || TEMP_SENSOR_3 || TEMP_SENSOR_4 || TEMP_SENSOR_BED)
1399 1399
 
1400 1400
   void lcd_cooldown() {
1401 1401
     #if FAN_COUNT > 0
@@ -2075,18 +2075,14 @@ void kill_screen(const char* lcd_msg) {
2075 2075
     MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84"));
2076 2076
 
2077 2077
     //
2078
-    // Preheat PLA
2079
-    // Preheat ABS
2078
+    // Change filament
2080 2079
     //
2081
-    #if TEMP_SENSOR_0 != 0
2080
+    #if ENABLED(FILAMENT_CHANGE_FEATURE)
2081
+      if (!thermalManager.tooColdToExtrude(active_extruder))
2082
+        MENU_ITEM(function, MSG_FILAMENTCHANGE, lcd_enqueue_filament_change);
2083
+    #endif
2082 2084
 
2083
-      //
2084
-      // Change filament
2085
-      //
2086
-      #if ENABLED(FILAMENT_CHANGE_FEATURE)
2087
-        if (!thermalManager.tooColdToExtrude(active_extruder))
2088
-          MENU_ITEM(function, MSG_FILAMENTCHANGE, lcd_enqueue_filament_change);
2089
-      #endif
2085
+    #if TEMP_SENSOR_0 != 0
2090 2086
 
2091 2087
       //
2092 2088
       // Cooldown
@@ -2101,7 +2097,7 @@ void kill_screen(const char* lcd_msg) {
2101 2097
       //
2102 2098
       // Preheat for Material 1 and 2
2103 2099
       //
2104
-      #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0
2100
+      #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_4 != 0 || TEMP_SENSOR_BED != 0
2105 2101
         MENU_ITEM(submenu, MSG_PREHEAT_1, lcd_preheat_m1_menu);
2106 2102
         MENU_ITEM(submenu, MSG_PREHEAT_2, lcd_preheat_m2_menu);
2107 2103
       #else
@@ -2497,7 +2493,7 @@ void kill_screen(const char* lcd_msg) {
2497 2493
       MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings);
2498 2494
       MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings);
2499 2495
       MENU_ITEM(function, MSG_RESTORE_FAILSAFE, lcd_factory_settings);
2500
-      MENU_ITEM(gcode, MSG_INIT_EEPROM, PSTR("M502\nM500\nM501"));
2496
+      MENU_ITEM(gcode, MSG_INIT_EEPROM, PSTR("M502\nM500")); // TODO: Add "Are You Sure?" step
2501 2497
     #endif
2502 2498
     END_MENU();
2503 2499
   }
@@ -3145,6 +3141,15 @@ void kill_screen(const char* lcd_msg) {
3145 3141
         STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_3_MAXTEMP), false);
3146 3142
       #endif
3147 3143
 
3144
+      #if TEMP_SENSOR_4 != 0
3145
+        #undef THERMISTOR_ID
3146
+        #define THERMISTOR_ID TEMP_SENSOR_4
3147
+        #include "thermistornames.h"
3148
+        STATIC_ITEM("T4: " THERMISTOR_NAME, false, true);
3149
+        STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_4_MINTEMP), false);
3150
+        STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_4_MAXTEMP), false);
3151
+      #endif
3152
+
3148 3153
       #if TEMP_SENSOR_BED != 0
3149 3154
         #undef THERMISTOR_ID
3150 3155
         #define THERMISTOR_ID TEMP_SENSOR_BED

Loading…
取消
儲存