Better live adjust Z interface

This commit is contained in:
michalprusa 2016-05-01 13:56:55 +02:00
parent d1df17a722
commit 9b8d663526
9 changed files with 51 additions and 16 deletions

View File

@ -2361,11 +2361,17 @@ void process_commands()
break;
/**
* G86: Babystep in Z and store to EEPROM
* G86: Disable babystep correction after home
*/
case 86:
eeprom_write_byte((unsigned char*)EEPROM_BABYSTEP_Z_SET, 0xFF);
break;
/**
* G87: Enable babystep correction after home
*/
case 87:
eeprom_write_byte((unsigned char*)EEPROM_BABYSTEP_Z_SET, 0x01);
break;
#endif // ENABLE_MESH_BED_LEVELING

View File

@ -20,6 +20,7 @@ int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added t
extern int lcd_change_fil_state;
int babystepMem[3];
float babystepMemMM[3];
union Data
{
@ -880,10 +881,11 @@ static void _lcd_babystep(int axis, const char *msg) {
if (encoderPosition != 0) {
babystepsTodo[axis] += (int)encoderPosition;
babystepMem[axis] += (int)encoderPosition;
babystepMemMM[axis] = babystepMem[axis]/axis_steps_per_unit[Z_AXIS];
encoderPosition = 0;
lcdDrawUpdate = 1;
}
if (lcdDrawUpdate) lcd_implementation_drawedit_2(msg, ftostr51(babystepMem[axis]));
if (lcdDrawUpdate) lcd_implementation_drawedit_2(msg, ftostr13ns(babystepMemMM[axis]));
if (LCD_CLICKED) lcd_goto_menu(lcd_main_menu);
EEPROM_save_B(EEPROM_BABYSTEP_X, &babystepMem[0]);
EEPROM_save_B(EEPROM_BABYSTEP_Y, &babystepMem[1]);
@ -1206,6 +1208,13 @@ static void lcd_settings_menu()
MENU_ITEM(function, MSG_SILENT_MODE_ON, lcd_silent_mode_set);
}
EEPROM_read_B(EEPROM_BABYSTEP_X, &babystepMem[0]);
EEPROM_read_B(EEPROM_BABYSTEP_Y, &babystepMem[1]);
EEPROM_read_B(EEPROM_BABYSTEP_Z, &babystepMem[2]);
babystepMemMM[2] = babystepMem[2]/axis_steps_per_unit[Z_AXIS];
MENU_ITEM(submenu, MSG_BABYSTEP_Z, lcd_babystep_z);//8
MENU_ITEM(submenu, MSG_LANGUAGE_SELECT, lcd_language_menu);
END_MENU();
@ -2170,6 +2179,24 @@ char *ftostr12ns(const float &x)
return conv;
}
//Float to string with 1.234 format
char *ftostr13ns(const float &x)
{
long xx = x * 1000;
if (xx >= 0)
conv[0] = ' ';
else
conv[0] = '-';
xx = abs(xx);
conv[1] = (xx / 1000) % 10 + '0';
conv[2] = '.';
conv[3] = (xx / 100) % 10 + '0';
conv[4] = (xx / 10) % 10 + '0';
conv[5] = (xx) % 10 + '0';
conv[6] = 0;
return conv;
}
// convert float to space-padded string with -_23.4_ format
char *ftostr32sp(const float &x) {
long xx = abs(x * 100);

View File

@ -133,7 +133,8 @@ char *ftostr31ns(const float &x); // float to string without sign character
char *ftostr31(const float &x);
char *ftostr32(const float &x);
char *ftostr43(const float &x);
char *ftostr12ns(const float &x);
char *ftostr12ns(const float &x);
char *ftostr13ns(const float &x);
char *ftostr32sp(const float &x); // remove zero-padding from ftostr32
char *ftostr5(const float &x);
char *ftostr51(const float &x);

View File

@ -843,6 +843,7 @@ void lcd_implementation_drawedit_2(const char* pstr, char* value)
lcd.setCursor((LCD_WIDTH - strlen(value))/2, 3);
lcd.print(value);
lcd.print(" mm");
}
static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)

View File

@ -21,7 +21,7 @@
*------------------------------------*/
// Steps per unit {X,Y,Z,E}
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/0.8,174.2}
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/0.8,161.3}
// Endstop inverting
const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.

View File

@ -21,7 +21,7 @@
*------------------------------------*/
// Steps per unit {X,Y,Z,E}
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/0.8,174.2}
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/0.8,161.3}
// Endstop inverting
const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.

View File

@ -21,7 +21,7 @@
*------------------------------------*/
// Steps per unit {X,Y,Z,E}
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/0.8,174.2}
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/0.8,161.3}
// Endstop inverting
const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.

View File

@ -21,7 +21,7 @@
*------------------------------------*/
// Steps per unit {X,Y,Z,E}
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/0.8,174.2}
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/0.8,161.3}
// Endstop inverting
const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.

View File

@ -24,7 +24,7 @@
*------------------------------------*/
// Steps per unit {X,Y,Z,E}
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,174.2}
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,161.3}
// Endstop inverting
const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
@ -33,16 +33,16 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
// Home position
#define MANUAL_X_HOME_POS 0
#define MANUAL_Y_HOME_POS -1.2
#define MANUAL_Z_HOME_POS 0.25
#define MANUAL_Y_HOME_POS -2.2
#define MANUAL_Z_HOME_POS 0.2
// Travel limits after homing
#define X_MAX_POS 255
#define X_MIN_POS 0
#define Y_MAX_POS 210
#define Y_MIN_POS -1.2
#define Y_MIN_POS -4
#define Z_MAX_POS 210
#define Z_MIN_POS 0.25
#define Z_MIN_POS 0.2
#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
#define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min)
@ -167,8 +167,8 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
// Mesh definitions
#define MESH_MIN_X 35
#define MESH_MAX_X 239
#define MESH_MIN_Y 7
#define MESH_MAX_Y 203
#define MESH_MIN_Y 6
#define MESH_MAX_Y 202
// Mesh upsample definition
#define MESH_NUM_X_POINTS 7
@ -180,8 +180,8 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define MESH_HOME_Z_CALIB 0.2
#define MESH_HOME_Z_SEARCH 5
#define X_PROBE_OFFSET_FROM_EXTRUDER 22.5 // Z probe to nozzle X offset: -left +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 8 // Z probe to nozzle Y offset: -front +behind
#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 9 // Z probe to nozzle Y offset: -front +behind
#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4 // Z probe to nozzle Z offset: -below (always!)
#endif