Subversion Repositories EngineBay2

Rev

Rev 31 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 31 Rev 32
Line 56... Line 56...
56
 
56
 
57
/* USER CODE BEGIN PV */
57
/* USER CODE BEGIN PV */
58
/* Private variables ---------------------------------------------------------*/
58
/* Private variables ---------------------------------------------------------*/
59
 
59
 
60
// with a dwell angle of 45 degrees , 4 cylinders and a maximum RPM of 5000
60
// with a dwell angle of 45 degrees , 4 cylinders and a maximum RPM of 5000
61
// freq = 5000/60 * 2 = 166Hz. Because the breaker might bounce , we accept the first pulse longer than 1/300 of a second as being a proper closure .
61
// freq = 5000/60 * 2 = 166Hz.
62
// the TIM2 counter counts in 10uS increments,
62
// the TIM2 counter counts in 10uS increments,
63
// TODO this is wrong algo. Accept FIRST pulse, skip shorter pulses
63
// TODO this is wrong algo. Accept FIRST pulse, skip shorter pulses
-
 
64
// Accept the first pulse with over 1mS duration as the closure
64
#define BREAKER_MIN (RPM_COUNT_RATE/300)
65
#define BREAKER_MIN (RPM_COUNT_RATE/1000)
65
 
66
 
66
#define RPM_AVERAGE 4
67
#define RPM_AVERAGE 4
67
 
68
 
68
// wait for about 1 second to decide whether or not starter is on
69
// wait for about 1 second to decide whether or not starter is on
69
 
70