-
Notifications
You must be signed in to change notification settings - Fork 31
Add optional precision kwarg for formatting floating point data #13
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
Conversation
Update examples for PyPortal board., default examples to pyportal
Update branch
Updated examples to reflect neopixel abstraction
@jerryneedell I think this is OK for now as far as formatting, but would be open to other ideas. |
just setting up a test |
I modified the "data" simpletest to this
and I get this error on my ItsyBitsy_M4
|
fixed -- the data value cannot be an "int" must be float. It does not make sense to "round" an int anyway but will this cause any unexpected errors? |
Thanks for the catch for |
Added a check for incorrect data types, throwing an error. |
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.
There may be some corner cases where using precision catches a user sending an integer value but I think the warning will make it clear what happened,
Added
precision
kwarg tosend_data
to truncate floating point values to a specifiedprecision
decimal places before the payload is created and sent to Adafruit IO.Addresses #12
Tested with PyPortal