Latest upstream commits, merged
This commit is contained in:
commit
3a6fd912cd
2 changed files with 73 additions and 70 deletions
|
@ -1794,12 +1794,6 @@ inline void gcode_G4() {
|
||||||
* Y Home to the Y endstop
|
* Y Home to the Y endstop
|
||||||
* Z Home to the Z endstop
|
* Z Home to the Z endstop
|
||||||
*
|
*
|
||||||
* If numbers are included with XYZ set the position as with G92
|
|
||||||
* Currently adds the home_offset, which may be wrong and removed soon.
|
|
||||||
*
|
|
||||||
* Xn Home X, setting X to n + home_offset[X_AXIS]
|
|
||||||
* Yn Home Y, setting Y to n + home_offset[Y_AXIS]
|
|
||||||
* Zn Home Z, setting Z to n + home_offset[Z_AXIS]
|
|
||||||
*/
|
*/
|
||||||
inline void gcode_G28() {
|
inline void gcode_G28() {
|
||||||
|
|
||||||
|
@ -1859,7 +1853,7 @@ inline void gcode_G28() {
|
||||||
homeY = code_seen(axis_codes[Y_AXIS]),
|
homeY = code_seen(axis_codes[Y_AXIS]),
|
||||||
homeZ = code_seen(axis_codes[Z_AXIS]);
|
homeZ = code_seen(axis_codes[Z_AXIS]);
|
||||||
|
|
||||||
home_all_axis = !(homeX || homeY || homeZ) || (homeX && homeY && homeZ);
|
home_all_axis = (!homeX && !homeY && !homeZ) || (homeX && homeY && homeZ);
|
||||||
|
|
||||||
if (home_all_axis || homeZ) {
|
if (home_all_axis || homeZ) {
|
||||||
|
|
||||||
|
@ -1946,14 +1940,6 @@ inline void gcode_G28() {
|
||||||
// Home Y
|
// Home Y
|
||||||
if (home_all_axis || homeY) HOMEAXIS(Y);
|
if (home_all_axis || homeY) HOMEAXIS(Y);
|
||||||
|
|
||||||
// Set the X position, if included
|
|
||||||
if (code_seen(axis_codes[X_AXIS]) && code_has_value())
|
|
||||||
current_position[X_AXIS] = code_value();
|
|
||||||
|
|
||||||
// Set the Y position, if included
|
|
||||||
if (code_seen(axis_codes[Y_AXIS]) && code_has_value())
|
|
||||||
current_position[Y_AXIS] = code_value();
|
|
||||||
|
|
||||||
// Home Z last if homing towards the bed
|
// Home Z last if homing towards the bed
|
||||||
#if Z_HOME_DIR < 0
|
#if Z_HOME_DIR < 0
|
||||||
|
|
||||||
|
@ -2037,10 +2023,6 @@ inline void gcode_G28() {
|
||||||
|
|
||||||
#endif // Z_HOME_DIR < 0
|
#endif // Z_HOME_DIR < 0
|
||||||
|
|
||||||
// Set the Z position, if included
|
|
||||||
if (code_seen(axis_codes[Z_AXIS]) && code_has_value())
|
|
||||||
current_position[Z_AXIS] = code_value();
|
|
||||||
|
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
|
|
||||||
#endif // else DELTA
|
#endif // else DELTA
|
||||||
|
@ -3152,7 +3134,7 @@ inline void gcode_M104() {
|
||||||
inline void gcode_M105() {
|
inline void gcode_M105() {
|
||||||
if (setTargetedHotend(105)) return;
|
if (setTargetedHotend(105)) return;
|
||||||
|
|
||||||
#if HAS_TEMP_0 || HAS_TEMP_BED
|
#if HAS_TEMP_0 || HAS_TEMP_BED || defined(HEATER_0_USES_MAX6675)
|
||||||
SERIAL_PROTOCOLPGM("ok");
|
SERIAL_PROTOCOLPGM("ok");
|
||||||
#if HAS_TEMP_0
|
#if HAS_TEMP_0
|
||||||
SERIAL_PROTOCOLPGM(" T:");
|
SERIAL_PROTOCOLPGM(" T:");
|
||||||
|
|
|
@ -463,14 +463,22 @@ ISR(TIMER1_COMPA_vect) {
|
||||||
count_direction[Y_AXIS] = 1;
|
count_direction[Y_AXIS] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define _ENDSTOP(axis, minmax) axis ##_## minmax ##_endstop
|
||||||
|
#define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN
|
||||||
|
#define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING
|
||||||
|
#define _OLD_ENDSTOP(axis, minmax) old_## axis ##_## minmax ##_endstop
|
||||||
|
#define _AXIS(AXIS) AXIS ##_AXIS
|
||||||
|
#define _ENDSTOP_HIT(axis) endstop_## axis ##_hit
|
||||||
|
|
||||||
#define UPDATE_ENDSTOP(axis,AXIS,minmax,MINMAX) \
|
#define UPDATE_ENDSTOP(axis,AXIS,minmax,MINMAX) \
|
||||||
bool axis ##_## minmax ##_endstop = (READ(AXIS ##_## MINMAX ##_PIN) != AXIS ##_## MINMAX ##_ENDSTOP_INVERTING); \
|
bool _ENDSTOP(axis, minmax) = (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)); \
|
||||||
if (axis ##_## minmax ##_endstop && old_## axis ##_## minmax ##_endstop && (current_block->steps[AXIS ##_AXIS] > 0)) { \
|
if (_ENDSTOP(axis, minmax) && _OLD_ENDSTOP(axis, minmax) && (current_block->steps[_AXIS(AXIS)] > 0)) { \
|
||||||
endstops_trigsteps[AXIS ##_AXIS] = count_position[AXIS ##_AXIS]; \
|
endstops_trigsteps[_AXIS(AXIS)] = count_position[_AXIS(AXIS)]; \
|
||||||
endstop_## axis ##_hit = true; \
|
_ENDSTOP_HIT(axis) = true; \
|
||||||
step_events_completed = current_block->step_event_count; \
|
step_events_completed = current_block->step_event_count; \
|
||||||
} \
|
} \
|
||||||
old_## axis ##_## minmax ##_endstop = axis ##_## minmax ##_endstop;
|
_OLD_ENDSTOP(axis, minmax) = _ENDSTOP(axis, minmax);
|
||||||
|
|
||||||
|
|
||||||
// Check X and Y endstops
|
// Check X and Y endstops
|
||||||
if (check_endstops) {
|
if (check_endstops) {
|
||||||
|
@ -667,6 +675,11 @@ ISR(TIMER1_COMPA_vect) {
|
||||||
}
|
}
|
||||||
#endif //ADVANCE
|
#endif //ADVANCE
|
||||||
|
|
||||||
|
#define _COUNTER(axis) counter_## axis
|
||||||
|
#define _WRITE_STEP(AXIS, HIGHLOW) AXIS ##_STEP_WRITE(HIGHLOW)
|
||||||
|
#define _APPLY_STEP(AXIS) AXIS ##_APPLY_STEP
|
||||||
|
#define _INVERT_STEP_PIN(AXIS) INVERT_## AXIS ##_STEP_PIN
|
||||||
|
|
||||||
#ifdef CONFIG_STEPPERS_TOSHIBA
|
#ifdef CONFIG_STEPPERS_TOSHIBA
|
||||||
/**
|
/**
|
||||||
* The Toshiba stepper controller require much longer pulses.
|
* The Toshiba stepper controller require much longer pulses.
|
||||||
|
@ -675,8 +688,8 @@ ISR(TIMER1_COMPA_vect) {
|
||||||
* lag to allow it work with without needing NOPs
|
* lag to allow it work with without needing NOPs
|
||||||
*/
|
*/
|
||||||
#define STEP_ADD(axis, AXIS) \
|
#define STEP_ADD(axis, AXIS) \
|
||||||
counter_## axis += current_block->steps[AXIS ##_AXIS]; \
|
_COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \
|
||||||
if (counter_## axis > 0) { AXIS ##_STEP_WRITE(HIGH); }
|
if (_COUNTER(axis) > 0) { _WRITE_STEP(AXIS, HIGH); }
|
||||||
STEP_ADD(x,X);
|
STEP_ADD(x,X);
|
||||||
STEP_ADD(y,Y);
|
STEP_ADD(y,Y);
|
||||||
STEP_ADD(z,Z);
|
STEP_ADD(z,Z);
|
||||||
|
@ -685,10 +698,10 @@ ISR(TIMER1_COMPA_vect) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define STEP_IF_COUNTER(axis, AXIS) \
|
#define STEP_IF_COUNTER(axis, AXIS) \
|
||||||
if (counter_## axis > 0) { \
|
if (_COUNTER(axis) > 0) { \
|
||||||
counter_## axis -= current_block->step_event_count; \
|
_COUNTER(axis) -= current_block->step_event_count; \
|
||||||
count_position[AXIS ##_AXIS] += count_direction[AXIS ##_AXIS]; \
|
count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
|
||||||
AXIS ##_STEP_WRITE(LOW); \
|
_WRITE_STEP(AXIS, LOW); \
|
||||||
}
|
}
|
||||||
|
|
||||||
STEP_IF_COUNTER(x, X);
|
STEP_IF_COUNTER(x, X);
|
||||||
|
@ -701,12 +714,12 @@ ISR(TIMER1_COMPA_vect) {
|
||||||
#else // !CONFIG_STEPPERS_TOSHIBA
|
#else // !CONFIG_STEPPERS_TOSHIBA
|
||||||
|
|
||||||
#define APPLY_MOVEMENT(axis, AXIS) \
|
#define APPLY_MOVEMENT(axis, AXIS) \
|
||||||
counter_## axis += current_block->steps[AXIS ##_AXIS]; \
|
_COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \
|
||||||
if (counter_## axis > 0) { \
|
if (_COUNTER(axis) > 0) { \
|
||||||
AXIS ##_APPLY_STEP(!INVERT_## AXIS ##_STEP_PIN,0); \
|
_APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0); \
|
||||||
counter_## axis -= current_block->step_event_count; \
|
_COUNTER(axis) -= current_block->step_event_count; \
|
||||||
count_position[AXIS ##_AXIS] += count_direction[AXIS ##_AXIS]; \
|
count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
|
||||||
AXIS ##_APPLY_STEP(INVERT_## AXIS ##_STEP_PIN,0); \
|
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \
|
||||||
}
|
}
|
||||||
|
|
||||||
APPLY_MOVEMENT(x, X);
|
APPLY_MOVEMENT(x, X);
|
||||||
|
@ -1010,10 +1023,13 @@ void st_init() {
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define _STEP_INIT(AXIS) AXIS ##_STEP_INIT
|
||||||
|
#define _DISABLE(axis) disable_## axis()
|
||||||
|
|
||||||
#define AXIS_INIT(axis, AXIS, PIN) \
|
#define AXIS_INIT(axis, AXIS, PIN) \
|
||||||
AXIS ##_STEP_INIT; \
|
_STEP_INIT(AXIS); \
|
||||||
AXIS ##_STEP_WRITE(INVERT_## PIN ##_STEP_PIN); \
|
_WRITE_STEP(AXIS, _INVERT_STEP_PIN(PIN)); \
|
||||||
disable_## axis()
|
_DISABLE(axis)
|
||||||
|
|
||||||
#define E_AXIS_INIT(NUM) AXIS_INIT(e## NUM, E## NUM, E)
|
#define E_AXIS_INIT(NUM) AXIS_INIT(e## NUM, E## NUM, E)
|
||||||
|
|
||||||
|
@ -1146,14 +1162,19 @@ void quickStop() {
|
||||||
// No other ISR should ever interrupt this!
|
// No other ISR should ever interrupt this!
|
||||||
void babystep(const uint8_t axis, const bool direction) {
|
void babystep(const uint8_t axis, const bool direction) {
|
||||||
|
|
||||||
|
#define _ENABLE(axis) enable_## axis()
|
||||||
|
#define _READ_DIR(AXIS) AXIS ##_DIR_READ
|
||||||
|
#define _INVERT_DIR(AXIS) INVERT_## AXIS ##_DIR
|
||||||
|
#define _APPLY_DIR(AXIS, INVERT) AXIS ##_APPLY_DIR(INVERT, true)
|
||||||
|
|
||||||
#define BABYSTEP_AXIS(axis, AXIS, INVERT) { \
|
#define BABYSTEP_AXIS(axis, AXIS, INVERT) { \
|
||||||
enable_## axis(); \
|
_ENABLE(axis); \
|
||||||
uint8_t old_pin = AXIS ##_DIR_READ; \
|
uint8_t old_pin = _READ_DIR(AXIS); \
|
||||||
AXIS ##_APPLY_DIR(INVERT_## AXIS ##_DIR^direction^INVERT, true); \
|
_APPLY_DIR(AXIS, _INVERT_DIR(AXIS)^direction^INVERT); \
|
||||||
AXIS ##_APPLY_STEP(!INVERT_## AXIS ##_STEP_PIN, true); \
|
_APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS), true); \
|
||||||
delayMicroseconds(2); \
|
delayMicroseconds(2); \
|
||||||
AXIS ##_APPLY_STEP(INVERT_## AXIS ##_STEP_PIN, true); \
|
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS), true); \
|
||||||
AXIS ##_APPLY_DIR(old_pin, true); \
|
_APPLY_DIR(AXIS, old_pin); \
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(axis) {
|
switch(axis) {
|
||||||
|
|
Reference in a new issue