Add Z Probe Offset to EEPROM and Ultra LCD

master
Alex Borro 11 years ago
parent df194f75e1
commit 05932e4458

@ -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 // 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 "V09" #define EEPROM_VERSION "V10"
#ifdef EEPROM_SETTINGS #ifdef EEPROM_SETTINGS
void Config_StoreSettings() void Config_StoreSettings()
@ -70,6 +70,7 @@ void Config_StoreSettings()
EEPROM_WRITE_VAR(i,absPreheatHotendTemp); EEPROM_WRITE_VAR(i,absPreheatHotendTemp);
EEPROM_WRITE_VAR(i,absPreheatHPBTemp); EEPROM_WRITE_VAR(i,absPreheatHPBTemp);
EEPROM_WRITE_VAR(i,absPreheatFanSpeed); EEPROM_WRITE_VAR(i,absPreheatFanSpeed);
EEPROM_WRITE_VAR(i,zprobe_zoffset);
#ifdef PIDTEMP #ifdef PIDTEMP
EEPROM_WRITE_VAR(i,Kp); EEPROM_WRITE_VAR(i,Kp);
EEPROM_WRITE_VAR(i,Ki); EEPROM_WRITE_VAR(i,Ki);
@ -210,6 +211,7 @@ void Config_RetrieveSettings()
EEPROM_READ_VAR(i,absPreheatHotendTemp); EEPROM_READ_VAR(i,absPreheatHotendTemp);
EEPROM_READ_VAR(i,absPreheatHPBTemp); EEPROM_READ_VAR(i,absPreheatHPBTemp);
EEPROM_READ_VAR(i,absPreheatFanSpeed); EEPROM_READ_VAR(i,absPreheatFanSpeed);
EEPROM_READ_VAR(i,zprobe_zoffset);
#ifndef PIDTEMP #ifndef PIDTEMP
float Kp,Ki,Kd; float Kp,Ki,Kd;
#endif #endif
@ -272,6 +274,7 @@ void Config_ResetDefault()
absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP; absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP;
absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED; absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
#endif #endif
zprobe_zoffset = -Z_PROBE_OFFSET_FROM_EXTRUDER;
#ifdef DOGLCD #ifdef DOGLCD
lcd_contrast = DEFAULT_LCD_CONTRAST; lcd_contrast = DEFAULT_LCD_CONTRAST;
#endif #endif

@ -210,6 +210,7 @@ extern float endstop_adj[3];
extern float min_pos[3]; extern float min_pos[3];
extern float max_pos[3]; extern float max_pos[3];
extern bool axis_known_position[3]; extern bool axis_known_position[3];
extern float zprobe_zoffset;
extern int fanSpeed; extern int fanSpeed;
#ifdef BARICUDA #ifdef BARICUDA
extern int ValvePressure; extern int ValvePressure;

@ -196,6 +196,7 @@ float endstop_adj[3]={0,0,0};
float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS }; 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 }; float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
bool axis_known_position[3] = {false, false, false}; bool axis_known_position[3] = {false, false, false};
float zprobe_zoffset;
// Extruder offset // Extruder offset
#if EXTRUDERS > 1 #if EXTRUDERS > 1
@ -240,6 +241,7 @@ int EtoPPressure=0;
float delta[3] = {0.0, 0.0, 0.0}; float delta[3] = {0.0, 0.0, 0.0};
#endif #endif
//=========================================================================== //===========================================================================
//=============================private variables============================= //=============================private variables=============================
//=========================================================================== //===========================================================================
@ -824,7 +826,7 @@ static void set_bed_level_equation_lsq(double *plane_equation_coefficients)
current_position[Z_AXIS] = corrected_position.z; current_position[Z_AXIS] = corrected_position.z;
// but the bed at 0 so we don't go below it. // but the bed at 0 so we don't go below it.
current_position[Z_AXIS] = -Z_PROBE_OFFSET_FROM_EXTRUDER; current_position[Z_AXIS] = zprobe_zoffset; // in the lsq we reach here after raising the extruder due to the loop structure
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
} }
@ -860,7 +862,7 @@ static void set_bed_level_equation(float z_at_xLeft_yFront, float z_at_xRight_yF
current_position[Z_AXIS] = corrected_position.z; current_position[Z_AXIS] = corrected_position.z;
// but the bed at 0 so we don't go below it. // but the bed at 0 so we don't go below it.
current_position[Z_AXIS] = -Z_PROBE_OFFSET_FROM_EXTRUDER; current_position[Z_AXIS] = zprobe_zoffset;
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
} }
@ -1316,7 +1318,7 @@ void process_commands()
} }
#ifdef ENABLE_AUTO_BED_LEVELING #ifdef ENABLE_AUTO_BED_LEVELING
if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) { if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
current_position[Z_AXIS] -= Z_PROBE_OFFSET_FROM_EXTRUDER; //Add Z_Probe offset (the distance is negative) current_position[Z_AXIS] += zprobe_zoffset; //Add Z_Probe offset (the distance is negative)
} }
#endif #endif
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);

@ -138,7 +138,7 @@
#define MSG_CNG_SDCARD "Change SD-Card" #define MSG_CNG_SDCARD "Change SD-Card"
#define MSG_ZPROBE_OUT "ZProbe Outside Bed" #define MSG_ZPROBE_OUT "ZProbe Outside Bed"
#define MSG_POSITION_UNKNOWN "Home X/Y before Z" #define MSG_POSITION_UNKNOWN "Home X/Y before Z"
#define MSG_ZPROBE_ZOFFSET "Z Offset"
// Serial Console Messages // Serial Console Messages
#define MSG_Enqueing "enqueing \"" #define MSG_Enqueing "enqueing \""
@ -305,6 +305,7 @@
#define MSG_CNG_SDCARD "Change SD-Card" #define MSG_CNG_SDCARD "Change SD-Card"
#define MSG_ZPROBE_OUT "ZProbe Outside Bed" #define MSG_ZPROBE_OUT "ZProbe Outside Bed"
#define MSG_POSITION_UNKNOWN "Home X/Y before Z" #define MSG_POSITION_UNKNOWN "Home X/Y before Z"
#define MSG_ZPROBE_ZOFFSET "Z Offset"
// Serial Console Messages // Serial Console Messages
@ -471,6 +472,7 @@
#define MSG_CNG_SDCARD "Changer de carte SD" #define MSG_CNG_SDCARD "Changer de carte SD"
#define MSG_ZPROBE_OUT "ZProbe Outside Bed" #define MSG_ZPROBE_OUT "ZProbe Outside Bed"
#define MSG_POSITION_UNKNOWN "Home X/Y before Z" #define MSG_POSITION_UNKNOWN "Home X/Y before Z"
#define MSG_ZPROBE_ZOFFSET "Z Offset"
// Serial Console Messages // Serial Console Messages
@ -640,6 +642,7 @@
#define MSG_CNG_SDCARD "Change SD-Card" #define MSG_CNG_SDCARD "Change SD-Card"
#define MSG_ZPROBE_OUT "ZProbe Outside Bed" #define MSG_ZPROBE_OUT "ZProbe Outside Bed"
#define MSG_POSITION_UNKNOWN "Home X/Y before Z" #define MSG_POSITION_UNKNOWN "Home X/Y before Z"
#define MSG_ZPROBE_ZOFFSET "Z Offset"
// Serial Console Messages // Serial Console Messages
@ -813,6 +816,7 @@
#define MSG_STEPPER_RELEASED "Desacoplada." #define MSG_STEPPER_RELEASED "Desacoplada."
#define MSG_ZPROBE_OUT "ZProbe Outside Bed" #define MSG_ZPROBE_OUT "ZProbe Outside Bed"
#define MSG_POSITION_UNKNOWN "Home X/Y before Z" #define MSG_POSITION_UNKNOWN "Home X/Y before Z"
#define MSG_ZPROBE_ZOFFSET "Z Offset"
// Serial Console Messages // Serial Console Messages
@ -976,6 +980,7 @@
#define MSG_CNG_SDCARD "Change SD-Card" #define MSG_CNG_SDCARD "Change SD-Card"
#define MSG_ZPROBE_OUT "ZProbe Outside Bed" #define MSG_ZPROBE_OUT "ZProbe Outside Bed"
#define MSG_POSITION_UNKNOWN "Home X/Y before Z" #define MSG_POSITION_UNKNOWN "Home X/Y before Z"
#define MSG_ZPROBE_ZOFFSET "Z Offset"
// Serial Console Messages // Serial Console Messages
@ -1139,6 +1144,7 @@
#define MSG_CNG_SDCARD "Cambia SD-Card" #define MSG_CNG_SDCARD "Cambia SD-Card"
#define MSG_ZPROBE_OUT "ZProbe Outside Bed" #define MSG_ZPROBE_OUT "ZProbe Outside Bed"
#define MSG_POSITION_UNKNOWN "Home X/Y before Z" #define MSG_POSITION_UNKNOWN "Home X/Y before Z"
#define MSG_ZPROBE_ZOFFSET "Z Offset"
// Serial Console Messages // Serial Console Messages
@ -1311,6 +1317,7 @@
#define MSG_CNG_SDCARD "Change SD-Card" #define MSG_CNG_SDCARD "Change SD-Card"
#define MSG_ZPROBE_OUT "Sonda fora da mesa" #define MSG_ZPROBE_OUT "Sonda fora da mesa"
#define MSG_POSITION_UNKNOWN "Home X/Y antes de Z" #define MSG_POSITION_UNKNOWN "Home X/Y antes de Z"
#define MSG_ZPROBE_ZOFFSET "Z Offset"
// Serial Console Messages // Serial Console Messages
@ -1479,6 +1486,7 @@
#define MSG_CNG_SDCARD "Change SD-Card" #define MSG_CNG_SDCARD "Change SD-Card"
#define MSG_ZPROBE_OUT "ZProbe Outside Bed" #define MSG_ZPROBE_OUT "ZProbe Outside Bed"
#define MSG_POSITION_UNKNOWN "Home X/Y before Z" #define MSG_POSITION_UNKNOWN "Home X/Y before Z"
#define MSG_ZPROBE_ZOFFSET "Z Offset"
// Serial Console Messages // Serial Console Messages

@ -19,6 +19,7 @@ int absPreheatHotendTemp;
int absPreheatHPBTemp; int absPreheatHPBTemp;
int absPreheatFanSpeed; int absPreheatFanSpeed;
#ifdef ULTIPANEL #ifdef ULTIPANEL
static float manual_feedrate[] = MANUAL_FEEDRATE; static float manual_feedrate[] = MANUAL_FEEDRATE;
#endif // ULTIPANEL #endif // ULTIPANEL
@ -705,6 +706,7 @@ static void lcd_control_motion_menu()
{ {
START_MENU(); START_MENU();
MENU_ITEM(back, MSG_CONTROL, lcd_control_menu); MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
MENU_ITEM_EDIT(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, 0.5, 50);
MENU_ITEM_EDIT(float5, MSG_ACC, &acceleration, 500, 99000); MENU_ITEM_EDIT(float5, MSG_ACC, &acceleration, 500, 99000);
MENU_ITEM_EDIT(float3, MSG_VXY_JERK, &max_xy_jerk, 1, 990); MENU_ITEM_EDIT(float3, MSG_VXY_JERK, &max_xy_jerk, 1, 990);
MENU_ITEM_EDIT(float52, MSG_VZ_JERK, &max_z_jerk, 0.1, 990); MENU_ITEM_EDIT(float52, MSG_VZ_JERK, &max_z_jerk, 0.1, 990);

Loading…
Cancel
Save