Skip to content
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

Merged
merged 7 commits into from
Jun 28, 2023

Conversation

LandryNorris
Copy link
Contributor

Depends on #84

Adds remaining analog inputs not added in #58

}
} else {
let value = await hubs[0].getAnalogInput(channel);
export async function analog(hub: ExpansionHub, channel: number, continuous: boolean) {
Copy link
Contributor Author

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 () => {
Copy link
Contributor Author

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).

packages/sample/src/main.ts Outdated Show resolved Hide resolved
Co-authored-by: Noah Andrews <[email protected]>
@LandryNorris LandryNorris merged commit fda04db into main Jun 28, 2023
@LandryNorris LandryNorris deleted the feature/additional-analog-inputs branch June 28, 2023 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants