Ran the following command:
golint -min_confidence 0 ./... | grep -v ALL_CAPS | \
grep -v underscores | grep -v 'another file'
and fixed the comments that made sense.
- Converting the alert registers and the ambient temp register to a
physic.Temperature can use the same procedure. Unify them and document
why this is possible.
- Use != instead of > for bit checks
- Inline bitsToTemperature calls in SenseWithAlerts
The datasheet (http://ww1.microchip.com/downloads/en/DeviceDoc/25095A.pdf)
says that negative temperatures are stored in two's complement. See
page 22 for alert registers and pages 24-25 for the ambient temperature
register.
However, the code currently assumes negative values are stored in a
sign-and-magnitude representation. Fix this to handle two's complement
values correctly.
For register bits to temperature conversion this implementation follows
the datasheet, but the code in the datasheet isn't quite right -- it
should be `temp - 256` instead of `256 - temp` -- but the fact that the
256 figure is in Microchip's code backs up the idea stated in the text
that negative values are in two's complement. Others seem to agree that
this is correct: https://electronics.stackexchange.com/a/244826
For temperature to bits conversion this implementation relies on the
fact that Go also uses two's complement. I've added a long comment in
the code about this.
Add internal context.context
Fixes some fragile time based tests.
Halt() is now synchronous, will only return if the context has been cancelled.
Remove go routine leak in New().
Fix spelling.
- Improve rounding and add unit tests to confirm.
- Period() is the same function than Duration() but better describes what
is returned.
- Fix support for negative value.
- Upgrade all call sites inside periph.
- Fix Frequency documentation that incorrectly stated it's an int32,
it's in fact an int64.
- Duration() will be removed in v4.0.0 as part of issue #379.
This causes a few breaking changes in experimental code:
- hx711.TimeoutError was renamed to ErrTimeout
- unicornhd.NewUnicornhd() was stuttering and was renamed to New()
- Remove Strip, now unnecessary.
- Rename New() to NewStream().
- Merge SPIDev into Dev.
- Rename all unit tests.
- Unexport ToRGB(), this was in a unit test.
- Increase test coverage to 93.8%.
- Fix package documentation.
- Switch the main code to use a lookup array (and not slices!).
- Add unit test to test the lookup table against the algorithm.
- currentLSB is supposed to be Maximum Expected Current / 2^15
2 << 15 is 2^16, not 2^15.
- fix rounding error in powerLSB calculation
- check for overflow in calibration
- fix doc
- Merge PinForDifferenceOfChannels into PinForChannel.
- Make Channel a type.
- Rename ads1x15AnalogPin to analogPin, it was stuttering.
- Shorten few argument names.
- Remove one memory allocation in analogPin.
- Add a minimalistic unit test.
- Reduce (but to not eliminate yet) usage of fmt.
- Tweak documentation to optimize godoc output.
No functional change.
- Move private globals at the bottom of the file.
- Move ads1x15AnalogPin close to its methods.
- Stop using named return variable.
- Inline newADS1x15.
- Move gainConfig and gainVoltage as global variables.
- Wraps comments.
- Rename mutex to mu.
- Use -math.MaxInt16 instead of math.MinInt16 because of the voltage multiplier.
- Change error strings to start with a lower case.
Refactor to remove context.Context
Remove usage of t.Run.
Adds test case for Sense for 100% coverage
Removed signal.Notify's as signals do not always get delivered.
Fix documentation copy paste error.
Add Band stringer test.
Add Spectrum stringer test
Add Gain stringer test.
Add Gain stringer.
Add Spectrum stringer.
Add Band stringer.
Add check for gain value.
Add more test for Halt() conditions.
Move done channel creation within cancel mutex.