Ver código fonte

decoupled axes sucessfully at least on pure x or y jog

Erik van der Zalm 12 anos atrás
pai
commit
aa65fe22ed
2 arquivos alterados com 115 adições e 25 exclusões
  1. 7
    3
      Marlin/Configuration.h
  2. 108
    22
      Marlin/stepper.cpp

+ 7
- 3
Marlin/Configuration.h Ver arquivo

@@ -35,6 +35,10 @@
35 35
 #define MOTHERBOARD 7
36 36
 #endif
37 37
 
38
+/// Comment out the following line to enable normal kinematics
39
+
40
+#define COREXY
41
+
38 42
 //===========================================================================
39 43
 //=============================Thermal Settings  ============================
40 44
 //===========================================================================
@@ -168,7 +172,7 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
168 172
 #define DISABLE_E false // For all extruders
169 173
 
170 174
 #define INVERT_X_DIR true    // for Mendel set to false, for Orca set to true
171
-#define INVERT_Y_DIR false    // for Mendel set to true, for Orca set to false
175
+#define INVERT_Y_DIR true    // for Mendel set to true, for Orca set to false
172 176
 #define INVERT_Z_DIR true     // for Mendel set to false, for Orca set to true
173 177
 #define INVERT_E0_DIR false   // for direct drive extruder v9 set to true, for geared extruder set to false
174 178
 #define INVERT_E1_DIR false    // for direct drive extruder v9 set to true, for geared extruder set to false
@@ -180,8 +184,8 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
180 184
 #define Y_HOME_DIR -1
181 185
 #define Z_HOME_DIR -1
182 186
 
183
-#define min_software_endstops true //If true, axis won't move to coordinates less than HOME_POS.
184
-#define max_software_endstops true  //If true, axis won't move to coordinates greater than the defined lengths below.
187
+#define min_software_endstops false //If true, axis won't move to coordinates less than HOME_POS.
188
+#define max_software_endstops false  //If true, axis won't move to coordinates greater than the defined lengths below.
185 189
 #define X_MAX_LENGTH 205
186 190
 #define Y_MAX_LENGTH 205
187 191
 #define Z_MAX_LENGTH 200

+ 108
- 22
Marlin/stepper.cpp Ver arquivo

@@ -214,6 +214,12 @@ void st_wake_up() {
214 214
   ENABLE_STEPPER_DRIVER_INTERRUPT();  
215 215
 }
216 216
 
217
+void step_wait(){
218
+    for(int8_t i=0; i < 6; i++){
219
+    }
220
+}
221
+  
222
+
217 223
 FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
218 224
   unsigned short timer;
219 225
   if(step_rate > MAX_STEP_FREQUENCY) step_rate = MAX_STEP_FREQUENCY;
@@ -317,8 +323,10 @@ ISR(TIMER1_COMPA_vect)
317 323
     out_bits = current_block->direction_bits;
318 324
 
319 325
     // Set direction en check limit switches
320
-    if ((out_bits & (1<<X_AXIS)) != 0) {   // -direction
321
-      WRITE(X_DIR_PIN, INVERT_X_DIR);
326
+    if ((out_bits & (1<<X_AXIS)) != 0) {   // stepping along -X axis
327
+      #if !defined COREXY  //NOT COREXY
328
+        WRITE(X_DIR_PIN, INVERT_X_DIR);
329
+      #endif
322 330
       count_direction[X_AXIS]=-1;
323 331
       CHECK_ENDSTOPS
324 332
       {
@@ -333,8 +341,11 @@ ISR(TIMER1_COMPA_vect)
333 341
         #endif
334 342
       }
335 343
     }
336
-    else { // +direction 
337
-      WRITE(X_DIR_PIN,!INVERT_X_DIR);
344
+    else { // +direction
345
+      #if !defined COREXY  //NOT COREXY
346
+        WRITE(X_DIR_PIN,!INVERT_X_DIR);
347
+      #endif
348
+      
338 349
       count_direction[X_AXIS]=1;
339 350
       CHECK_ENDSTOPS 
340 351
       {
@@ -351,7 +362,9 @@ ISR(TIMER1_COMPA_vect)
351 362
     }
352 363
 
353 364
     if ((out_bits & (1<<Y_AXIS)) != 0) {   // -direction
354
-      WRITE(Y_DIR_PIN,INVERT_Y_DIR);
365
+      #if !defined COREXY  //NOT COREXY
366
+        WRITE(Y_DIR_PIN,INVERT_Y_DIR);
367
+      #endif
355 368
       count_direction[Y_AXIS]=-1;
356 369
       CHECK_ENDSTOPS
357 370
       {
@@ -367,7 +380,9 @@ ISR(TIMER1_COMPA_vect)
367 380
       }
368 381
     }
369 382
     else { // +direction
370
-    WRITE(Y_DIR_PIN,!INVERT_Y_DIR);
383
+      #if !defined COREXY  //NOT COREXY
384
+        WRITE(Y_DIR_PIN,!INVERT_Y_DIR);
385
+      #endif
371 386
       count_direction[Y_AXIS]=1;
372 387
       CHECK_ENDSTOPS
373 388
       {
@@ -382,7 +397,28 @@ ISR(TIMER1_COMPA_vect)
382 397
         #endif
383 398
       }
384 399
     }
385
-
400
+    
401
+    
402
+    #ifdef COREXY  //coreXY kinematics defined
403
+      if((current_block->steps_x >= current_block->steps_y)&&((out_bits & (1<<X_AXIS)) == 0)){  //+X is major axis
404
+        WRITE(X_DIR_PIN, !INVERT_X_DIR);
405
+        WRITE(Y_DIR_PIN, !INVERT_Y_DIR);
406
+      }
407
+      if((current_block->steps_x >= current_block->steps_y)&&((out_bits & (1<<X_AXIS)) != 0)){  //-X is major axis
408
+        WRITE(X_DIR_PIN, INVERT_X_DIR);
409
+        WRITE(Y_DIR_PIN, INVERT_Y_DIR);
410
+      }      
411
+      if((current_block->steps_y > current_block->steps_x)&&((out_bits & (1<<Y_AXIS)) == 0)){  //+Y is major axis
412
+        WRITE(X_DIR_PIN, !INVERT_X_DIR);
413
+        WRITE(Y_DIR_PIN, INVERT_Y_DIR);
414
+      }        
415
+      if((current_block->steps_y > current_block->steps_x)&&((out_bits & (1<<Y_AXIS)) != 0)){  //-Y is major axis
416
+        WRITE(X_DIR_PIN, INVERT_X_DIR);
417
+        WRITE(Y_DIR_PIN, !INVERT_Y_DIR);
418
+      }  
419
+    #endif //coreXY
420
+    
421
+    
386 422
     if ((out_bits & (1<<Z_AXIS)) != 0) {   // -direction
387 423
       WRITE(Z_DIR_PIN,INVERT_Z_DIR);
388 424
       count_direction[Z_AXIS]=-1;
@@ -446,23 +482,73 @@ ISR(TIMER1_COMPA_vect)
446 482
         }
447 483
       }    
448 484
       #endif //ADVANCE
449
-      
450
-      counter_x += current_block->steps_x;
451
-      if (counter_x > 0) {
452
-        WRITE(X_STEP_PIN, HIGH);
453
-        counter_x -= current_block->step_event_count;
454
-        WRITE(X_STEP_PIN, LOW);
455
-        count_position[X_AXIS]+=count_direction[X_AXIS];   
456
-      }
457 485
 
458
-      counter_y += current_block->steps_y;
459
-      if (counter_y > 0) {
460
-        WRITE(Y_STEP_PIN, HIGH);
461
-        counter_y -= current_block->step_event_count;
462
-        WRITE(Y_STEP_PIN, LOW);
463
-        count_position[Y_AXIS]+=count_direction[Y_AXIS];
464
-      }
486
+      #if !defined COREXY      
487
+        counter_x += current_block->steps_x;
488
+        if (counter_x > 0) {
489
+          WRITE(X_STEP_PIN, HIGH);
490
+          counter_x -= current_block->step_event_count;
491
+          WRITE(X_STEP_PIN, LOW);
492
+          count_position[X_AXIS]+=count_direction[X_AXIS];   
493
+        }
494
+  
495
+        counter_y += current_block->steps_y;
496
+        if (counter_y > 0) {
497
+          WRITE(Y_STEP_PIN, HIGH);
465 498
 
499
+          WRITE(Y_STEP_PIN, LOW);
500
+
501
+        }
502
+      #endif
503
+  
504
+      #ifdef COREXY
505
+        counter_x += current_block->steps_x;        
506
+        counter_y += current_block->steps_y;
507
+        
508
+        if ((counter_x > 0)&&!(counter_y>0)){  //X step only
509
+          WRITE(X_STEP_PIN, HIGH);
510
+          WRITE(Y_STEP_PIN, HIGH);
511
+          counter_x -= current_block->step_event_count;          
512
+          WRITE(X_STEP_PIN, LOW);
513
+          WRITE(Y_STEP_PIN, LOW);
514
+          count_position[X_AXIS]+=count_direction[X_AXIS];
515
+        }
516
+        
517
+        if (!(counter_x > 0)&&(counter_y>0)){  //Y step only
518
+          WRITE(X_STEP_PIN, HIGH);
519
+          WRITE(Y_STEP_PIN, HIGH);
520
+          counter_y -= current_block->step_event_count;          
521
+          WRITE(X_STEP_PIN, LOW);
522
+          WRITE(Y_STEP_PIN, LOW);
523
+          count_position[Y_AXIS]+=count_direction[Y_AXIS];
524
+        }        
525
+        
526
+        if ((counter_x > 0)&&(counter_y>0)){  //step in both axes
527
+          if (((out_bits & (1<<X_AXIS)) == 0)^((out_bits & (1<<Y_AXIS)) == 0)){  //X and Y in different directions
528
+            WRITE(Y_STEP_PIN, HIGH);
529
+            counter_x -= current_block->step_event_count;             
530
+            WRITE(Y_STEP_PIN, LOW);
531
+            step_wait();
532
+            count_position[X_AXIS]+=count_direction[X_AXIS];
533
+            count_position[Y_AXIS]+=count_direction[Y_AXIS];
534
+            WRITE(Y_STEP_PIN, HIGH);
535
+            counter_y -= current_block->step_event_count;
536
+            WRITE(Y_STEP_PIN, LOW);
537
+          }
538
+          else{  //X and Y in same direction
539
+            WRITE(X_STEP_PIN, HIGH);
540
+            counter_x -= current_block->step_event_count;             
541
+            WRITE(X_STEP_PIN, LOW) ;
542
+            step_wait();
543
+            count_position[X_AXIS]+=count_direction[X_AXIS];
544
+            count_position[Y_AXIS]+=count_direction[Y_AXIS];
545
+            WRITE(X_STEP_PIN, HIGH); 
546
+            counter_y -= current_block->step_event_count;    
547
+            WRITE(X_STEP_PIN, LOW);        
548
+          }
549
+        }
550
+      #endif //corexy
551
+      
466 552
       counter_z += current_block->steps_z;
467 553
       if (counter_z > 0) {
468 554
         WRITE(Z_STEP_PIN, HIGH);

Carregando…
Cancelar
Salvar