File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -812,9 +812,11 @@ void commutate()
812
812
}
813
813
__enable_irq ();
814
814
changeCompInput ();
815
- // if (average_interval > 2500) {
816
- // old_routine = 1;
817
- // }
815
+ #ifndef NO_POLLING_START
816
+ if (average_interval > 2500 ) {
817
+ old_routine = 1 ;
818
+ }
819
+ #endif
818
820
bemfcounter = 0 ;
819
821
zcfound = 0 ;
820
822
commutation_intervals [step - 1 ] = commutation_interval ; // just used to calulate average
@@ -1499,17 +1501,24 @@ void zcfoundroutine()
1499
1501
bad_count = 0 ;
1500
1502
1501
1503
zero_crosses ++ ;
1504
+ #ifdef NO_POLLING_START // changes to interrupt mode after 30 zero crosses, does not re-enter
1505
+ if (zero_crosses > 30 ) {
1506
+ old_routine = 0 ;
1507
+ enableCompInterrupts (); // enable interrupt
1508
+ }
1509
+ #else
1502
1510
if (eepromBuffer .stall_protection || eepromBuffer .rc_car_reverse ) {
1503
1511
if (zero_crosses >= 20 && commutation_interval <= 2000 ) {
1504
1512
old_routine = 0 ;
1505
1513
enableCompInterrupts (); // enable interrupt
1506
1514
}
1507
1515
} else {
1508
- if (zero_crosses > 30 ) {
1516
+ if (commutation_interval < 2000 ) {
1509
1517
old_routine = 0 ;
1510
1518
enableCompInterrupts (); // enable interrupt
1511
1519
}
1512
1520
}
1521
+ #endif
1513
1522
}
1514
1523
#ifdef BRUSHED_MODE
1515
1524
void runBrushedLoop ()
You can’t perform that action at this time.
0 commit comments