Merge pull request #16 from tum-phoenix/hall-rev-phase

Fix Hallsensor reverse phase mapping
This commit is contained in:
Benjamin Vedder 2016-02-27 10:28:03 +01:00
commit 3e18879e10
1 changed files with 2 additions and 8 deletions

10
mcpwm.c
View File

@ -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];
}
}