Skip to content

Commit

Permalink
Fix error count condition
Browse files Browse the repository at this point in the history
  • Loading branch information
at-wat committed Jul 25, 2024
1 parent 605268c commit eebd8b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tfrog-motordriver/controlPWM.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ void FIQ_PWMPeriod()
(hall[i] & 0x07) == 0)
{
// Stop motor control if static hall signal error is continued for more than 3 PWM cycle interrups.
if (driver_state.error.hall[i] < 12)
if (driver_state.error.hall[i] <= 12)
{
driver_state.error.hall[i] += 6;
}
Expand All @@ -450,7 +450,7 @@ void FIQ_PWMPeriod()
if (halldiff == 3 || halldiff >= 5)
{
// Skip next one error to avoid counting another edge of this error.
if (driver_state.error.hall[i] < 12)
if (driver_state.error.hall[i] <= 12)
{
driver_state.error.hall[i] += 12;
}
Expand Down

0 comments on commit eebd8b8

Please sign in to comment.