Rev 21 | Rev 23 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 21 | Rev 22 | ||
|---|---|---|---|
| Line 57... | Line 57... | ||
| 57 | // with a dwell angle of 45 degrees , 4 cylinders and a maximum RPM of 5000 |
57 | // with a dwell angle of 45 degrees , 4 cylinders and a maximum RPM of 5000 |
| 58 | // 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 . |
58 | // 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 . |
| 59 | // the TIM2 counter counts in 10uS increments, |
59 | // the TIM2 counter counts in 10uS increments, |
| 60 | #define BREAKER_MIN (RPM_COUNT_RATE/300) |
60 | #define BREAKER_MIN (RPM_COUNT_RATE/300) |
| 61 | 61 | ||
| - | 62 | // wait for about 1 second to decide whether or not starter is on |
|
| - | 63 | ||
| 62 | #define STARTER_LIMIT 5 |
64 | #define STARTER_LIMIT 10 |
| 63 | 65 | ||
| 64 | volatile char TimerFlag = 0; |
66 | volatile char TimerFlag = 0; |
| 65 | 67 | ||
| 66 | volatile char NoSerialInCTR = 0; // Missing characters coming in on USART1 |
68 | volatile char NoSerialInCTR = 0; // Missing characters coming in on USART1 |
| 67 | volatile char NoSerialIn = 0; |
69 | volatile char NoSerialIn = 0; |
| Line 237... | Line 239... | ||
| 237 | 239 | ||
| 238 | HAL_GPIO_WritePin(SPI_NS_Temp_GPIO_Port, Pin, GPIO_PIN_SET); |
240 | HAL_GPIO_WritePin(SPI_NS_Temp_GPIO_Port, Pin, GPIO_PIN_SET); |
| 239 | 241 | ||
| 240 | uint16_t obs = (buffer[0] << 8) | buffer[1]; |
242 | uint16_t obs = (buffer[0] << 8) | buffer[1]; |
| 241 | 243 | ||
| 242 | uint8_t good = (obs & 4) == 0; |
244 | // good observation if the status bit is clear, and the reading is less than 1023 |
| 243 | - | ||
| 244 | 245 | ||
| - | 246 | uint8_t good = ((obs & 4) == 0) && ((obs>>5)<1023); |
|
| 245 | 247 | ||
| 246 | if (good) |
248 | if (good) |
| 247 | { |
249 | { |
| 248 | CHT_Observations[instance] = obs >> 5; |
250 | CHT_Observations[instance] = obs >> 5; |
| 249 | } |
251 | } |