Browse Source

Compare indices instead of floats for probe actions

Scott Lahteine 9 years ago
parent
commit
61f8394361
3 changed files with 27 additions and 30 deletions
  1. 2
    1
      Marlin/Marlin.h
  2. 23
    26
      Marlin/Marlin_main.cpp
  3. 2
    3
      Marlin/ultralcd.cpp

+ 2
- 1
Marlin/Marlin.h View File

@@ -227,7 +227,8 @@ void enquecommands_P(const char *cmd); //put one or many ASCII commands at the e
227 227
 void prepare_arc_move(char isclockwise);
228 228
 void clamp_to_software_endstops(float target[3]);
229 229
 
230
-void refresh_cmd_timeout();
230
+extern unsigned long previous_millis_cmd;
231
+inline void refresh_cmd_timeout() { previous_millis_cmd = millis(); }
231 232
 
232 233
 #ifdef FAST_PWM_FAN
233 234
   void setPwmFrequency(uint8_t pin, int val);

+ 23
- 26
Marlin/Marlin_main.cpp View File

@@ -238,7 +238,7 @@ static char *strchr_pointer; ///< A pointer to find chars in the command string
238 238
 const char* queued_commands_P= NULL; /* pointer to the current line in the active sequence of commands, or NULL when none */
239 239
 const int sensitive_pins[] = SENSITIVE_PINS; ///< Sensitive pin list for M42
240 240
 // Inactivity shutdown
241
-static unsigned long previous_millis_cmd = 0;
241
+unsigned long previous_millis_cmd = 0;
242 242
 static unsigned long max_inactive_time = 0;
243 243
 static unsigned long stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME*1000l;
244 244
 unsigned long starttime = 0; ///< Print job start time
@@ -986,8 +986,6 @@ static void axis_is_at_home(int axis) {
986 986
   #endif
987 987
 }
988 988
 
989
-inline void refresh_cmd_timeout() { previous_millis_cmd = millis(); }
990
-
991 989
 /**
992 990
  * Some planner shorthand inline functions
993 991
  */
@@ -1327,20 +1325,20 @@ inline void set_destination_to_current() { memcpy(destination, current_position,
1327 1325
   }
1328 1326
 
1329 1327
   enum ProbeAction {
1330
-    ProbeStay             = 0,
1331
-    ProbeEngage           = BIT(0),
1332
-    ProbeRetract          = BIT(1),
1333
-    ProbeEngageAndRetract = (ProbeEngage | ProbeRetract)
1328
+    ProbeStay          = 0,
1329
+    ProbeDeploy        = BIT(0),
1330
+    ProbeStow          = BIT(1),
1331
+    ProbeDeployAndStow = (ProbeDeploy | ProbeStow)
1334 1332
   };
1335 1333
 
1336 1334
   // Probe bed height at position (x,y), returns the measured z value
1337
-  static float probe_pt(float x, float y, float z_before, ProbeAction retract_action=ProbeEngageAndRetract, int verbose_level=1) {
1335
+  static float probe_pt(float x, float y, float z_before, ProbeAction retract_action=ProbeDeployAndStow, int verbose_level=1) {
1338 1336
     // move to right place
1339 1337
     do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_before);
1340 1338
     do_blocking_move_to(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
1341 1339
 
1342 1340
     #if !defined(Z_PROBE_SLED) && !defined(Z_PROBE_ALLEN_KEY)
1343
-      if (retract_action & ProbeEngage) deploy_z_probe();
1341
+      if (retract_action & ProbeDeploy) deploy_z_probe();
1344 1342
     #endif
1345 1343
 
1346 1344
     run_z_probe();
@@ -1354,7 +1352,7 @@ inline void set_destination_to_current() { memcpy(destination, current_position,
1354 1352
     #endif
1355 1353
 
1356 1354
     #if !defined(Z_PROBE_SLED) && !defined(Z_PROBE_ALLEN_KEY)
1357
-      if (retract_action & ProbeRetract) stow_z_probe();
1355
+      if (retract_action & ProbeStow) stow_z_probe();
1358 1356
     #endif
1359 1357
 
1360 1358
     if (verbose_level > 2) {
@@ -2167,7 +2165,7 @@ inline void gcode_G28() {
2167 2165
     }
2168 2166
 
2169 2167
     bool dryrun = code_seen('D') || code_seen('d'),
2170
-         engage_probe_for_each_reading = code_seen('E') || code_seen('e');
2168
+         deploy_probe_for_each_reading = code_seen('E') || code_seen('e');
2171 2169
 
2172 2170
     #ifdef AUTO_BED_LEVELING_GRID
2173 2171
 
@@ -2319,14 +2317,13 @@ inline void gcode_G28() {
2319 2317
             if (distance_from_center > DELTA_PROBABLE_RADIUS) continue;
2320 2318
           #endif //DELTA
2321 2319
 
2322
-          // Enhanced G29 - Do not retract servo between probes
2323 2320
           ProbeAction act;
2324
-          if (engage_probe_for_each_reading)
2325
-            act = ProbeEngageAndRetract;
2326
-          else if (yProbe == front_probe_bed_position && xCount == 0)
2327
-            act = ProbeEngage;
2328
-          else if (yProbe == front_probe_bed_position + (yGridSpacing * (auto_bed_leveling_grid_points - 1)) && xCount == auto_bed_leveling_grid_points - 1)
2329
-            act = ProbeRetract;
2321
+          if (deploy_probe_for_each_reading) // G29 E - Stow between probes
2322
+            act = ProbeDeployAndStow;
2323
+          else if (yCount == 0 && xCount == 0)
2324
+            act = ProbeDeploy;
2325
+          else if (yCount == auto_bed_leveling_grid_points - 1 && xCount == auto_bed_leveling_grid_points - 1)
2326
+            act = ProbeStow;
2330 2327
           else
2331 2328
             act = ProbeStay;
2332 2329
 
@@ -2417,10 +2414,10 @@ inline void gcode_G28() {
2417 2414
 
2418 2415
       // Actions for each probe
2419 2416
       ProbeAction p1, p2, p3;
2420
-      if (engage_probe_for_each_reading)
2421
-        p1 = p2 = p3 = ProbeEngageAndRetract;
2417
+      if (deploy_probe_for_each_reading)
2418
+        p1 = p2 = p3 = ProbeDeployAndStow;
2422 2419
       else
2423
-        p1 = ProbeEngage, p2 = ProbeStay, p3 = ProbeRetract;
2420
+        p1 = ProbeDeploy, p2 = ProbeStay, p3 = ProbeStow;
2424 2421
 
2425 2422
       // Probe at 3 arbitrary points
2426 2423
       float z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, p1, verbose_level),
@@ -2839,7 +2836,7 @@ inline void gcode_M42() {
2839 2836
            Z_start_location = Z_current + Z_RAISE_BEFORE_PROBING,
2840 2837
            ext_position = st_get_position_mm(E_AXIS);
2841 2838
 
2842
-    bool engage_probe_for_each_reading = code_seen('E') || code_seen('e');
2839
+    bool deploy_probe_for_each_reading = code_seen('E') || code_seen('e');
2843 2840
 
2844 2841
     if (code_seen('X') || code_seen('x')) {
2845 2842
       X_probe_location = code_value() - X_PROBE_OFFSET_FROM_EXTRUDER;
@@ -2917,7 +2914,7 @@ inline void gcode_M42() {
2917 2914
     st_synchronize();
2918 2915
     current_position[Z_AXIS] = Z_current = st_get_position_mm(Z_AXIS);
2919 2916
 
2920
-    if (engage_probe_for_each_reading) stow_z_probe();
2917
+    if (deploy_probe_for_each_reading) stow_z_probe();
2921 2918
 
2922 2919
     for (uint16_t n=0; n < n_samples; n++) {
2923 2920
 
@@ -2959,7 +2956,7 @@ inline void gcode_M42() {
2959 2956
 
2960 2957
       } // n_legs
2961 2958
 
2962
-      if (engage_probe_for_each_reading)  {
2959
+      if (deploy_probe_for_each_reading)  {
2963 2960
         deploy_z_probe(); 
2964 2961
         delay(1000);
2965 2962
       }
@@ -3006,13 +3003,13 @@ inline void gcode_M42() {
3006 3003
       plan_buffer_line(X_probe_location, Y_probe_location, Z_start_location, current_position[E_AXIS], homing_feedrate[Z_AXIS]/60, active_extruder);
3007 3004
       st_synchronize();
3008 3005
 
3009
-      if (engage_probe_for_each_reading) {
3006
+      if (deploy_probe_for_each_reading) {
3010 3007
         stow_z_probe();
3011 3008
         delay(1000);
3012 3009
       }
3013 3010
     }
3014 3011
 
3015
-    if (!engage_probe_for_each_reading) {
3012
+    if (!deploy_probe_for_each_reading) {
3016 3013
       stow_z_probe();
3017 3014
       delay(1000);
3018 3015
     }

+ 2
- 3
Marlin/ultralcd.cpp View File

@@ -1789,7 +1789,7 @@ char *ftostr52(const float &x) {
1789 1789
   return conv;
1790 1790
 }
1791 1791
 
1792
-#if defined(MANUAL_BED_LEVELING)
1792
+#ifdef MANUAL_BED_LEVELING
1793 1793
 static int _lcd_level_bed_position;
1794 1794
 static void _lcd_level_bed()
1795 1795
 {
@@ -1849,8 +1849,7 @@ static void _lcd_level_bed_homing()
1849 1849
     lcd_goto_menu(_lcd_level_bed);
1850 1850
   }
1851 1851
 }
1852
-static void lcd_level_bed()
1853
-{
1852
+static void lcd_level_bed() {
1854 1853
   axis_known_position[X_AXIS] = false;
1855 1854
   axis_known_position[Y_AXIS] = false;
1856 1855
   axis_known_position[Z_AXIS] = false;

Loading…
Cancel
Save