Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Speed controlled extruder FW modification

    Scheduled Pinned Locked Moved
    Firmware developers
    1
    1
    132
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Giulianoundefined
      Giuliano
      last edited by

      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!

      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Unless otherwise noted, all forum content is licensed under CC-BY-SA