added delta tower babystepping. Its untested, but hopefully florian horsch will be able to try.

also, removed some trouble for compilation with corexy.
I think that babystepping is only possible in z for a delta tower.
not sure if it would be usefull to step individual motors on a delta, i don't own one
This commit is contained in:
bkubicek 2013-10-07 09:14:04 +02:00
parent c38b0855c8
commit b832f5b9f6
3 changed files with 54 additions and 8 deletions

View file

@ -273,14 +273,23 @@
// Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process // Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process
// it can e.g. be used to change z-positions in the print startup phase in realtime // it can e.g. be used to change z-positions in the print startup phase in realtime
// does not respect endstops! // does not respect endstops!
//#define BABYSTEPPING //#define BABYSTEPPING
//#define BABYSTEP_XY //not only z, but also XY #ifdef BABYSTEPPING
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements
#ifdef COREXY #ifdef COREXY
#error BABYSTEPPING not implemented for COREXY yet. #error BABYSTEPPING not implemented for COREXY yet.
#endif #endif
#ifdef DELTA
#ifdef BABYSTEP_XY
#error BABYSTEPPING only implemented for Z axis on deltabots.
#endif
#endif
#endif
// extruder advance constant (s2/mm3) // extruder advance constant (s2/mm3)
// //
// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2 // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2

View file

@ -1070,14 +1070,16 @@ void babystep(const uint8_t axis,const bool direction)
} }
break; break;
#ifndef DELTA
case Z_AXIS: case Z_AXIS:
{ {
enable_z(); enable_z();
uint8_t old_z_dir_pin= READ(Z_DIR_PIN); //if dualzstepper, both point to same direction. uint8_t old_z_dir_pin= READ(Z_DIR_PIN); //if dualzstepper, both point to same direction.
//setup new step //setup new step
WRITE(Z_DIR_PIN,(INVERT_Z_DIR)^direction); WRITE(Z_DIR_PIN,(INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z);
#ifdef Z_DUAL_STEPPER_DRIVERS #ifdef Z_DUAL_STEPPER_DRIVERS
WRITE(Z2_DIR_PIN,(INVERT_Z_DIR)^direction); WRITE(Z2_DIR_PIN,(INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z);
#endif #endif
//perform step //perform step
WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN); WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN);
@ -1101,6 +1103,41 @@ void babystep(const uint8_t axis,const bool direction)
} }
break; break;
#else //DELTA
case Z_AXIS:
{
enable_x();
enable_y();
enable_z();
uint8_t old_x_dir_pin= READ(X_DIR_PIN);
uint8_t old_y_dir_pin= READ(Y_DIR_PIN);
uint8_t old_z_dir_pin= READ(Z_DIR_PIN);
//setup new step
WRITE(X_DIR_PIN,(INVERT_X_DIR)^direction^BABYSTEP_INVERT_Z);
WRITE(Y_DIR_PIN,(INVERT_Y_DIR)^direction^BABYSTEP_INVERT_Z);
WRITE(Z_DIR_PIN,(INVERT_Z_DIR)^direction^BABYSTEP_INVERT_Z);
//perform step
WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN);
//wait a tiny bit
{
float x=1./float(axis+1); //absolutely useless
}
WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN);
//get old pin state back.
WRITE(X_DIR_PIN,old_x_dir_pin);
WRITE(Y_DIR_PIN,old_y_dir_pin);
WRITE(Z_DIR_PIN,old_z_dir_pin);
}
break;
#endif
default: break; default: break;
} }

View file

@ -367,7 +367,7 @@ static void lcd_babystep_z()
{ {
if (encoderPosition != 0) if (encoderPosition != 0)
{ {
babystepsTodo[Z_AXIS]+=(int)encoderPosition; babystepsTodo[Z_AXIS]+=BABYSTEP_Z_MULTIPLICATOR*(int)encoderPosition;
encoderPosition=0; encoderPosition=0;
lcdDrawUpdate = 1; lcdDrawUpdate = 1;
} }