Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
firmware: Fix bug in board revision detection
Previously we added a fixed value to the ADC reading before right-shifting. This corrected truncation error, allowing integer comparison values to match a whole percentage number in the table of expected ranges. This correction worked when gsg_production was true, but it was incorrect in the other case. We now do the math with per mille values rather than percent values, so it is simpler to eliminate the truncation correction and instead compare against an expected value between two whole percents. For example, we compare the per mille value with 225 to determine whether it is closer to 22 percent or 23 percent.
- Loading branch information