-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/additional analog inputs #87
Conversation
} | ||
} else { | ||
let value = await hubs[0].getAnalogInput(channel); | ||
export async function analog(hub: ExpansionHub, channel: number, continuous: boolean) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I converted these methods from having an if check for whether to use a while (with annoying code duplication) into a while loop with a conditional break at the end (which is slightly less readable in my opinion). Between these two options, I prefer the second, but I'm open to alternatives. I could create a maybeWhile(continuous: boolean, block: () => void)
and use that.
hub.close(); | ||
}); | ||
|
||
program | ||
.command("servo <channel> <pulseWidth> [frameWidth]") | ||
.description("Run a servo with pulse width and optional frame width") | ||
.action(async (channel, pulseWidth, frameWidth) => { | ||
runOnSigint(async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved these because the hub wasn't semantically declared before this. It's very unlikely to cause any issues (unless we get a sigint before it finishes opening the hub).
Co-authored-by: Noah Andrews <[email protected]>
Depends on #84
Adds remaining analog inputs not added in #58