Speed controlled extruder FW modification
-
Hello,
for the application described in this other topic I am trying to implement a simple speed controlled extruder using a Duet3.
I tried using a macro, but that didn't work. The refresh rate was not good enough. In a second attempt, by modifying the FW I got a bit further.
Currently I read the ZProbe value in CalcNextStepTimeFull and use it to scale nextStepTime.
This works using a potentiometer on the input, changes are applied immedately to the speed, but the overall duration of the G1 move doesn't seems to take the scaled step time into account, so that after an extrusion I alwas get a dead time where no other drive movements are executed.I probably didn't grab all details of how the re-calculation is planned. Can someone point me out on what else needs to be done?
bool DriveMovement::CalcNextStepTimeFull(const DDA &dda) noexcept pre(nextStep <= totalSteps; stepsTillRecalc == 0) { const auto zp2 = reprap.GetPlatform().GetEndstops().GetZProbe(0); NewSpeedFactor = uint32_t(zp2->GetReading()); NewSpeedFactor = max<uint32_t>(NewSpeedFactor,100); NewSpeedFactor = min<uint32_t>(NewSpeedFactor,1000); ... switch (state) { case DMState::cartLinear: // linear steady speed nextStepScaled=(uint32_t)((uint64_t)(nextStep * UsedSpeedFactor) >> 10); ... nextCalcStepTime = pB + (float)(nextStepScaled + stepsTillRecalc) * pC ; ... nextStepTime = NextCalcStepTime - (stepsTillRecalc * stepInterval); ...
Thanks!