Firmware2/Marlin
Ian Jackson 957e966d2d M206: always use homing ("homeing") offsets
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>
2012-08-11 01:35:03 +01:00
..
Gen7 Fix cast warning in Gen7 2012-02-23 18:50:05 +01:00
hardware/tools/avr/etc ATMega1284P support for Arduino IDE 2012-02-17 11:41:47 +01:00
Sanguino Fixed compiler warning for Sanguino compile 2012-02-26 17:35:01 +01:00
cardreader.cpp made prepare->autostart independent of current folder. 2012-03-19 20:24:40 +01:00
cardreader.h __ header file replace 2012-06-02 20:44:17 +02:00
Configuration_adv.h Support step motor controllers with active low step pins. 2012-06-29 16:27:47 +02:00
Configuration.h Fixed soft limits when the origin is in the middle. 2012-07-14 22:24:26 +02:00
COPYING first commit 2011-08-12 22:28:35 +02:00
create_speed_lookuptable.py Added 20MHz support. 2012-03-11 12:25:04 +01:00
createTemperatureLookup.py first commit 2011-08-12 22:28:35 +02:00
EEPROMwrite.h __ header file replace 2012-06-02 20:44:17 +02:00
fastio.h Merge remote-tracking branch 'upstream/Marlin_v1' into Marlin_v1 2012-02-13 13:07:55 +01:00
language.h added firmware retract. disabled by default 2012-06-02 20:32:28 +02:00
Makefile Makefile: Better display of size (device memory usage) 2012-08-10 19:36:30 +01:00
Marlin.h M206: always use homing ("homeing") offsets 2012-08-11 01:35:03 +01:00
Marlin.pde M206: always use homing ("homeing") offsets 2012-08-11 01:35:03 +01:00
MarlinSerial.cpp Teensylu support. 2012-02-09 19:27:45 +01:00
MarlinSerial.h Teensylu support. 2012-02-09 19:27:45 +01:00
motion_control.cpp software_endstops: use *_MIN_POS and *_MAX_POS for arcs 2012-08-10 19:36:30 +01:00
motion_control.h Removed interrupt nesting in the stepper ISR. 2011-11-27 21:12:55 +01:00
pins.h Fixed soft limits when the origin is in the middle. 2012-07-14 22:24:26 +02:00
planner.cpp Fixed AD595 define 2012-06-11 17:33:42 +02:00
planner.h Residual in the comments: there are no more mm/minutes but only mm/sec in the planner buffer. 2012-05-09 08:05:13 +03:00
Sd2Card.cpp made sd code only compile with SDSUPPORT defined. safes 10k of codespace 2011-12-26 09:28:51 +01:00
Sd2Card.h made sd code only compile with SDSUPPORT defined. safes 10k of codespace 2011-12-26 09:28:51 +01:00
Sd2PinMap.h made sd code only compile with SDSUPPORT defined. safes 10k of codespace 2011-12-26 09:28:51 +01:00
SdBaseFile.cpp Updated SERIAL define to MYSERIAL, because Arduino 1.0 defines SERIAL as 0. 2012-02-11 16:02:47 +01:00
SdBaseFile.h made sd code only compile with SDSUPPORT defined. safes 10k of codespace 2011-12-26 09:28:51 +01:00
SdFatConfig.h made sd code only compile with SDSUPPORT defined. safes 10k of codespace 2011-12-26 09:28:51 +01:00
SdFatStructs.h made sd code only compile with SDSUPPORT defined. safes 10k of codespace 2011-12-26 09:28:51 +01:00
SdFatUtil.cpp Updated SERIAL define to MYSERIAL, because Arduino 1.0 defines SERIAL as 0. 2012-02-11 16:02:47 +01:00
SdFatUtil.h made sd code only compile with SDSUPPORT defined. safes 10k of codespace 2011-12-26 09:28:51 +01:00
SdFile.cpp made sd code only compile with SDSUPPORT defined. safes 10k of codespace 2011-12-26 09:28:51 +01:00
SdFile.h made sd code only compile with SDSUPPORT defined. safes 10k of codespace 2011-12-26 09:28:51 +01:00
SdInfo.h made sd code only compile with SDSUPPORT defined. safes 10k of codespace 2011-12-26 09:28:51 +01:00
SdVolume.cpp made sd code only compile with SDSUPPORT defined. safes 10k of codespace 2011-12-26 09:28:51 +01:00
SdVolume.h made sd code only compile with SDSUPPORT defined. safes 10k of codespace 2011-12-26 09:28:51 +01:00
speed_lookuptable.h Added 20MHz support. 2012-03-11 12:25:04 +01:00
stepper.cpp Fixed typo 2012-07-14 17:25:35 +03:00
stepper.h merging 2011-12-12 20:35:46 +01:00
temperature.cpp Limit PID autotune PWM to PID_MAX 2012-05-16 19:32:23 +02:00
temperature.h Added support for 2nd extruder temperature to UltraLCD 2012-04-27 14:51:32 +02:00
thermistortables.h Merge pull request #170 from linagee/Marlin_v1 2012-06-02 03:46:56 -07:00
ultralcd.h __ header file replace 2012-06-02 20:44:17 +02:00
ultralcd.pde Fixed AD595 define 2012-06-11 17:33:42 +02:00
watchdog.h __ header file replace 2012-06-02 20:44:17 +02:00
watchdog.pde simplified the includes, makefile now works with arduino23 2011-12-22 14:55:45 +01:00
wiring.h add wiring.h, that can be used to overwrite: 2011-12-22 14:57:28 +01:00