Rev 21 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 21 | Rev 23 | ||
---|---|---|---|
Line 76... | Line 76... | ||
76 | /// @brief compensated temperature |
76 | /// @brief compensated temperature |
77 | int32_t compensatedTemperature = -10000; |
77 | int32_t compensatedTemperature = -10000; |
78 | 78 | ||
79 | int32_t timing = 0; |
79 | int32_t timing = 0; |
80 | 80 | ||
81 | // 6 degrees error in timing wheel this time .. |
81 | // 1.5 degrees error in timing wheel this time .. |
82 | int const TIMING_OFFSET = -6 * TIMING_SCALE; |
82 | int const TIMING_OFFSET = (( -15) * TIMING_SCALE) /10; |
83 | 83 | ||
84 | // Switch over to double sparking |
84 | // Switch over to doubDARK_RPM = 1200; |
85 | int const DOUBLE_SPARK_RPM = 1200; |
- | |
86 | // default atmospheric pressure - should be 1014 |
85 | // default atmospheric pressure - should be 1014 |
87 | uint32_t const DEFAULT_ATMOSPHERIC_PRESSURE = 1014 * 100; |
86 | uint32_t const DEFAULT_ATMOSPHERIC_PRESSURE = 1014 * 100; |
88 | 87 | ||
89 | uint32_t const DEFAULT_ATMOSPHERIC_TEMPERATURE = 25 * 100; |
88 | uint32_t const DEFAULT_ATMOSPHERIC_TEMPERATURE = 25 * 100; |
90 | 89 | ||
Line 328... | Line 327... | ||
328 | { |
327 | { |
329 | cc_feed_rpm(rpm); |
328 | cc_feed_rpm(rpm); |
330 | // compute timing value, feed to display |
329 | // compute timing value, feed to display |
331 | timing = mapTiming(rpm, vacuum / 100); |
330 | timing = mapTiming(rpm, vacuum / 100); |
332 | cc_feed_timing(timing); |
331 | cc_feed_timing(timing); |
333 | // enable double spark below 1200 rpm |
332 | // enable double spark below 1200 (DUAL_SPARK_RPM) rpm |
334 | int microsecs = mapTimingToMicroseconds(timing + TIMING_OFFSET, rpm < DOUBLE_SPARK_RPM); |
333 | int microsecs = mapTimingToMicroseconds(timing + TIMING_OFFSET, rpm < DUAL_SPARK_RPM); |
335 | __HAL_TIM_SET_AUTORELOAD(&htim1, microsecs + SAW_DELAY); |
334 | __HAL_TIM_SET_AUTORELOAD(&htim1, microsecs + SAW_DELAY); |
336 | } |
335 | } |
337 | } |
336 | } |
338 | 337 | ||
339 | // Handle PLX |
338 | // Handle PLX |