-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Differential Extruder #27582
base: bugfix-2.1.x
Are you sure you want to change the base?
Differential Extruder #27582
Changes from all commits
6429cee
aeb176b
4606d52
812e2e4
f9fe18a
99d821d
35a420d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,6 +98,10 @@ Stepper stepper; // Singleton | |
#include "planner.h" | ||
#include "motion.h" | ||
|
||
#if ENABLED(DIFFERENTIAL_EXTRUDER) | ||
#include "printcounter.h" | ||
#endif | ||
|
||
#if ENABLED(FT_MOTION) | ||
#include "ft_motion.h" | ||
#endif | ||
|
@@ -1783,6 +1787,10 @@ void Stepper::pulse_phase_isr() { | |
// Direct Stepping page? | ||
const bool is_page = current_block->is_page(); | ||
|
||
#if ENABLED(DIFFERENTIAL_EXTRUDER) | ||
const bool is_print_job = print_job_timer.isRunning(); | ||
#endif | ||
|
||
do { | ||
AxisFlags step_needed{0}; | ||
|
||
|
@@ -1845,18 +1853,31 @@ void Stepper::pulse_phase_isr() { | |
DELTA_ERROR = de; \ | ||
}while(0) | ||
|
||
// Differential Extruder moves E along with X | ||
#if ENABLED(DIFFERENTIAL_EXTRUDER) | ||
#define DIFFERENTIAL_E_PULSE(AXIS, ONSTEP) \ | ||
if (!is_print_job && _AXIS(AXIS) == X_AXIS) { \ | ||
E_APPLY_DIR(count_direction[X_AXIS] > 0, false); /* Match E direction to X */ \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is possible this DIR change will not be registered before the STEP is applied on the following line. Any direction change should include a delay so the driver can register the change before the next step signal. The stepper ISR currently aims to set all stepper DIR signals first, then delay, and then do all the steps. This way we only need one delay for all stepper DIRs. Any added delays will cause a reduction in the top stepping rate. But, we do need to add some kind of delay right here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. I'll take a look at the code you changed in stepper.cpp and test it on my printer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Homing and other commands issued via console/screen/click-wheel work ok. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an issue for which I do have a solution, but it could be more elegant. Here it is: |
||
E_APPLY_STEP(ONSTEP ? _STEP_STATE(E) : !_STEP_STATE(E), false); /* Add the pulse to the E stepper */ \ | ||
} | ||
#else | ||
#define DIFFERENTIAL_E_PULSE(...) NOOP | ||
#endif | ||
|
||
// Start an active pulse if needed | ||
#define PULSE_START(AXIS) do{ \ | ||
if (step_needed.test(_AXIS(AXIS))) { \ | ||
count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \ | ||
_APPLY_STEP(AXIS, _STEP_STATE(AXIS), 0); \ | ||
_APPLY_STEP(AXIS, _STEP_STATE(AXIS), false); \ | ||
DIFFERENTIAL_E_PULSE(AXIS, true); \ | ||
} \ | ||
}while(0) | ||
|
||
// Stop an active pulse if needed | ||
#define PULSE_STOP(AXIS) do { \ | ||
if (step_needed.test(_AXIS(AXIS))) { \ | ||
_APPLY_STEP(AXIS, !_STEP_STATE(AXIS), 0); \ | ||
_APPLY_STEP(AXIS, !_STEP_STATE(AXIS), false); \ | ||
DIFFERENTIAL_E_PULSE(AXIS, false); \ | ||
} \ | ||
}while(0) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks to me like the feature could work with any board, including AVR, as there are no complex calculations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I originally thought the same, but I was getting a deluge of errors from automatic tests, many of them in regards to 8-bit Arduino. Some of the errors referred to non-defined Cartesian axis variables, so I thought I'd better limit the scope of my extruder to RepRap kinematics, but I couldn't find a test for RepRap. That's the only reason why I test for Creality V4, so please feel free to suggest a more universal test that will just check if the kinematics is RepRap.