add command M666 for adjusting delta printer endstop position
This commit is contained in:
parent
aa6c58ad37
commit
9aa2229077
3 changed files with 43 additions and 2 deletions
|
@ -37,7 +37,7 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size)
|
|||
// the default values are used whenever there is a change to the data, to prevent
|
||||
// wrong data being written to the variables.
|
||||
// ALSO: always make sure the variables in the Store and retrieve sections are in the same order.
|
||||
#define EEPROM_VERSION "V08"
|
||||
#define EEPROM_VERSION "V09"
|
||||
|
||||
#ifdef EEPROM_SETTINGS
|
||||
void Config_StoreSettings()
|
||||
|
@ -57,6 +57,9 @@ void Config_StoreSettings()
|
|||
EEPROM_WRITE_VAR(i,max_z_jerk);
|
||||
EEPROM_WRITE_VAR(i,max_e_jerk);
|
||||
EEPROM_WRITE_VAR(i,add_homeing);
|
||||
#ifdef DELTA
|
||||
EEPROM_WRITE_VAR(i,endstop_adj);
|
||||
#endif
|
||||
#ifndef ULTIPANEL
|
||||
int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED;
|
||||
int absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
|
||||
|
@ -145,6 +148,15 @@ void Config_PrintSettings()
|
|||
SERIAL_ECHOPAIR(" Y" ,add_homeing[1] );
|
||||
SERIAL_ECHOPAIR(" Z" ,add_homeing[2] );
|
||||
SERIAL_ECHOLN("");
|
||||
#ifdef DELTA
|
||||
SERIAL_ECHO_START;
|
||||
SERIAL_ECHOLNPGM("Endstop adjustement (mm):");
|
||||
SERIAL_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" M666 X",endstop_adj[0] );
|
||||
SERIAL_ECHOPAIR(" Y" ,endstop_adj[1] );
|
||||
SERIAL_ECHOPAIR(" Z" ,endstop_adj[2] );
|
||||
SERIAL_ECHOLN("");
|
||||
#endif
|
||||
#ifdef PIDTEMP
|
||||
SERIAL_ECHO_START;
|
||||
SERIAL_ECHOLNPGM("PID settings:");
|
||||
|
@ -185,6 +197,9 @@ void Config_RetrieveSettings()
|
|||
EEPROM_READ_VAR(i,max_z_jerk);
|
||||
EEPROM_READ_VAR(i,max_e_jerk);
|
||||
EEPROM_READ_VAR(i,add_homeing);
|
||||
#ifdef DELTA
|
||||
EEPROM_READ_VAR(i,endstop_adj);
|
||||
#endif
|
||||
#ifndef ULTIPANEL
|
||||
int plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed;
|
||||
int absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed;
|
||||
|
@ -244,6 +259,9 @@ void Config_ResetDefault()
|
|||
max_z_jerk=DEFAULT_ZJERK;
|
||||
max_e_jerk=DEFAULT_EJERK;
|
||||
add_homeing[0] = add_homeing[1] = add_homeing[2] = 0;
|
||||
#ifdef DELTA
|
||||
endstop_adj[0] = endstop_adj[1] = endstop_adj[2] = 0;
|
||||
#endif
|
||||
#ifdef ULTIPANEL
|
||||
plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP;
|
||||
plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP;
|
||||
|
|
|
@ -191,6 +191,9 @@ extern int feedmultiply;
|
|||
extern int extrudemultiply; // Sets extrude multiply factor (in percent)
|
||||
extern float current_position[NUM_AXIS] ;
|
||||
extern float add_homeing[3];
|
||||
#ifdef DELTA
|
||||
extern float endstop_adj[3];
|
||||
#endif
|
||||
extern float min_pos[3];
|
||||
extern float max_pos[3];
|
||||
extern int fanSpeed;
|
||||
|
|
|
@ -139,6 +139,7 @@
|
|||
// M503 - print the current settings (from memory not from eeprom)
|
||||
// M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
|
||||
// M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
|
||||
// M666 - set delta endstop adjustemnt
|
||||
// M605 - Set dual x-carriage movement mode: S<mode> [ X<duplication x-offset> R<duplication temp offset> ]
|
||||
// M907 - Set digital trimpot motor current using axis codes.
|
||||
// M908 - Control digital trimpot directly.
|
||||
|
@ -167,6 +168,9 @@ int saved_feedmultiply;
|
|||
int extrudemultiply=100; //100->1 200->2
|
||||
float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
|
||||
float add_homeing[3]={0,0,0};
|
||||
#ifdef DELTA
|
||||
float endstop_adj[3]={0,0,0};
|
||||
#endif
|
||||
float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
|
||||
float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
|
||||
|
||||
|
@ -794,7 +798,15 @@ static void homeaxis(int axis) {
|
|||
#endif
|
||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
||||
st_synchronize();
|
||||
|
||||
#ifdef DELTA
|
||||
// retrace by the amount specified in endstop_adj
|
||||
if (endstop_adj[axis] * axis_home_dir < 0) {
|
||||
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
||||
destination[axis] = endstop_adj[axis];
|
||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
||||
st_synchronize();
|
||||
}
|
||||
#endif
|
||||
axis_is_at_home(axis);
|
||||
destination[axis] = current_position[axis];
|
||||
feedrate = 0.0;
|
||||
|
@ -1658,6 +1670,14 @@ void process_commands()
|
|||
if(code_seen(axis_codes[i])) add_homeing[i] = code_value();
|
||||
}
|
||||
break;
|
||||
#ifdef DELTA
|
||||
case 666: // M666 set delta endstop adjustemnt
|
||||
for(int8_t i=0; i < 3; i++)
|
||||
{
|
||||
if(code_seen(axis_codes[i])) endstop_adj[i] = code_value();
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef FWRETRACT
|
||||
case 207: //M207 - set retract length S[positive mm] F[feedrate mm/sec] Z[additional zlift/hop]
|
||||
{
|
||||
|
|
Reference in a new issue