Marlin Babystepping March 25, 2014 04:44PM |
Registered: 10 years ago Posts: 8 |
Re: Marlin Babystepping March 26, 2014 12:27AM |
Registered: 10 years ago Posts: 36 |
Re: Marlin Babystepping March 26, 2014 05:35AM |
Registered: 10 years ago Posts: 8 |
// Babystep pins for buttons up and down #define BABYSTEP_UP_PIN 48 #define BABYSTEP_DOWN_PIN 46
//============================= // BabyStepping !!!!!!!! //============================= bool babystep_switch_up = false; // on/off boolean switch for baby up step commando's bool babystep_switch_down = false; // on/off boolean switch for baby down step commando's void setup_babystep_pins() { #if defined (BABYSTEP_UP_PIN) && (BABYSTEP_UP_PIN > -1) SET_INPUT(BABYSTEP_UP_PIN); WRITE(BABYSTEP_UP_PIN, HIGH); #endif #if defined (BABYSTEP_DOWN_PIN) && (BABYSTEP_DOWN_PIN > -1) SET_INPUT(BABYSTEP_DOWN_PIN); WRITE(BABYSTEP_DOWN_PIN, HIGH); #endif } void babystep_update() { if ((READ(BABYSTEP_UP_PIN) == 0) && (babystep_switch_up == false)) { babystepsTodo[Z_AXIS]+=BABYSTEP_Z_MULTIPLICATOR; babystep_switch_up = true; SERIAL_ECHOLN("BabyUp Pushed"); } if ((READ(BABYSTEP_UP_PIN) == 1) && (babystep_switch_up == true)) { babystep_switch_up = false; SERIAL_ECHOLN("BabyUp Off"); SERIAL_ECHO("BabyStepTodo: "); SERIAL_ECHOLN(babystepsTodo[Z_AXIS]); } if ((READ(BABYSTEP_DOWN_PIN) == 0) && (babystep_switch_down == false)) { babystepsTodo[Z_AXIS]-=BABYSTEP_Z_MULTIPLICATOR; babystep_switch_down = true; SERIAL_ECHOLN("BabyDown Pushed"); } if ((READ(BABYSTEP_DOWN_PIN) == 1) && (babystep_switch_down == true)) { babystep_switch_down = false; SERIAL_ECHOLN("BabyDown Off"); SERIAL_ECHO("BabyStepTodo: "); SERIAL_ECHOLN(babystepsTodo[Z_AXIS]); } }
void setup() { setup_killpin(); setup_powerhold(); MYSERIAL.begin(BAUDRATE); SERIAL_PROTOCOLLNPGM("start"); SERIAL_ECHO_START; setup_babystep_pins(); ....
void loop() { ... //check heater every n milliseconds manage_heater(); manage_inactivity(); checkHitEndstops(); lcd_update(); babystep_update(); }
Re: Marlin Babystepping March 27, 2014 01:18PM |
Registered: 10 years ago Posts: 36 |
Re: Marlin Babystepping March 27, 2014 03:44PM |
Registered: 10 years ago Posts: 8 |
Re: Marlin Babystepping March 27, 2014 10:33PM |
Registered: 10 years ago Posts: 36 |
void prepare_move() { clamp_to_software_endstops(destination); previous_millis_cmd = millis(); #ifdef DELTA float difference[NUM_AXIS]; for (int8_t i=0; i < NUM_AXIS; i++) { difference = destination - current_position; } float cartesian_mm = sqrt(sq(difference[X_AXIS]) + sq(difference[Y_AXIS]) + sq(difference[Z_AXIS])); if (cartesian_mm < 0.000001) { cartesian_mm = abs(difference[E_AXIS]); } if (cartesian_mm < 0.000001) { return; } float seconds = 6000 * cartesian_mm / feedrate / feedmultiply; // Append Baby Steps int steps = max(1, int(DELTA_SEGMENTS_PER_SECOND * seconds) + babystepsTodo[Z_AXIS]); // Clear babystepsTodo babystepsTodo[Z_AXIS] = 0; // SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm); // SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds); // SERIAL_ECHOPGM(" steps="); SERIAL_ECHOLN(steps); for (int s = 1; s <= steps; s++) { float fraction = float(s) / float(steps); for(int8_t i=0; i < NUM_AXIS; i++) { destination = current_position + difference * fraction; } calculate_delta(destination); adjust_delta(destination); plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder); } #else ...
Re: Marlin Babystepping March 28, 2014 03:26PM |
Registered: 10 years ago Posts: 8 |
// Clear babystepsTodo babystepsTodo[Z_AXIS] = 0;This is a global variable passing around the requested number of steps per axis.
Re: Marlin Babystepping April 17, 2014 11:55AM |
Registered: 10 years ago Posts: 1 |
Re: Marlin Babystepping April 18, 2014 10:48AM |
Registered: 14 years ago Posts: 1,352 |
#define BABYSTEPPING #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 (+) #define BABYSTP_GPIO_Z /*nbm alternate babystepping Z with 2 GPIO buttons (no lcd, no menu) */ (+) #ifdef BABYSTP_GPIO_Z (+) #define BABYSTP_GPIO_ZUP 46 // Babystep pin for up (+) #define BABYSTP_GPIO_ZDN 48 // Babystep pin for down (+) #define BABYSTP_GPIO_NUM 1 // Impact variable, sort of number of steps, default 1 (+) #endif //BABYSTP_GPIO_Z (+) #define BABYSTP_DLYU_FCT 1000 // only applies if babystep() in stepper.cpp is using delayMicroseconds() #ifdef COREXY #error BABYSTEPPING not implemented for COREXY yet. #endif #ifdef DELTA #ifdef BABYSTEP_XY #error BABYSTEPPING only implemented for Z axis on deltabots. #endif #endif #endif
/* declarations going in temperature.h : */ #ifdef BABYSTP_GPIO_Z void babystp_gpio_z_setup(); void babystp_gpio_z_read(); #endif /*BABYSTP_GPIO_Z*/
/*nbm functions content going in temperature.cpp under "fuctions" chapter*/ #ifdef BABYSTP_GPIO_Z void babystp_gpio_z_setup() /*nbm actual pin setup*/ { SET_INPUT(BABYSTP_GPIO_ZUP); /*maybe simpler with pinmode etc, instead fastio*/ WRITE(BABYSTP_GPIO_ZUP,1); SET_INPUT(BABYSTP_GPIO_ZDN); WRITE(BABYSTP_GPIO_ZDN,1); } void babystp_gpio_z_read() /*nbm pin reading changing the babystepsTodo*/ { if ((READ(BABYSTP_GPIO_ZUP))==LOW) /*prioritize up and ignore case with both*/ { babystepsTodo[Z_AXIS]+=BABYSTP_GPIO_NUM; } else if ((READ(BABYSTP_GPIO_ZDN))==LOW) { babystepsTodo[Z_AXIS]+=BABYSTP_GPIO_NUM*(-1); } /*double check whats up and down*/ } #endif /*BABYSTP_GPIO_Z*/
/* calling for pin setup in marlin_main from the void setup(){....at the end} */ #ifdef BABYSTP_GPIO_Z babystp_gpio_z_setup(); /*nbm call for _setup() from marlin_main void setup(){...at the end} */ #endif /*BABYSTP_GPIO_Z*/
/* calling for _read() update from ... some unknown place e.g. void updateTemperaturesFromRawValues() or test other places*/ #ifdef BABYSTP_GPIO_Z babystp_gpio_z_read(); /*nbm call for read() update from ... some other function, guess a good place*/ #endif /*BABYSTP_GPIO_Z*/
Re: Marlin Babystepping May 01, 2014 10:51AM |
Registered: 10 years ago Posts: 478 |
Re: Marlin Babystepping May 01, 2014 11:47AM |
Registered: 10 years ago Posts: 478 |
Re: Marlin Babystepping May 18, 2014 04:37PM |
Registered: 10 years ago Posts: 136 |
Re: Marlin Babystepping May 21, 2014 06:57AM |
Registered: 10 years ago Posts: 136 |
Re: Marlin Babystepping May 23, 2014 11:52AM |
Registered: 14 years ago Posts: 1,352 |
Re: Marlin Babystepping July 21, 2015 12:12PM |
Registered: 10 years ago Posts: 4 |
Quote
yellobello
The problem with babystepping is that it is mostly needed during the first layer, depending on model size and print speed, and so when you have to go through the menus to activate babystepping, the print is already halfway through the first layer.
Re: Marlin Babystepping July 23, 2015 01:32AM |
Registered: 9 years ago Posts: 5,232 |
Re: Marlin Babystepping September 22, 2015 04:29AM |
Registered: 11 years ago Posts: 444 |
Re: Marlin Babystepping September 22, 2015 11:54AM |
Registered: 10 years ago Posts: 4,977 |
Triffid Hunter's Calibration Guide | --> X <-- Drill for new Monitor | Most important Gcode. |
Re: Marlin Babystepping February 18, 2016 04:25AM |
Registered: 9 years ago Posts: 3,525 |
Quote
gordo3di
Quote
yellobello
The problem with babystepping is that it is mostly needed during the first layer, depending on model size and print speed, and so when you have to go through the menus to activate babystepping, the print is already halfway through the first layer.
Try moving the z-axis baby stepping to the top of the Tune menu. This way its very quick to get to it. Works great for us.