Marlin.ino

changeset 1
b584642d4f58
parent 0
2c8ba1964db7
child 3
770b218a4931
equal deleted inserted replaced
0:2c8ba1964db7 1:b584642d4f58
623 { \ 623 { \
624 current_position[LETTER##_AXIS] = 0; \ 624 current_position[LETTER##_AXIS] = 0; \
625 plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); \ 625 plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); \
626 destination[LETTER##_AXIS] = 1.1 * max_length[LETTER##_AXIS] * LETTER##_HOME_DIR; \ 626 destination[LETTER##_AXIS] = 1.1 * max_length[LETTER##_AXIS] * LETTER##_HOME_DIR; \
627 feedrate = fast_home_feedrate[LETTER##_AXIS]; \ 627 feedrate = fast_home_feedrate[LETTER##_AXIS]; \
628 plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \ 628 plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, false); \
629 st_synchronize();\ 629 st_synchronize();\
630 \ 630 \
631 current_position[LETTER##_AXIS] = 0;\ 631 current_position[LETTER##_AXIS] = 0;\
632 plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);\ 632 plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);\
633 destination[LETTER##_AXIS] = -LETTER##_HOME_RETRACT_MM * LETTER##_HOME_DIR;\ 633 destination[LETTER##_AXIS] = -LETTER##_HOME_RETRACT_MM * LETTER##_HOME_DIR;\
634 plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \ 634 plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, false); \
635 st_synchronize();\ 635 st_synchronize();\
636 \ 636 \
637 destination[LETTER##_AXIS] = 2*LETTER##_HOME_RETRACT_MM * LETTER##_HOME_DIR;\ 637 destination[LETTER##_AXIS] = 2*LETTER##_HOME_RETRACT_MM * LETTER##_HOME_DIR;\
638 feedrate = homing_feedrate[LETTER##_AXIS] ; \ 638 feedrate = homing_feedrate[LETTER##_AXIS] ; \
639 plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \ 639 plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, false); \
640 st_synchronize();\ 640 st_synchronize();\
641 \ 641 \
642 current_position[LETTER##_AXIS] = LETTER##_HOME_POS;\ 642 current_position[LETTER##_AXIS] = LETTER##_HOME_POS;\
643 destination[LETTER##_AXIS] = current_position[LETTER##_AXIS];\ 643 destination[LETTER##_AXIS] = current_position[LETTER##_AXIS];\
644 feedrate = 0.0;\ 644 feedrate = 0.0;\
712 if(code_seen('G')) 712 if(code_seen('G'))
713 { 713 {
714 switch((int)code_value()) 714 switch((int)code_value())
715 { 715 {
716 case 0: // G0 -> G1 716 case 0: // G0 -> G1
717 if(Stopped == false) {
718 get_coordinates(); // For X Y Z E F
719 prepare_move(false);
720 //ClearToSend();
721 return;
722 }
717 case 1: // G1 723 case 1: // G1
718 if(Stopped == false) { 724 if(Stopped == false) {
719 get_coordinates(); // For X Y Z E F 725 get_coordinates(); // For X Y Z E F
720 prepare_move(); 726 prepare_move(true);
721 //ClearToSend(); 727 //ClearToSend();
722 return; 728 return;
723 } 729 }
724 //break; 730 //break;
725 case 2: // G2 - CW ARC 731 case 2: // G2 - CW ARC
1560 1566
1561 if(z_off_d > 0) 1567 if(z_off_d > 0)
1562 { 1568 {
1563 destination[Z_AXIS] += z_off_d; 1569 destination[Z_AXIS] += z_off_d;
1564 feedrate = fast_home_feedrate[Z_AXIS]; 1570 feedrate = fast_home_feedrate[Z_AXIS];
1565 prepare_move(); 1571 prepare_move(false);
1566 destination[X_AXIS] = temp_position[X_AXIS] + x_off_d; 1572 destination[X_AXIS] = temp_position[X_AXIS] + x_off_d;
1567 destination[Y_AXIS] = temp_position[Y_AXIS] + y_off_d; 1573 destination[Y_AXIS] = temp_position[Y_AXIS] + y_off_d;
1568 feedrate = fast_home_feedrate[X_AXIS]; 1574 feedrate = fast_home_feedrate[X_AXIS];
1569 prepare_move(); 1575 prepare_move(false);
1570 } else 1576 } else
1571 { 1577 {
1572 destination[X_AXIS] += x_off_d; 1578 destination[X_AXIS] += x_off_d;
1573 destination[Y_AXIS] += y_off_d; 1579 destination[Y_AXIS] += y_off_d;
1574 feedrate = fast_home_feedrate[X_AXIS]; 1580 feedrate = fast_home_feedrate[X_AXIS];
1575 prepare_move(); 1581 prepare_move(false);
1576 destination[Z_AXIS] = temp_position[Z_AXIS] + z_off_d; 1582 destination[Z_AXIS] = temp_position[Z_AXIS] + z_off_d;
1577 feedrate = fast_home_feedrate[Z_AXIS]; 1583 feedrate = fast_home_feedrate[Z_AXIS];
1578 prepare_move(); 1584 prepare_move(false);
1579 } 1585 }
1580 1586
1581 for(int8_t i=0; i < NUM_AXIS; i++) 1587 for(int8_t i=0; i < NUM_AXIS; i++)
1582 current_position[i] = temp_position[i]; 1588 current_position[i] = temp_position[i];
1583 feedrate = next_feedrate; 1589 feedrate = next_feedrate;
1654 else { 1660 else {
1655 offset[1] = 0.0; 1661 offset[1] = 0.0;
1656 } 1662 }
1657 } 1663 }
1658 1664
1659 void prepare_move() 1665 void prepare_move(bool laser_on)
1660 { 1666 {
1661 1667
1662 // transform destination ********************************************* 1668 // transform destination *********************************************
1663 1669
1664 FPUTransform_transformDestination(); 1670 FPUTransform_transformDestination();
1673 if (modified_destination[X_AXIS] > max_length[X_AXIS]) modified_destination[X_AXIS] = max_length[X_AXIS]; 1679 if (modified_destination[X_AXIS] > max_length[X_AXIS]) modified_destination[X_AXIS] = max_length[X_AXIS];
1674 if (modified_destination[Y_AXIS] > max_length[Y_AXIS]) modified_destination[Y_AXIS] = max_length[Y_AXIS]; 1680 if (modified_destination[Y_AXIS] > max_length[Y_AXIS]) modified_destination[Y_AXIS] = max_length[Y_AXIS];
1675 if (modified_destination[Z_AXIS] > max_length[Z_AXIS]) modified_destination[Z_AXIS] = max_length[Z_AXIS]; 1681 if (modified_destination[Z_AXIS] > max_length[Z_AXIS]) modified_destination[Z_AXIS] = max_length[Z_AXIS];
1676 } 1682 }
1677 previous_millis_cmd = millis(); 1683 previous_millis_cmd = millis();
1678 plan_buffer_line(modified_destination[X_AXIS], modified_destination[Y_AXIS], modified_destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder); 1684 plan_buffer_line(modified_destination[X_AXIS], modified_destination[Y_AXIS], modified_destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder, laser_on);
1679 for(int8_t i=0; i < NUM_AXIS; i++) { 1685 for(int8_t i=0; i < NUM_AXIS; i++) {
1680 current_position[i] = destination[i]; 1686 current_position[i] = destination[i];
1681 } 1687 }
1682 } 1688 }
1683 1689

mercurial