Browse Source

Fix M420 C for UBL

Scott Lahteine 7 years ago
parent
commit
8db7fb226a

+ 1
- 1
Marlin/src/feature/bedlevel/ubl/ubl.h View File

124
     static void reset();
124
     static void reset();
125
     static void invalidate();
125
     static void invalidate();
126
     static void set_all_mesh_points_to_value(const float value);
126
     static void set_all_mesh_points_to_value(const float value);
127
-    static void adjust_mesh_to_mean(const float value);
127
+    static void adjust_mesh_to_mean(const bool cflag, const float value);
128
     static bool sanity_check();
128
     static bool sanity_check();
129
 
129
 
130
     static void G29() _O0;                          // O0 for no optimization
130
     static void G29() _O0;                          // O0 for no optimization

+ 4
- 4
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp View File

544
           #endif
544
           #endif
545
           break;
545
           break;
546
 
546
 
547
-        case 5: adjust_mesh_to_mean(g29_constant); break;
547
+        case 5: adjust_mesh_to_mean(g29_c_flag, g29_constant); break;
548
 
548
 
549
         case 6: shift_mesh_height(); break;
549
         case 6: shift_mesh_height(); break;
550
       }
550
       }
634
     return;
634
     return;
635
   }
635
   }
636
 
636
 
637
-  void unified_bed_leveling::adjust_mesh_to_mean(const float value) {
637
+  void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const float value) {
638
     float sum = 0.0;
638
     float sum = 0.0;
639
     int n = 0;
639
     int n = 0;
640
     for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
640
     for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
665
     SERIAL_ECHO_F(sigma, 6);
665
     SERIAL_ECHO_F(sigma, 6);
666
     SERIAL_EOL();
666
     SERIAL_EOL();
667
 
667
 
668
-    if (g29_c_flag)
668
+    if (cflag)
669
       for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
669
       for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
670
         for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
670
         for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
671
           if (!isnan(z_values[x][y]))
671
           if (!isnan(z_values[x][y]))
1081
       SERIAL_EOL();
1081
       SERIAL_EOL();
1082
     #endif
1082
     #endif
1083
 
1083
 
1084
-    adjust_mesh_to_mean(g29_constant);
1084
+    adjust_mesh_to_mean(g29_c_flag, g29_constant);
1085
 
1085
 
1086
     #if HAS_BED_PROBE
1086
     #if HAS_BED_PROBE
1087
       SERIAL_PROTOCOLPGM("zprobe_zoffset: ");
1087
       SERIAL_PROTOCOLPGM("zprobe_zoffset: ");

+ 1
- 1
Marlin/src/gcode/bedlevel/M420.cpp View File

116
       #if ENABLED(AUTO_BED_LEVELING_UBL)
116
       #if ENABLED(AUTO_BED_LEVELING_UBL)
117
 
117
 
118
         set_bed_leveling_enabled(false);
118
         set_bed_leveling_enabled(false);
119
-        ubl.adjust_mesh_to_mean(cval);
119
+        ubl.adjust_mesh_to_mean(true, cval);
120
 
120
 
121
       #else
121
       #else
122
 
122
 

Loading…
Cancel
Save