Переглянути джерело

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 роки тому
джерело
коміт
b832f5b9f6
3 змінених файлів з 54 додано та 8 видалено
  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 Переглянути файл

@@ -273,12 +273,21 @@
273 273
 // Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process
274 274
 // it can e.g. be used to change z-positions in the print startup phase in realtime
275 275
 // does not respect endstops!
276
-
277 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 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 291
 #endif
283 292
 
284 293
 // extruder advance constant (s2/mm3)

+ 40
- 3
Marlin/stepper.cpp Переглянути файл

@@ -1069,15 +1069,17 @@ void babystep(const uint8_t axis,const bool direction)
1069 1069
     #endif
1070 1070
 
1071 1071
   }
1072
-  break; 
1072
+  break;
1073
+ 
1074
+#ifndef DELTA
1073 1075
   case Z_AXIS:
1074 1076
   {
1075 1077
     enable_z();
1076 1078
     uint8_t old_z_dir_pin= READ(Z_DIR_PIN);  //if dualzstepper, both point to same direction.
1077 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 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 1083
     #endif
1082 1084
     //perform step 
1083 1085
     WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN); 
@@ -1101,6 +1103,41 @@ void babystep(const uint8_t axis,const bool direction)
1101 1103
 
1102 1104
   }
1103 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 1142
   default:    break;
1106 1143
   }

+ 1
- 1
Marlin/ultralcd.cpp Переглянути файл

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

Завантаження…
Відмінити
Зберегти