Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to not use polling mode at low rpm #142

Merged
merged 1 commit into from
Dec 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -812,9 +812,11 @@ void commutate()
}
__enable_irq();
changeCompInput();
// if (average_interval > 2500) {
// old_routine = 1;
// }
#ifndef NO_POLLING_START
if (average_interval > 2500) {
old_routine = 1;
}
#endif
bemfcounter = 0;
zcfound = 0;
commutation_intervals[step - 1] = commutation_interval; // just used to calulate average
Expand Down Expand Up @@ -1499,17 +1501,24 @@ void zcfoundroutine()
bad_count = 0;

zero_crosses++;
#ifdef NO_POLLING_START // changes to interrupt mode after 30 zero crosses, does not re-enter
if (zero_crosses > 30) {
old_routine = 0;
enableCompInterrupts(); // enable interrupt
}
#else
if (eepromBuffer.stall_protection || eepromBuffer.rc_car_reverse) {
if (zero_crosses >= 20 && commutation_interval <= 2000) {
old_routine = 0;
enableCompInterrupts(); // enable interrupt
}
} else {
if (zero_crosses > 30) {
if (commutation_interval < 2000) {
old_routine = 0;
enableCompInterrupts(); // enable interrupt
}
}
#endif
}
#ifdef BRUSHED_MODE
void runBrushedLoop()
Expand Down
Loading