Skip to content

PwmControl.isPwmEnabled crashes #233

Closed

Description

@shelbyRobots

I am able to use a CRServoImplEx instance to use setPwmEnable/Disable.
However, isPwmEnabled crashes the app with the following:
E EventLoopManager: com.qualcomm.robotcore.exception.RobotCoreException: EventLoop Exception in loop(): IllegalArgumentException - invalid pwm channel: 4

Steps:
crsix.setPwmDisable();
...do other stuff...
if(crsix.setPwmDisable) crsix.setPwmDisable();

I was able to do a work around by keeping a local variable of pwm energize state when I call disable - to avoid calling enable on an already pwm energized port.

ServoControllerEx with port number parameter seemed to give same results.

Activity

  1. Windwoes commented on Nov 13, 2021

    @Windwoes
    Member

    Looks to be a bug in the LynxGetServoEnableCommand constructor...

    It reads

        public LynxGetServoEnableCommand(LynxModuleIntf module, int channelZ)
            {
            this(module);
            LynxConstants.validatePwmChannelZ(channelZ);
            this.channel = (byte)channelZ;
            }

    But it should be

        public LynxGetServoEnableCommand(LynxModuleIntf module, int channelZ)
            {
            this(module);
            LynxConstants.validateServoChannelZ(channelZ);
            this.channel = (byte)channelZ;
            }
  2. Windwoes commented on Dec 21, 2021

    @Windwoes
    Member

    This will be fixed in the next release of the SDK.

  3. Windwoes commented on Jan 17, 2022

    @Windwoes
    Member

    Fixed in 7.1

  4. added a commit that references this issue on Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions