Description:
This pull request adds error checking to the code that parses the weight from the scales.
This may be an edge case, but it won't hurt to handle it correctly. In the event that strtof fails to parse a float out of the string, it will return 0 and without error checking, that could make OpenTrickler dispense powder when it shouldn't.
Changes:
Implemented error checking to the rest of the scale types to return NaN if strtof fails to decode the data.
Testing:
Only tested with JFDBS00058-100G model (which sends "+ ~~~~GN" in the case where the item is too heavy for it).
Confirmed error handling returns NaN on strtof failure.
Description: This pull request adds error checking to the code that parses the weight from the scales. This may be an edge case, but it won't hurt to handle it correctly. In the event that strtof fails to parse a float out of the string, it will return 0 and without error checking, that could make OpenTrickler dispense powder when it shouldn't.
Changes:
strtof
fails to decode the data.Testing:
~~~~GN" in the case where the item is too heavy for it).strtof
failure.