Previously the parameters set in M206 would only be used if a G82 command was sent with specific axis home values. This limits its usefulness. Really, we should have a way to adjust the XYZ homing of a machine in the eeprom. So as the first stage of this, make M206 affect every home command. The values set using M206 are now added to the configuration variables [XYZ]_HOME_POS. This is achieved by replacing all uses of [XYZ]_HOME_POS in the code by a new home_pos[] which includes the adjustment. We also have to adjust the uses of [XYZ]_{MIN,MAX}_POS similarly - see below. To allow axis_is_at_home to be written as a function taking an axis index rather than a macro taking an axis letter, we provide constant arrays in program memory containing the values of [XYZ]_{MIN,MAX,HOME}_POS from the compiled-in configuration. This is done with some helper macros to deal with the declaration (XYZ_CONSTS_FROM_CONFIG) and definition of the inline function which does the program memory access. We also introduce the overloaded function read_pgm_any, whose instances are produced with DEFINE_PGM_READ_ANY, which allows the access functions to automatically produce the correct type. The type- and pointer-massaging code in the access function boils down, when compiled, to a simple program memory access. A question arises: if the M206 offset is set, should this adjustment to the home position shift or change the possible range of movement permitted by the software endstops ? The documentation in Configuration.h describes these limits as: // Travel limits after homing Since this is a file containing physical limits, and actual suggested values for these configuration parameters appear to include a certain amount of slop, I've taken the view that these should be regarded as nominal physical distances from the limit switches, and that the permissible travel should be unaffected by M206. So for example with the (rather unrealistic) #define X_HOME_DIR -1 #define X_MIN_POS -20 #define X_HOME_POS 0 #define X_MAX_POS 100 no matter the setting of M206 X, the machine would be permitted to move from 20mm "beyond" the limit switch trigger point in the negative X direction and 100mm away from the limit switch in the positive X direction, for a total travel of 120mm. With M206 X-10 that would be considered to correspond to X coordinates -30 to +90. With M206 X+10 that would be considered to correspond to X coordinates -10 to +110. fixes #200 (in ErikZalm/Marlin). Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
|
|
||
184 |
|
184 |
|
185 |
|
185 |
|
186 |
|
186 |
|
|
187 |
|
|
|
188 |
|
|
187 |
|
189 |
|
188 |
|
190 |
|
189 |
|
191 |
|
|
|
||
143 |
|
143 |
|
144 |
|
144 |
|
145 |
|
145 |
|
|
146 |
|
|
|
147 |
|
|
146 |
|
148 |
|
147 |
|
149 |
|
148 |
|
150 |
|
|
|
||
543 |
|
545 |
|
544 |
|
546 |
|
545 |
|
547 |
|
|
548 |
|
|
|
549 |
|
|
|
550 |
|
|
|
551 |
|
|
|
552 |
|
|
|
553 |
|
|
|
554 |
|
|
|
555 |
|
|
|
556 |
|
|
|
557 |
|
|
|
558 |
|
|
|
559 |
|
|
|
560 |
|
|
|
561 |
|
|
|
562 |
|
|
|
563 |
|
|
|
564 |
|
|
|
565 |
|
|
|
566 |
|
|
|
567 |
|
|
|
568 |
|
|
|
569 |
|
|
546 |
|
570 |
|
547 |
|
571 |
|
548 |
|
572 |
|
|
|
||
564 |
|
588 |
|
565 |
|
589 |
|
566 |
|
590 |
|
567 |
|
|
|
568 |
|
|
|
|
591 |
|
|
|
592 |
|
|
569 |
|
593 |
|
570 |
|
594 |
|
571 |
|
595 |
|
|
|
||
678 |
|
702 |
|
679 |
|
703 |
|
680 |
|
704 |
|
681 |
|
|
|
682 |
|
|
|
|
705 |
|
|
|
706 |
|
|
683 |
|
707 |
|
684 |
|
708 |
|
685 |
|
709 |
|
|
|
||
1544 |
|
1568 |
|
1545 |
|
1569 |
|
1546 |
|
1570 |
|
1547 |
|
|
|
1548 |
|
|
|
1549 |
|
|
|
|
1571 |
|
|
|
1572 |
|
|
|
1573 |
|
|
1550 |
|
1574 |
|
1551 |
|
1575 |
|
1552 |
|
1576 |
|
1553 |
|
|
|
1554 |
|
|
|
1555 |
|
|
|
|
1577 |
|
|
|
1578 |
|
|
|
1579 |
|
|
1556 |
|
1580 |
|
1557 |
|
1581 |
|
1558 |
|
1582 |
|
|
|
||
152 |
|
152 |
|
153 |
|
153 |
|
154 |
|
154 |
|
|
155 |
|
|
155 |
|
156 |
|
156 |
|
157 |
|
157 |
|
158 |
|