Added comment to hall polarity detection function

This commit is contained in:
PAJohnson
2020-12-01 19:48:09 -05:00
parent 7afa99447c
commit ee06628e4c
+4
View File
@@ -233,6 +233,10 @@ bool Encoder::run_hall_polarity_calibration() {
return false;
}
// Hall effect sensors can be arranged at 60 or 120 electrical degrees.
// Out of 8 possible states, 120 and 60 deg arrangements each miss 2 states.
// ODrive assumes 120 deg separation - if a 60 deg setup is used, it can
// be converted to 120 deg states by flipping the polarity of one sensor.
uint8_t states = state_seen.to_ulong();
uint8_t hall_polarity = 0;
auto flip_detect = [](uint8_t states, unsigned int idx)->bool {