|
@@ -399,89 +399,84 @@ ISR(TIMER1_COMPA_vect)
|
399
|
399
|
count_direction[Y_AXIS]=1;
|
400
|
400
|
}
|
401
|
401
|
|
402
|
|
- // Set direction en check limit switches
|
403
|
|
- #ifndef COREXY
|
404
|
|
- if ((out_bits & (1<<X_AXIS)) != 0) // stepping along -X axis
|
405
|
|
- #else
|
406
|
|
- if ((out_bits & (1<<X_HEAD)) != 0) //AlexBorro: Head direction in -X axis for CoreXY bots.
|
407
|
|
- #endif
|
|
402
|
+ if(check_endstops) // check X and Y Endstops
|
408
|
403
|
{
|
409
|
|
- CHECK_ENDSTOPS
|
410
|
|
- {
|
411
|
|
- #ifdef DUAL_X_CARRIAGE
|
412
|
|
- // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
|
413
|
|
- if ((current_block->active_extruder == 0 && X_HOME_DIR == -1)
|
414
|
|
- || (current_block->active_extruder != 0 && X2_HOME_DIR == -1))
|
415
|
|
- #endif
|
416
|
|
- {
|
417
|
|
- #if defined(X_MIN_PIN) && X_MIN_PIN > -1
|
418
|
|
- bool x_min_endstop=(READ(X_MIN_PIN) != X_MIN_ENDSTOP_INVERTING);
|
419
|
|
- if(x_min_endstop && old_x_min_endstop && (current_block->steps_x > 0)) {
|
420
|
|
- endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
|
421
|
|
- endstop_x_hit=true;
|
422
|
|
- step_events_completed = current_block->step_event_count;
|
|
404
|
+ #ifndef COREXY
|
|
405
|
+ if ((out_bits & (1<<X_AXIS)) != 0) // stepping along -X axis (regular cartesians bot)
|
|
406
|
+ #else
|
|
407
|
+ if (!((current_block->steps_x == current_block->steps_y) && ((out_bits & (1<<X_AXIS))>>X_AXIS != (out_bits & (1<<Y_AXIS))>>Y_AXIS))) // AlexBorro: If DeltaX == -DeltaY, the movement is only in Y axis
|
|
408
|
+ if ((out_bits & (1<<X_HEAD)) != 0) //AlexBorro: Head direction in -X axis for CoreXY bots.
|
|
409
|
+ #endif
|
|
410
|
+ { // -direction
|
|
411
|
+ #ifdef DUAL_X_CARRIAGE
|
|
412
|
+ // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
|
|
413
|
+ if ((current_block->active_extruder == 0 && X_HOME_DIR == -1) || (current_block->active_extruder != 0 && X2_HOME_DIR == -1))
|
|
414
|
+ #endif
|
|
415
|
+ {
|
|
416
|
+ #if defined(X_MIN_PIN) && X_MIN_PIN > -1
|
|
417
|
+ bool x_min_endstop=(READ(X_MIN_PIN) != X_MIN_ENDSTOP_INVERTING);
|
|
418
|
+ if(x_min_endstop && old_x_min_endstop && (current_block->steps_x > 0))
|
|
419
|
+ {
|
|
420
|
+ endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
|
|
421
|
+ endstop_x_hit=true;
|
|
422
|
+ step_events_completed = current_block->step_event_count;
|
|
423
|
+ }
|
|
424
|
+ old_x_min_endstop = x_min_endstop;
|
|
425
|
+ #endif
|
423
|
426
|
}
|
424
|
|
- old_x_min_endstop = x_min_endstop;
|
425
|
|
- #endif
|
426
|
427
|
}
|
427
|
|
- }
|
428
|
|
- }
|
429
|
|
- else
|
430
|
|
- { // +direction
|
431
|
|
- CHECK_ENDSTOPS
|
432
|
|
- {
|
433
|
|
- #ifdef DUAL_X_CARRIAGE
|
434
|
|
- // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
|
435
|
|
- if ((current_block->active_extruder == 0 && X_HOME_DIR == 1)
|
436
|
|
- || (current_block->active_extruder != 0 && X2_HOME_DIR == 1))
|
437
|
|
- #endif
|
438
|
|
- {
|
439
|
|
- #if defined(X_MAX_PIN) && X_MAX_PIN > -1
|
440
|
|
- bool x_max_endstop=(READ(X_MAX_PIN) != X_MAX_ENDSTOP_INVERTING);
|
441
|
|
- if(x_max_endstop && old_x_max_endstop && (current_block->steps_x > 0)){
|
442
|
|
- endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
|
443
|
|
- endstop_x_hit=true;
|
444
|
|
- step_events_completed = current_block->step_event_count;
|
|
428
|
+ else
|
|
429
|
+ { // +direction
|
|
430
|
+ #ifdef DUAL_X_CARRIAGE
|
|
431
|
+ // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
|
|
432
|
+ if ((current_block->active_extruder == 0 && X_HOME_DIR == 1) || (current_block->active_extruder != 0 && X2_HOME_DIR == 1))
|
|
433
|
+ #endif
|
|
434
|
+ {
|
|
435
|
+ #if defined(X_MAX_PIN) && X_MAX_PIN > -1
|
|
436
|
+ bool x_max_endstop=(READ(X_MAX_PIN) != X_MAX_ENDSTOP_INVERTING);
|
|
437
|
+ if(x_max_endstop && old_x_max_endstop && (current_block->steps_x > 0))
|
|
438
|
+ {
|
|
439
|
+ endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
|
|
440
|
+ endstop_x_hit=true;
|
|
441
|
+ step_events_completed = current_block->step_event_count;
|
|
442
|
+ }
|
|
443
|
+ old_x_max_endstop = x_max_endstop;
|
|
444
|
+ #endif
|
445
|
445
|
}
|
446
|
|
- old_x_max_endstop = x_max_endstop;
|
447
|
|
- #endif
|
448
|
446
|
}
|
449
|
|
- }
|
450
|
|
- }
|
451
|
447
|
|
452
|
|
- #ifndef COREXY
|
453
|
|
- if ((out_bits & (1<<Y_AXIS)) != 0) // -direction
|
454
|
|
- #else
|
455
|
|
- if ((out_bits & (1<<Y_HEAD)) != 0) //AlexBorro: Head direction in -Y axis for CoreXY bots.
|
456
|
|
- #endif
|
457
|
|
- {
|
458
|
|
- CHECK_ENDSTOPS
|
459
|
|
- {
|
460
|
|
- #if defined(Y_MIN_PIN) && Y_MIN_PIN > -1
|
461
|
|
- bool y_min_endstop=(READ(Y_MIN_PIN) != Y_MIN_ENDSTOP_INVERTING);
|
462
|
|
- if(y_min_endstop && old_y_min_endstop && (current_block->steps_y > 0)) {
|
463
|
|
- endstops_trigsteps[Y_AXIS] = count_position[Y_AXIS];
|
464
|
|
- endstop_y_hit=true;
|
465
|
|
- step_events_completed = current_block->step_event_count;
|
466
|
|
- }
|
467
|
|
- old_y_min_endstop = y_min_endstop;
|
468
|
|
- #endif
|
469
|
|
- }
|
470
|
|
- }
|
471
|
|
- else
|
472
|
|
- { // +direction
|
473
|
|
- CHECK_ENDSTOPS
|
474
|
|
- {
|
475
|
|
- #if defined(Y_MAX_PIN) && Y_MAX_PIN > -1
|
476
|
|
- bool y_max_endstop=(READ(Y_MAX_PIN) != Y_MAX_ENDSTOP_INVERTING);
|
477
|
|
- if(y_max_endstop && old_y_max_endstop && (current_block->steps_y > 0)){
|
478
|
|
- endstops_trigsteps[Y_AXIS] = count_position[Y_AXIS];
|
479
|
|
- endstop_y_hit=true;
|
480
|
|
- step_events_completed = current_block->step_event_count;
|
481
|
|
- }
|
482
|
|
- old_y_max_endstop = y_max_endstop;
|
|
448
|
+ #ifndef COREXY
|
|
449
|
+ if ((out_bits & (1<<Y_AXIS)) != 0) // -direction
|
|
450
|
+ #else
|
|
451
|
+ if (!((current_block->steps_x == current_block->steps_y) && ((out_bits & (1<<X_AXIS))>>X_AXIS == (out_bits & (1<<Y_AXIS))>>Y_AXIS))) // AlexBorro: If DeltaX == DeltaY, the movement is only in X axis
|
|
452
|
+ if ((out_bits & (1<<Y_HEAD)) != 0) //AlexBorro: Head direction in -Y axis for CoreXY bots.
|
483
|
453
|
#endif
|
484
|
|
- }
|
|
454
|
+ { // -direction
|
|
455
|
+ #if defined(Y_MIN_PIN) && Y_MIN_PIN > -1
|
|
456
|
+ bool y_min_endstop=(READ(Y_MIN_PIN) != Y_MIN_ENDSTOP_INVERTING);
|
|
457
|
+ if(y_min_endstop && old_y_min_endstop && (current_block->steps_y > 0))
|
|
458
|
+ {
|
|
459
|
+ endstops_trigsteps[Y_AXIS] = count_position[Y_AXIS];
|
|
460
|
+ endstop_y_hit=true;
|
|
461
|
+ step_events_completed = current_block->step_event_count;
|
|
462
|
+ }
|
|
463
|
+ old_y_min_endstop = y_min_endstop;
|
|
464
|
+ #endif
|
|
465
|
+ }
|
|
466
|
+ else
|
|
467
|
+ { // +direction
|
|
468
|
+ #if defined(Y_MAX_PIN) && Y_MAX_PIN > -1
|
|
469
|
+ bool y_max_endstop=(READ(Y_MAX_PIN) != Y_MAX_ENDSTOP_INVERTING);
|
|
470
|
+ if(y_max_endstop && old_y_max_endstop && (current_block->steps_y > 0))
|
|
471
|
+ {
|
|
472
|
+ endstops_trigsteps[Y_AXIS] = count_position[Y_AXIS];
|
|
473
|
+ endstop_y_hit=true;
|
|
474
|
+ step_events_completed = current_block->step_event_count;
|
|
475
|
+ }
|
|
476
|
+ old_y_max_endstop = y_max_endstop;
|
|
477
|
+ #endif
|
|
478
|
+
|
|
479
|
+ }
|
485
|
480
|
}
|
486
|
481
|
|
487
|
482
|
if ((out_bits & (1<<Z_AXIS)) != 0) { // -direction
|