Undo babystepping in Z before G28 / G80, if applied already.
Update babystepsTodo atomically (disable / enable interrupts). Disable debugging outputs on the serial line from the X/Y calibration code. OctoPrint fix - fixes a hangup after G28: Link the G28->G80 G codes by calling the G80 code directly without pushing it into the command buffer. SD card driver patch to support the Toshiba FlashAir SD/WiFi card.
This commit is contained in:
parent
3c21438392
commit
2e6e4542c9
|
|
@ -235,7 +235,8 @@ byte b[2];
|
||||||
int value;
|
int value;
|
||||||
};
|
};
|
||||||
|
|
||||||
int babystepLoad[3];
|
// Number of baby steps applied
|
||||||
|
int babystepLoadZ = 0;
|
||||||
|
|
||||||
float homing_feedrate[] = HOMING_FEEDRATE;
|
float homing_feedrate[] = HOMING_FEEDRATE;
|
||||||
// Currently only the extruder axis may be switched to a relative mode.
|
// Currently only the extruder axis may be switched to a relative mode.
|
||||||
|
|
@ -738,7 +739,7 @@ void enquecommand(const char *cmd, bool from_progmem)
|
||||||
cmdqueue_dump_to_serial();
|
cmdqueue_dump_to_serial();
|
||||||
#endif /* CMDBUFFER_DEBUG */
|
#endif /* CMDBUFFER_DEBUG */
|
||||||
} else {
|
} else {
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ERROR_START;
|
||||||
SERIAL_ECHORPGM(MSG_Enqueing);
|
SERIAL_ECHORPGM(MSG_Enqueing);
|
||||||
if (from_progmem)
|
if (from_progmem)
|
||||||
SERIAL_PROTOCOLRPGM(cmd);
|
SERIAL_PROTOCOLRPGM(cmd);
|
||||||
|
|
@ -770,7 +771,7 @@ void enquecommand_front(const char *cmd, bool from_progmem)
|
||||||
cmdqueue_dump_to_serial();
|
cmdqueue_dump_to_serial();
|
||||||
#endif /* CMDBUFFER_DEBUG */
|
#endif /* CMDBUFFER_DEBUG */
|
||||||
} else {
|
} else {
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ERROR_START;
|
||||||
SERIAL_ECHOPGM("Enqueing to the front: \"");
|
SERIAL_ECHOPGM("Enqueing to the front: \"");
|
||||||
if (from_progmem)
|
if (from_progmem)
|
||||||
SERIAL_PROTOCOLRPGM(cmd);
|
SERIAL_PROTOCOLRPGM(cmd);
|
||||||
|
|
@ -1907,6 +1908,11 @@ void process_commands()
|
||||||
// Wait for the motors to stop and update the current position with the absolute values.
|
// Wait for the motors to stop and update the current position with the absolute values.
|
||||||
world2machine_revert_to_uncorrected();
|
world2machine_revert_to_uncorrected();
|
||||||
|
|
||||||
|
// Reset baby stepping to zero, if the babystepping has already been loaded before. The babystepsTodo value will be
|
||||||
|
// consumed during the first movements following this statement.
|
||||||
|
babystepsTodoZsubtract(babystepLoadZ);
|
||||||
|
babystepLoadZ = 0;
|
||||||
|
|
||||||
saved_feedrate = feedrate;
|
saved_feedrate = feedrate;
|
||||||
saved_feedmultiply = feedmultiply;
|
saved_feedmultiply = feedmultiply;
|
||||||
feedmultiply = 100;
|
feedmultiply = 100;
|
||||||
|
|
@ -2114,11 +2120,12 @@ void process_commands()
|
||||||
previous_millis_cmd = millis();
|
previous_millis_cmd = millis();
|
||||||
endstops_hit_on_purpose();
|
endstops_hit_on_purpose();
|
||||||
#ifndef MESH_BED_LEVELING
|
#ifndef MESH_BED_LEVELING
|
||||||
|
// If MESH_BED_LEVELING is not active, then it is the original Prusa i3.
|
||||||
|
// Offer the user to load the baby step value, which has been adjusted at the previous print session.
|
||||||
if(card.sdprinting) {
|
if(card.sdprinting) {
|
||||||
EEPROM_read_B(EEPROM_BABYSTEP_Z,&babystepLoad[2]);
|
EEPROM_read_B(EEPROM_BABYSTEP_Z,&babystepLoadZ);
|
||||||
if(babystepLoad[2] != 0){
|
if(babystepLoadZ != 0)
|
||||||
lcd_adjust_z();
|
lcd_adjust_z();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -2139,7 +2146,8 @@ void process_commands()
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
// Push the commands to the front of the message queue in the reverse order!
|
// Push the commands to the front of the message queue in the reverse order!
|
||||||
// There shall be always enough space reserved for these commands.
|
// There shall be always enough space reserved for these commands.
|
||||||
enquecommand_front_P((PSTR("G80")));
|
// enquecommand_front_P((PSTR("G80")));
|
||||||
|
goto case_G80;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -2334,6 +2342,7 @@ void process_commands()
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
case 80:
|
case 80:
|
||||||
|
case_G80:
|
||||||
{
|
{
|
||||||
if (!IS_SD_PRINTING)
|
if (!IS_SD_PRINTING)
|
||||||
{
|
{
|
||||||
|
|
@ -2354,9 +2363,14 @@ void process_commands()
|
||||||
}
|
}
|
||||||
|
|
||||||
mbl.reset();
|
mbl.reset();
|
||||||
|
|
||||||
|
// Reset baby stepping to zero, if the babystepping has already been loaded before. The babystepsTodo value will be
|
||||||
|
// consumed during the first movements following this statement.
|
||||||
|
babystepsTodoZsubtract(babystepLoadZ);
|
||||||
|
babystepLoadZ = 0;
|
||||||
|
|
||||||
// Cycle through all points and probe them
|
// Cycle through all points and probe them
|
||||||
// First move up.
|
// First move up. During this first movement, the babystepping will be reverted.
|
||||||
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
||||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS]/60, active_extruder);
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS]/60, active_extruder);
|
||||||
// The move to the first calibration point.
|
// The move to the first calibration point.
|
||||||
|
|
@ -2450,8 +2464,9 @@ void process_commands()
|
||||||
{
|
{
|
||||||
if(eeprom_read_byte((unsigned char*)EEPROM_BABYSTEP_Z_SET) == 0x01)
|
if(eeprom_read_byte((unsigned char*)EEPROM_BABYSTEP_Z_SET) == 0x01)
|
||||||
{
|
{
|
||||||
EEPROM_read_B(EEPROM_BABYSTEP_Z,&babystepLoad[2]);
|
// End of G80: Apply the baby stepping value.
|
||||||
babystepsTodo[Z_AXIS] = babystepLoad[2];
|
EEPROM_read_B(EEPROM_BABYSTEP_Z,&babystepLoadZ);
|
||||||
|
babystepsTodoZadd(babystepLoadZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2497,7 +2512,7 @@ void process_commands()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* G83: Babystep in Z and store to EEPROM
|
* G83: Prusa3D specific: Babystep in Z and store to EEPROM
|
||||||
*/
|
*/
|
||||||
case 83:
|
case 83:
|
||||||
{
|
{
|
||||||
|
|
@ -2505,15 +2520,16 @@ void process_commands()
|
||||||
int BabyPosition = code_seen('P') ? code_value() : 0;
|
int BabyPosition = code_seen('P') ? code_value() : 0;
|
||||||
|
|
||||||
if (babystepz != 0) {
|
if (babystepz != 0) {
|
||||||
|
//FIXME Vojtech: What shall be the index of the axis Z: 3 or 4?
|
||||||
|
// Is the axis indexed starting with zero or one?
|
||||||
if (BabyPosition > 4) {
|
if (BabyPosition > 4) {
|
||||||
SERIAL_PROTOCOLLNPGM("Index out of bounds");
|
SERIAL_PROTOCOLLNPGM("Index out of bounds");
|
||||||
}else{
|
}else{
|
||||||
// Save it to the eeprom
|
// Save it to the eeprom
|
||||||
babystepLoad[2] = babystepz;
|
babystepLoadZ = babystepz;
|
||||||
EEPROM_save_B(EEPROM_BABYSTEP_Z0+(BabyPosition*2),&babystepLoad[2]);
|
EEPROM_save_B(EEPROM_BABYSTEP_Z0+(BabyPosition*2),&babystepLoadZ);
|
||||||
// adjist the Z
|
// adjust the Z
|
||||||
babystepsTodo[Z_AXIS] = babystepLoad[2];
|
babystepsTodoZadd(babystepLoadZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -2521,27 +2537,30 @@ void process_commands()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/**
|
/**
|
||||||
* G84: UNDO Babystep Z (move Z axis back)
|
* G84: Prusa3D specific: UNDO Babystep Z (move Z axis back)
|
||||||
*/
|
*/
|
||||||
case 84:
|
case 84:
|
||||||
babystepsTodo[Z_AXIS] = -babystepLoad[2];
|
babystepsTodoZsubtract(babystepLoadZ);
|
||||||
|
// babystepLoadZ = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* G85: Pick best babystep
|
* G85: Prusa3D specific: Pick best babystep
|
||||||
*/
|
*/
|
||||||
case 85:
|
case 85:
|
||||||
lcd_pick_babystep();
|
lcd_pick_babystep();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* G86: Disable babystep correction after home
|
* G86: Prusa3D specific: Disable babystep correction after home.
|
||||||
|
* This G-code will be performed at the start of a calibration script.
|
||||||
*/
|
*/
|
||||||
case 86:
|
case 86:
|
||||||
eeprom_write_byte((unsigned char*)EEPROM_BABYSTEP_Z_SET, 0xFF);
|
eeprom_write_byte((unsigned char*)EEPROM_BABYSTEP_Z_SET, 0xFF);
|
||||||
break;
|
break;
|
||||||
/**
|
/**
|
||||||
* G87: Enable babystep correction after home
|
* G87: Prusa3D specific: Enable babystep correction after home
|
||||||
|
* This G-code will be performed at the end of a calibration script.
|
||||||
*/
|
*/
|
||||||
case 87:
|
case 87:
|
||||||
eeprom_write_byte((unsigned char*)EEPROM_BABYSTEP_Z_SET, 0x01);
|
eeprom_write_byte((unsigned char*)EEPROM_BABYSTEP_Z_SET, 0x01);
|
||||||
|
|
|
||||||
|
|
@ -500,10 +500,14 @@ bool Sd2Card::readData(uint8_t* dst, uint16_t count) {
|
||||||
spiRec();
|
spiRec();
|
||||||
#endif
|
#endif
|
||||||
chipSelectHigh();
|
chipSelectHigh();
|
||||||
|
// Toshiba FlashAir Patch. Purge pending status byte.
|
||||||
|
spiSend(0XFF);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
chipSelectHigh();
|
chipSelectHigh();
|
||||||
|
// Toshiba FlashAir Patch. Purge pending status byte.
|
||||||
|
spiSend(0XFF);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -580,7 +580,7 @@ static inline bool vec_undef(const float v[2])
|
||||||
|
|
||||||
void world2machine_initialize()
|
void world2machine_initialize()
|
||||||
{
|
{
|
||||||
SERIAL_ECHOLNPGM("world2machine_initialize()");
|
// SERIAL_ECHOLNPGM("world2machine_initialize()");
|
||||||
float cntr[2] = {
|
float cntr[2] = {
|
||||||
eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER+0)),
|
eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER+0)),
|
||||||
eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER+4))
|
eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER+4))
|
||||||
|
|
@ -596,7 +596,7 @@ void world2machine_initialize()
|
||||||
|
|
||||||
bool reset = false;
|
bool reset = false;
|
||||||
if (vec_undef(cntr) || vec_undef(vec_x) || vec_undef(vec_y)) {
|
if (vec_undef(cntr) || vec_undef(vec_x) || vec_undef(vec_y)) {
|
||||||
SERIAL_ECHOLNPGM("Undefined bed correction matrix.");
|
// SERIAL_ECHOLNPGM("Undefined bed correction matrix.");
|
||||||
reset = true;
|
reset = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -632,6 +632,7 @@ void world2machine_initialize()
|
||||||
world2machine_reset();
|
world2machine_reset();
|
||||||
} else {
|
} else {
|
||||||
world2machine_update(vec_x, vec_y, cntr);
|
world2machine_update(vec_x, vec_y, cntr);
|
||||||
|
/*
|
||||||
SERIAL_ECHOPGM("world2machine_initialize() loaded: ");
|
SERIAL_ECHOPGM("world2machine_initialize() loaded: ");
|
||||||
MYSERIAL.print(world2machine_rotation_and_skew[0][0], 5);
|
MYSERIAL.print(world2machine_rotation_and_skew[0][0], 5);
|
||||||
SERIAL_ECHOPGM(", ");
|
SERIAL_ECHOPGM(", ");
|
||||||
|
|
@ -645,6 +646,7 @@ void world2machine_initialize()
|
||||||
SERIAL_ECHOPGM(", ");
|
SERIAL_ECHOPGM(", ");
|
||||||
MYSERIAL.print(world2machine_shift[1], 5);
|
MYSERIAL.print(world2machine_shift[1], 5);
|
||||||
SERIAL_ECHOLNPGM("");
|
SERIAL_ECHOLNPGM("");
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -695,7 +697,7 @@ static inline void update_current_position_z()
|
||||||
// At the current position, find the Z stop.
|
// At the current position, find the Z stop.
|
||||||
inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter)
|
inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter)
|
||||||
{
|
{
|
||||||
SERIAL_ECHOLNPGM("find_bed_induction_sensor_point_z 1");
|
// SERIAL_ECHOLNPGM("find_bed_induction_sensor_point_z 1");
|
||||||
bool endstops_enabled = enable_endstops(true);
|
bool endstops_enabled = enable_endstops(true);
|
||||||
bool endstop_z_enabled = enable_z_endstop(false);
|
bool endstop_z_enabled = enable_z_endstop(false);
|
||||||
float z = 0.f;
|
float z = 0.f;
|
||||||
|
|
@ -720,9 +722,9 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter)
|
||||||
update_current_position_z();
|
update_current_position_z();
|
||||||
if (! endstop_z_hit_on_purpose())
|
if (! endstop_z_hit_on_purpose())
|
||||||
goto error;
|
goto error;
|
||||||
SERIAL_ECHOPGM("Bed find_bed_induction_sensor_point_z low, height: ");
|
// SERIAL_ECHOPGM("Bed find_bed_induction_sensor_point_z low, height: ");
|
||||||
MYSERIAL.print(current_position[Z_AXIS], 5);
|
// MYSERIAL.print(current_position[Z_AXIS], 5);
|
||||||
SERIAL_ECHOLNPGM("");
|
// SERIAL_ECHOLNPGM("");
|
||||||
z += current_position[Z_AXIS];
|
z += current_position[Z_AXIS];
|
||||||
}
|
}
|
||||||
current_position[Z_AXIS] = z;
|
current_position[Z_AXIS] = z;
|
||||||
|
|
@ -731,11 +733,11 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter)
|
||||||
|
|
||||||
enable_endstops(endstops_enabled);
|
enable_endstops(endstops_enabled);
|
||||||
enable_z_endstop(endstop_z_enabled);
|
enable_z_endstop(endstop_z_enabled);
|
||||||
SERIAL_ECHOLNPGM("find_bed_induction_sensor_point_z 3");
|
// SERIAL_ECHOLNPGM("find_bed_induction_sensor_point_z 3");
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
SERIAL_ECHOLNPGM("find_bed_induction_sensor_point_z 4");
|
// SERIAL_ECHOLNPGM("find_bed_induction_sensor_point_z 4");
|
||||||
enable_endstops(endstops_enabled);
|
enable_endstops(endstops_enabled);
|
||||||
enable_z_endstop(endstop_z_enabled);
|
enable_z_endstop(endstop_z_enabled);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,25 @@ extern float current_temperature_bed;
|
||||||
#ifdef BABYSTEPPING
|
#ifdef BABYSTEPPING
|
||||||
extern volatile int babystepsTodo[3];
|
extern volatile int babystepsTodo[3];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
inline void babystepsTodoZadd(int n)
|
||||||
|
{
|
||||||
|
if (n != 0) {
|
||||||
|
CRITICAL_SECTION_START
|
||||||
|
babystepsTodo[Z_AXIS] += n;
|
||||||
|
CRITICAL_SECTION_END
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void babystepsTodoZsubtract(int n)
|
||||||
|
{
|
||||||
|
if (n != 0) {
|
||||||
|
CRITICAL_SECTION_START
|
||||||
|
babystepsTodo[Z_AXIS] -= n;
|
||||||
|
CRITICAL_SECTION_END
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//high level conversion routines, for use outside of temperature.cpp
|
//high level conversion routines, for use outside of temperature.cpp
|
||||||
//inline so that there is no performance decrease.
|
//inline so that there is no performance decrease.
|
||||||
//deg=degreeCelsius
|
//deg=degreeCelsius
|
||||||
|
|
|
||||||
|
|
@ -1093,7 +1093,9 @@ static void lcd_move_z() {
|
||||||
static void _lcd_babystep(int axis, const char *msg) {
|
static void _lcd_babystep(int axis, const char *msg) {
|
||||||
if (encoderPosition != 0)
|
if (encoderPosition != 0)
|
||||||
{
|
{
|
||||||
|
CRITICAL_SECTION_START
|
||||||
babystepsTodo[axis] += (int)encoderPosition;
|
babystepsTodo[axis] += (int)encoderPosition;
|
||||||
|
CRITICAL_SECTION_END
|
||||||
babystepMem[axis] += (int)encoderPosition;
|
babystepMem[axis] += (int)encoderPosition;
|
||||||
babystepMemMM[axis] = babystepMem[axis]/axis_steps_per_unit[Z_AXIS];
|
babystepMemMM[axis] = babystepMem[axis]/axis_steps_per_unit[Z_AXIS];
|
||||||
delay(50);
|
delay(50);
|
||||||
|
|
@ -1188,7 +1190,9 @@ void lcd_adjust_z() {
|
||||||
EEPROM_read_B(EEPROM_BABYSTEP_X, &babystepMem[0]);
|
EEPROM_read_B(EEPROM_BABYSTEP_X, &babystepMem[0]);
|
||||||
EEPROM_read_B(EEPROM_BABYSTEP_Y, &babystepMem[1]);
|
EEPROM_read_B(EEPROM_BABYSTEP_Y, &babystepMem[1]);
|
||||||
EEPROM_read_B(EEPROM_BABYSTEP_Z, &babystepMem[2]);
|
EEPROM_read_B(EEPROM_BABYSTEP_Z, &babystepMem[2]);
|
||||||
|
CRITICAL_SECTION_START
|
||||||
babystepsTodo[Z_AXIS] = babystepMem[2];
|
babystepsTodo[Z_AXIS] = babystepMem[2];
|
||||||
|
CRITICAL_SECTION_END
|
||||||
} else {
|
} else {
|
||||||
babystepMem[0] = 0;
|
babystepMem[0] = 0;
|
||||||
babystepMem[1] = 0;
|
babystepMem[1] = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue