How to tell via API if DutyCycle is supported?

Comments & issues
derammo
Fresh meat
Posts: 3
Joined: Thu May 14, 2020 6:46 pm
Contact:

How to tell via API if DutyCycle is supported?

Postby derammo » Thu May 14, 2020 6:56 pm

I am writing a general interface for Phidgets22 to Helios 1.6 (virtual cockpit software.) So I am trying to support device classes in general without knowing ahead of time what devices the user may have.

Things are going well, but I ran into a problem: An InterfaceKit 8/8/8 reports that it has DigitalOutput. It also return MinDutyCycle = 0 and MaxDutyCycle = 1. However, it doesn't actually support DutyCycle I think, as it throws an exception if I set it to 0.1.

How am I supposed to know from the API that this is not supported? Is it a bug that MaxDutyCycle is set to 1 for devices that actually should just use "State" instead? I realize it supports the values 0 and 1, but it doesn't support any value in between :)

User avatar
Patrick
Lead Developer
Posts: 3197
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: How to tell via API if DutyCycle is supported?

Postby Patrick » Fri May 15, 2020 3:01 pm

You can use the ChannelSubclass Property. This will be None for regular digital outputs, and DigitalOutputDutyCycle for outputs supporting Duty Cycle.

-Patrick

derammo
Fresh meat
Posts: 3
Joined: Thu May 14, 2020 6:46 pm
Contact:

Re: How to tell via API if DutyCycle is supported?

Postby derammo » Fri May 15, 2020 6:07 pm

Thanks so much. I had actually structured my code to do something like that because your API is always logical. But then I screwed up my test case and thought it was always "None."

Thanks!


Return to “General”

Who is online

Users browsing this forum: fraser and 8 guests