This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHXL-F28P55X: Disable one motor in the dual_axis project

Part Number: LAUNCHXL-F28P55X
Other Parts Discussed in Thread: BOOSTXL-3PHGANINV

Tool/software:

I am using LAUNCHXL-F28P55X with BOOSTXL-3PHGANINV and the project dual_axis_servo_drive_fcl_qep_f28p55x

In "dual_axis_servo_drive.c" declaring "motorVars[0]" and "motorVars[1]" the two motors are initialised:

I only have one motor, so I want to deactivate all the code concerning the second one.

Is it enough for me to comment on the second function?

Is there anything else I need to do?

..I don't want to waste resources by running portions of code in the background for an motor that I don't use

I also have another question:

Here I have to activate/deactivate something?

I see for instance a '_' before BOOSTXL-3PHGANINV, should it be removed?

Thanks

  • Hi,

    I only have one motor, so I want to deactivate all the code concerning the second one.

    Is it enough for me to comment on the second function?

    Is there anything else I need to do?

    To relieve all device resources I believe you'll need to make changes to the structs / handles used for the 2nd motor, so it's a little more involved. Removing the function calls is needed as well of course.

    Like changing below from a size 2 array to just a single struct (non-array) for single motor usage.

    HAL_MTR_Handle halMtrHandle[2];   //!< the handle for the hardware abstraction
                                      //!< layer to motor control
    HAL_MTR_Obj    halMtr[2];         //!< the hardware abstraction layer object
                                      //!< to motor control

    I see for instance a '_' before BOOSTXL-3PHGANINV, should it be removed?

    I don't see it used in the project, can do ctrl-h search for it to check.

    Best,

    Kevin

  • Thank you for your reply.

    So you mean:

    HAL_MTR_Handle halMtrHandle[1];   //!< the handle for the hardware abstraction
                                      //!< layer to motor control
    HAL_MTR_Obj    halMtr[1];         //!< the hardware abstraction layer object
                                      //!< to motor control

    And then remove functions like these:

    1) After all this, is there then a method/variable that indicates that motor two has been deactivated?

    2) In your opinion, does it make sense to do all this if I only want to use one motor? ..maybe the resources used by cpu, pwm etc. to drive the second motor (which isn't there) are derisory/insignificant ..however, consider that the driver and the engine will have to run for 8 hours

  • Hi, 

    Yes, that's what I meant but you technically don't need the [1] since it's no longer an array. If you build the project after making that change I think it should give errors which can indicate where you need to make changes.

    2) In your opinion, does it make sense to do all this if I only want to use one motor? ..maybe the resources used by cpu, pwm etc. to drive the second motor (which isn't there) are derisory/insignificant ..however, consider that the driver and the engine will have to run for 8 hours

    It depends on your application & needs. I think removing the unused things is good in case you need to add additional features.

    Best,

    Kevin