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

Multithreading

Scheduled Pinned Locked Moved
Firmware installation
3
5
207
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.
  • undefined
    ozgunkilicafsar
    last edited by 23 Jun 2023, 14:55

    Hi! I'm using Duet 3 Mini 5+ and I'm interested in having two functions run concurrently: (1) extruding and moving an axis, (2) moving a hobby servo.

    One solution is multithreading. I saw that RRF supports FreeRTOS and have been looking through the documentation. I can't locate the Demo Projects -- can anyone send an example of what relevant files to load into the system libraries and an example script of how to do multithreading in a .g code.

    Another question: would it be possible to define the servo as a tool (using M508), and if so, can we define this tool in the same line as the extrusion/axis such that we can move both the servo, extrusion, and linear axis using the same G1 command?

    undefined undefined 2 Replies Last reply 23 Jun 2023, 14:56 Reply Quote 0
    • undefined
      ozgunkilicafsar @ozgunkilicafsar
      last edited by 23 Jun 2023, 14:56

      @ozgunkilicafsar @dc42 @jay_s_uk @droftarts would you be able to help?

      undefined 1 Reply Last reply 23 Jun 2023, 15:23 Reply Quote 0
      • undefined
        droftarts administrators @ozgunkilicafsar
        last edited by 23 Jun 2023, 15:23

        @ozgunkilicafsar I think you mean this: https://docs.duet3d.com/User_manual/RepRapFirmware/Multiple_motion_systems

        Have a read through, come back with any questions.

        Ian

        Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

        1 Reply Last reply Reply Quote 0
        • undefined
          droftarts administrators @ozgunkilicafsar
          last edited by 23 Jun 2023, 15:42

          @ozgunkilicafsar said in Multithreading:

          Another question: would it be possible to define the servo as a tool (using M508), and if so, can we define this tool in the same line as the extrusion/axis such that we can move both the servo, extrusion, and linear axis using the same G1 command?

          You can't set a servo as a extruder drive in a tool; the firmware expects the drive to be a stepper motor. Is it a continuously turning servo, or do you just need to turn it to specific positions? You might be able to create a dummy tool with M563 (not M508 - that doesn't seem to be a valid Gcode), defined with an unused stepper driver. Then use M571 https://docs.duet3d.com/en/User_manual/Reference/Gcodes#m571-set-output-on-extrude to control a PWM pin to control the servo. However, I don't think this gives the control over the servo that you are looking for; it's designed to turn on motors while extrusion is running, rather than position servos. So the PWM value is set by M571, and on extrude it would just move the servo to the same position each time. Or if it is a continuously turning servo, I guess it may act more like a motor and turn at a continuous speed.

          Ian

          Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

          1 Reply Last reply Reply Quote 0
          • undefined
            o_lampe
            last edited by o_lampe 24 Jun 2023, 07:04

            Multithreading is a bit overkill for driving only a servo. Have you thought of using macros instead?
            You can postprocess your printfile by replacing the retract/unretract lines (G10 and G11) with G10.1 and G11.1 respectively. Now you write two macros called G10.1 and G11.1 in which you set the required servo positions (and also trigger the real retract/unretract macros)

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