bristlemouth / bm_protocol

Primary Bristlemouth firmware repository
https://www.bristlemouth.org/
Apache License 2.0
12 stars 8 forks source link

fix: too many power monitor retries #105

Closed towynlin closed 8 months ago

towynlin commented 8 months ago

I was debugging on a potted RBR module with a broken power monitor, and saw this:

1709846009.769 142da2ea9eccbe3c, --zz-- sensor sampler polling 1 sensors
1709846009.921 142da2ea9eccbe3c, --zz-- powerSample measurePower on device 0, success 0, retries remaining 3
1709846010.074 142da2ea9eccbe3c, --zz-- powerSample measurePower on device 0, success 0, retries remaining 2
1709846010.226 142da2ea9eccbe3c, --zz-- powerSample measurePower on device 0, success 0, retries remaining 1
1709846010.375 142da2ea9eccbe3c, --zz-- powerSample measurePower on device 1, success 0, retries remaining 0
1709846010.527 142da2ea9eccbe3c, --zz-- powerSample measurePower on device 1, success 0, retries remaining 255
1709846010.679 142da2ea9eccbe3c, --zz-- powerSample measurePower on device 1, success 0, retries remaining 254
1709846010.828 142da2ea9eccbe3c, --zz-- powerSample measurePower on device 1, success 0, retries remaining 253
1709846010.980 142da2ea9eccbe3c, --zz-- powerSample measurePower on device 1, success 0, retries remaining 252
1709846011.132 142da2ea9eccbe3c, --zz-- powerSample measurePower on device 1, success 0, retries remaining 251
1709846011.281 142da2ea9eccbe3c, --zz-- powerSample measurePower on device 1, success 0, retries remaining 250
1709846011.433 142da2ea9eccbe3c, --zz-- powerSample measurePower on device 1, success 0, retries remaining 249
1709846011.585 142da2ea9eccbe3c, --zz-- powerSample measurePower on device 1, success 0, retries remaining 248
1709846011.734 142da2ea9eccbe3c, --zz-- powerSample measurePower on device 1, success 0, retries remaining 247

In the case when we have complete failure of the I2C bus, we were never resetting the number of retries, so the first power monitor got 3 retries as intended, then the second one got 255.