[x] Updated function toDegreeCelsius() to contain the working logic to parse bytes to degrees Celsius. Returns NaN if both bytes are 255 (no external sensor). The device seems to return only multiples of 16 for the low byte, so 255 should never be returned for the low byte of a valid reading. Tested with TEMPer2, with and without external sensor connected.
[x] Added external temp to readTemperature() callback. This doesn't seem to break existing code that only uses the first returned value. Tested with TEMPer2, with and without external sensor connected.
[x] Close the USB device after reading the value in readTemperature().
[x] Added function toDegreeFahrenheit().
[x] Updated USB device filtering to work with all devices where vendorId==3141. Removed the product name filter, which is somewhat redundant and did not work with my TEMPer2_M12_V1.3 device.
[x] Added function toDegreeCelsius() [correct spelling of 'Celsius']. The previous function still exists, to support existing code. Recommend removing the misspelled function in a future version?
[x] Added function convertCelsiusToFahrenheit(), which is used internally and can be used externally also.
[x] Enhanced test.js to display internal and external temps for all attached devices. I only have one device right now, so haven't actually tested with multiple devices yet.
[x] Updated node-hid dependency to 0.5.1 (0.2.2 appears to depend on another package that is no longer available)
Changes:
toDegreeCelsius()
to contain the working logic to parse bytes to degrees Celsius. Returns NaN if both bytes are 255 (no external sensor). The device seems to return only multiples of 16 for the low byte, so 255 should never be returned for the low byte of a valid reading. Tested with TEMPer2, with and without external sensor connected.readTemperature()
callback. This doesn't seem to break existing code that only uses the first returned value. Tested with TEMPer2, with and without external sensor connected.readTemperature()
.toDegreeFahrenheit()
.vendorId==3141
. Removed the product name filter, which is somewhat redundant and did not work with my TEMPer2_M12_V1.3 device.toDegreeCelsius()
[correct spelling of 'Celsius']. The previous function still exists, to support existing code. Recommend removing the misspelled function in a future version?convertCelsiusToFahrenheit()
, which is used internally and can be used externally also.node-hid
dependency to 0.5.1 (0.2.2 appears to depend on another package that is no longer available)