M206: save values in eeprom

Really, we should have a way to adjust the XYZ homing of a machine in
the eeprom.  So as the second stage of this, make the M206 home offset
parameters subject to the M500/M501/M502/M503 eeprom commands.

Bump the eeprom version to "V06".

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
This commit is contained in:
Ian Jackson 2012-08-01 21:18:08 +01:00
parent 1dba212e18
commit adee81170d

View file

@ -38,7 +38,7 @@ template <class T> int EEPROM_readAnything(int &ee, T& value)
// the default values are used whenever there is a change to the data, to prevent // the default values are used whenever there is a change to the data, to prevent
// wrong data being written to the variables. // wrong data being written to the variables.
// ALSO: always make sure the variables in the Store and retrieve sections are in the same order. // ALSO: always make sure the variables in the Store and retrieve sections are in the same order.
#define EEPROM_VERSION "V05" #define EEPROM_VERSION "V06"
inline void EEPROM_StoreSettings() inline void EEPROM_StoreSettings()
{ {
@ -57,6 +57,7 @@ inline void EEPROM_StoreSettings()
EEPROM_writeAnything(i,max_xy_jerk); EEPROM_writeAnything(i,max_xy_jerk);
EEPROM_writeAnything(i,max_z_jerk); EEPROM_writeAnything(i,max_z_jerk);
EEPROM_writeAnything(i,max_e_jerk); EEPROM_writeAnything(i,max_e_jerk);
EEPROM_writeAnything(i,add_homeing);
#ifdef PIDTEMP #ifdef PIDTEMP
EEPROM_writeAnything(i,Kp); EEPROM_writeAnything(i,Kp);
EEPROM_writeAnything(i,Ki); EEPROM_writeAnything(i,Ki);
@ -119,6 +120,13 @@ inline void EEPROM_printSettings()
SERIAL_ECHOPAIR(" Z" ,max_z_jerk); SERIAL_ECHOPAIR(" Z" ,max_z_jerk);
SERIAL_ECHOPAIR(" E" ,max_e_jerk); SERIAL_ECHOPAIR(" E" ,max_e_jerk);
SERIAL_ECHOLN(""); SERIAL_ECHOLN("");
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Home offset (mm):");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M206 X",add_homeing[0] );
SERIAL_ECHOPAIR(" Y" ,add_homeing[1] );
SERIAL_ECHOPAIR(" Z" ,add_homeing[2] );
SERIAL_ECHOLN("");
#ifdef PIDTEMP #ifdef PIDTEMP
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("PID settings:"); SERIAL_ECHOLNPGM("PID settings:");
@ -153,6 +161,7 @@ inline void EEPROM_RetrieveSettings(bool def=false)
EEPROM_readAnything(i,max_xy_jerk); EEPROM_readAnything(i,max_xy_jerk);
EEPROM_readAnything(i,max_z_jerk); EEPROM_readAnything(i,max_z_jerk);
EEPROM_readAnything(i,max_e_jerk); EEPROM_readAnything(i,max_e_jerk);
EEPROM_readAnything(i,add_homeing);
#ifndef PIDTEMP #ifndef PIDTEMP
float Kp,Ki,Kd; float Kp,Ki,Kd;
#endif #endif
@ -183,6 +192,7 @@ inline void EEPROM_RetrieveSettings(bool def=false)
max_xy_jerk=DEFAULT_XYJERK; max_xy_jerk=DEFAULT_XYJERK;
max_z_jerk=DEFAULT_ZJERK; max_z_jerk=DEFAULT_ZJERK;
max_e_jerk=DEFAULT_EJERK; max_e_jerk=DEFAULT_EJERK;
add_homeing[0] = add_homeing[1] = add_homeing[2] = 0;
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLN("Using Default settings:"); SERIAL_ECHOLN("Using Default settings:");
} }