finding a bug

This commit is contained in:
Daniel Ledda
2020-10-31 16:36:15 +01:00
parent 2082ba3e4d
commit 17c26286f1

View File

@@ -104,9 +104,10 @@ func storeCycleCountsAsBinarySequence(cycles *[80]int) ([5]byte, error) {
for i := 0; i < 40; i++ { for i := 0; i < 40; i++ {
lowCycles := cycles[2 * i] lowCycles := cycles[2 * i]
highCycles := cycles[2 * i + 1] highCycles := cycles[2 * i + 1]
//if (lowCycles == Timeout) || (highCycles == Timeout) { if (lowCycles == Timeout) || (highCycles == Timeout) {
// return [5]byte{}, errors.New("timed out waiting for sensor pulse") fmt.Println(lowCycles, highCycles)
//} //return [5]byte{}, errors.New("timed out waiting for sensor pulse")
}
data[i / 8] <<= 1 data[i / 8] <<= 1
if highCycles > lowCycles { if highCycles > lowCycles {
data[i / 8] |= 1 data[i / 8] |= 1