-
Notifications
You must be signed in to change notification settings - Fork 147
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
Question: mapping of pin-state values #139
Comments
These would never be anything but:
... But I wouldn't conflate those with "on" and "off" as you have. Consider cathod vs. anode: The signals will be inverted, so: on = LOW and off = HIGH. But back to the properties: there is no particular reason or benefit for them to exist on the instance, that's just how this was written back in 2011; now it amounts to a legacy design that remains in place to prevent breaking existing code. There's nothing particularly compelling about redefining them as class-side static properties, either. That would be a breaking change for no real benefit. We could define them as class-side properties and deprecate the instance properties (ie. redefine them in terms of descriptors that log a warning when accessed), but that might be too much nannying. |
First of all, thank you for easing my concern. And for suggesting that ON/OFF not be set in stone. It may be too much nannying, but my suggestion for the future of
Perhaps I'll take a stab at step (1) myself in the future. But feel free to close this if you feel appropriate because my question was answered. And thank you for that! |
Will firmata's
board.LOW
always map to0
andboard.HIGH
always map to1
?If not, that explains why it exists as a constant on the board itself. If so, however, I would suggest it be exported as a separate constant. Something like (pardon my ES6 syntax):
I ask because I'm using TypeScript and I've adapted a Firmata.d.ts definition file to use in my project and my coworker wants to treat this situation as an
enum
, but I'm nervous about the possibility of some other board I don't know about switching these values at some point. Any insight is appreciated.The text was updated successfully, but these errors were encountered: