mirror of https://github.com/rusefi/bldc.git
Merge pull request #16 from tum-phoenix/hall-rev-phase
Fix Hallsensor reverse phase mapping
This commit is contained in:
commit
3e18879e10
10
mcpwm.c
10
mcpwm.c
|
@ -494,7 +494,7 @@ void mcpwm_set_configuration(volatile mc_configuration *configuration) {
|
|||
* The commutations corresponding to the hall sensor states in the forward direction-
|
||||
*/
|
||||
void mcpwm_init_hall_table(int8_t *table) {
|
||||
const int fwd_to_rev[7] = {-1,4,3,2,1,6,5};
|
||||
const int fwd_to_rev[7] = {-1,1,6,5,4,3,2};
|
||||
|
||||
for (int i = 0;i < 8;i++) {
|
||||
hall_to_phase_table[8 + i] = table[i];
|
||||
|
@ -505,13 +505,7 @@ void mcpwm_init_hall_table(int8_t *table) {
|
|||
continue;
|
||||
}
|
||||
|
||||
ind_now += 2;
|
||||
if (ind_now > 6) {
|
||||
ind_now -= 6;
|
||||
}
|
||||
ind_now = fwd_to_rev[ind_now];
|
||||
|
||||
hall_to_phase_table[i] = ind_now;
|
||||
hall_to_phase_table[i] = fwd_to_rev[ind_now];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue