Merge pull request #495 from XPila/MK3-accurate_homming

Accurate homing, fix - enabled after selftest.
This commit is contained in:
XPila 2018-02-22 20:54:08 +01:00 committed by GitHub
commit af5cfe76b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 7 deletions

View File

@ -135,6 +135,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display.
#endif /* DEBUG_BUILD */
//#define EXPERIMENTAL_FEATURES
/*------------------------------------
TMC2130 default settings

View File

@ -672,10 +672,10 @@ uint16_t tmc2130_get_res(uint8_t axis)
void tmc2130_set_res(uint8_t axis, uint16_t res)
{
tmc2130_mres[axis] = tmc2130_usteps2mres(res);
uint32_t u = micros();
// uint32_t u = micros();
tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current_h[axis], tmc2130_current_r[axis]);
u = micros() - u;
printf_P(PSTR("tmc2130_setup_chopper %c %lu us"), "XYZE"[axis], u);
// u = micros() - u;
// printf_P(PSTR("tmc2130_setup_chopper %c %lu us"), "XYZE"[axis], u);
}
uint8_t tmc2130_get_pwr(uint8_t axis)
@ -948,7 +948,7 @@ uint8_t clusterize_uint8(uint8_t* data, uint8_t size, uint8_t* ccnt, uint8_t* cv
return ++cl;
}
void tmc2130_home_calibrate(uint8_t axis)
bool tmc2130_home_calibrate(uint8_t axis)
{
uint8_t step[16];
uint8_t cnt[16];
@ -967,6 +967,7 @@ void tmc2130_home_calibrate(uint8_t axis)
printf_P(PSTR("result value: %d\n"), tmc2130_home_origin[axis]);
if (axis == X_AXIS) eeprom_update_byte((uint8_t*)EEPROM_TMC2130_HOME_X_ORIGIN, tmc2130_home_origin[X_AXIS]);
else if (axis == Y_AXIS) eeprom_update_byte((uint8_t*)EEPROM_TMC2130_HOME_Y_ORIGIN, tmc2130_home_origin[Y_AXIS]);
return true;
}
#endif //TMC2130

View File

@ -119,6 +119,6 @@ extern void tmc2130_goto_step(uint8_t axis, uint8_t step, uint8_t dir, uint16_t
extern void tmc2130_get_wave(uint8_t axis, uint8_t* data, FILE* stream);
extern void tmc2130_set_wave(uint8_t axis, uint8_t amp, uint8_t fac200);
extern void tmc2130_home_calibrate(uint8_t axis);
extern bool tmc2130_home_calibrate(uint8_t axis);
#endif //TMC2130_H

View File

@ -3953,6 +3953,7 @@ static void lcd_selftest_()
lcd_selftest();
}
#ifdef EXPERIMENTAL_FEATURES
static void lcd_experimantal_menu();
static void lcd_homing_accuracy_menu();
@ -4164,6 +4165,7 @@ static void lcd_experimantal_menu()
MENU_ITEM(submenu, PSTR("uStep linearity"), lcd_ustep_linearity_menu);
END_MENU();
}
#endif //EXPERIMENTAL_FEATURES
static void lcd_calibration_menu()
@ -5375,7 +5377,10 @@ static void lcd_main_menu()
#endif
MENU_ITEM(submenu, MSG_SETTINGS, lcd_settings_menu);
if(!isPrintPaused) MENU_ITEM(submenu, MSG_MENU_CALIBRATION, lcd_calibration_menu);
#ifdef EXPERIMENTAL_FEATURES
MENU_ITEM(submenu, PSTR("Experimantal"), lcd_experimantal_menu);
#endif //EXPERIMENTAL_FEATURES
}
if (!is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL))
@ -5940,10 +5945,13 @@ static bool lcd_selftest()
if (_result)
{
_progress = lcd_selftest_screen(13, 0, 2, true, 0);
tmc2130_home_calibrate(X_AXIS);
bool bres = tmc2130_home_calibrate(X_AXIS);
_progress = lcd_selftest_screen(13, 1, 2, true, 0);
tmc2130_home_calibrate(Y_AXIS);
bres &= tmc2130_home_calibrate(Y_AXIS);
_progress = lcd_selftest_screen(13, 2, 2, true, 0);
if (bres)
eeprom_update_byte((uint8_t*)EEPROM_TMC2130_HOME_ENABLED, 1);
_result = bres;
}
if (_result)