Browse Source

added delta tower babystepping. Its untested, but hopefully florian horsch will be able to try.

also, removed some trouble for compilation with corexy.
I think that babystepping is only possible in z for a delta tower.
not sure if it would be usefull to step individual motors on a delta, i don't own one
bkubicek 11 years ago
parent
commit
b832f5b9f6
3 changed files with 54 additions and 8 deletions
  1. 13
    4
      Marlin/Configuration_adv.h
  2. 40
    3
      Marlin/stepper.cpp
  3. 1
    1
      Marlin/ultralcd.cpp

+ 13
- 4
Marlin/Configuration_adv.h View File

273
 // Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process
273
 // Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process
274
 // it can e.g. be used to change z-positions in the print startup phase in realtime
274
 // it can e.g. be used to change z-positions in the print startup phase in realtime
275
 // does not respect endstops!
275
 // does not respect endstops!
276
-
277
 //#define BABYSTEPPING
276
 //#define BABYSTEPPING
278
-//#define BABYSTEP_XY  //not only z, but also XY
279
-
280
-#ifdef COREXY
277
+#ifdef BABYSTEPPING
278
+  #define BABYSTEP_XY  //not only z, but also XY in the menu. more clutter, more functions
279
+  #define BABYSTEP_INVERT_Z false  //true for inverse movements in Z
280
+  #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements
281
+  
282
+  #ifdef COREXY
281
     #error BABYSTEPPING not implemented for COREXY yet.
283
     #error BABYSTEPPING not implemented for COREXY yet.
284
+  #endif
285
+
286
+  #ifdef DELTA
287
+    #ifdef BABYSTEP_XY
288
+      #error BABYSTEPPING only implemented for Z axis on deltabots.
289
+    #endif
290
+  #endif
282
 #endif
291
 #endif
283
 
292
 
284
 // extruder advance constant (s2/mm3)
293
 // extruder advance constant (s2/mm3)

+ 40
- 3
Marlin/stepper.cpp View File

1069
     #endif
1069
     #endif
1070
 
1070
 
1071
   }
1071
   }
1072
-  break; 
1072
+  break;
1073
+ 
1074
+#ifndef DELTA
1073
   case Z_AXIS:
1075
   case Z_AXIS:
1074
   {
1076
   {
1075
     enable_z();
1077
     enable_z();
1076
     uint8_t old_z_dir_pin= READ(Z_DIR_PIN);  //if dualzstepper, both point to same direction.
1078
     uint8_t old_z_dir_pin= READ(Z_DIR_PIN);  //if dualzstepper, both point to same direction.
1077
     //setup new step
1079
     //setup new step
1078
-    WRITE(Z_DIR_PIN,(INVERT_Z_DIR)^direction);
1080
+    WRITE(Z_DIR_PIN,(INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z);
1079
     #ifdef Z_DUAL_STEPPER_DRIVERS
1081
     #ifdef Z_DUAL_STEPPER_DRIVERS
1080
-      WRITE(Z2_DIR_PIN,(INVERT_Z_DIR)^direction);
1082
+      WRITE(Z2_DIR_PIN,(INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z);
1081
     #endif
1083
     #endif
1082
     //perform step 
1084
     //perform step 
1083
     WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN); 
1085
     WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN); 
1101
 
1103
 
1102
   }
1104
   }
1103
   break;
1105
   break;
1106
+#else //DELTA
1107
+  case Z_AXIS:
1108
+  {
1109
+    enable_x();
1110
+    enable_y();
1111
+    enable_z();
1112
+    uint8_t old_x_dir_pin= READ(X_DIR_PIN);  
1113
+    uint8_t old_y_dir_pin= READ(Y_DIR_PIN);  
1114
+    uint8_t old_z_dir_pin= READ(Z_DIR_PIN);  
1115
+    //setup new step
1116
+    WRITE(X_DIR_PIN,(INVERT_X_DIR)^direction^BABYSTEP_INVERT_Z);
1117
+    WRITE(Y_DIR_PIN,(INVERT_Y_DIR)^direction^BABYSTEP_INVERT_Z);
1118
+    WRITE(Z_DIR_PIN,(INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z);
1119
+    
1120
+    //perform step 
1121
+    WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN); 
1122
+    WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN); 
1123
+    WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN); 
1124
+    
1125
+    //wait a tiny bit
1126
+    {
1127
+    float x=1./float(axis+1); //absolutely useless
1128
+    }
1129
+    WRITE(X_STEP_PIN, INVERT_X_STEP_PIN); 
1130
+    WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN); 
1131
+    WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN);
1132
+
1133
+    //get old pin state back.
1134
+    WRITE(X_DIR_PIN,old_x_dir_pin);
1135
+    WRITE(Y_DIR_PIN,old_y_dir_pin);
1136
+    WRITE(Z_DIR_PIN,old_z_dir_pin);
1137
+
1138
+  }
1139
+  break;
1140
+#endif
1104
  
1141
  
1105
   default:    break;
1142
   default:    break;
1106
   }
1143
   }

+ 1
- 1
Marlin/ultralcd.cpp View File

367
 {
367
 {
368
     if (encoderPosition != 0)
368
     if (encoderPosition != 0)
369
     {
369
     {
370
-        babystepsTodo[Z_AXIS]+=(int)encoderPosition;
370
+        babystepsTodo[Z_AXIS]+=BABYSTEP_Z_MULTIPLICATOR*(int)encoderPosition;
371
         encoderPosition=0;
371
         encoderPosition=0;
372
         lcdDrawUpdate = 1;
372
         lcdDrawUpdate = 1;
373
     }
373
     }

Loading…
Cancel
Save