Rev 6 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6 | Rev 7 | ||
---|---|---|---|
Line 9... | Line 9... | ||
9 | 9 | ||
10 | unsigned constexpr MAX_TIMING_POINTS = 8; |
10 | unsigned constexpr MAX_TIMING_POINTS = 8; |
11 | unsigned constexpr MAX_VACUUM_POINTS = 8; |
11 | unsigned constexpr MAX_VACUUM_POINTS = 8; |
12 | unsigned constexpr TimingScale = TIMING_SCALE; |
12 | unsigned constexpr TimingScale = TIMING_SCALE; |
13 | 13 | ||
14 | int16_t rpmMap[MAX_TIMING_POINTS] = {500, 750, 1000, 1500, 2500, 3500, 4500, 6000}; |
14 | int16_t rpmMap[MAX_TIMING_POINTS] = {400, 750, 1000, 1500, 2500, 3500, 4500, 6000}; |
15 | int16_t vacuumMap[MAX_VACUUM_POINTS] = {0, 166, 225, 300, 700, (int16_t)-1,(int16_t) -1, (int16_t)-1}; |
15 | int16_t vacuumMap[MAX_VACUUM_POINTS] = {0, 166, 225, 300, 700, (int16_t)-1,(int16_t) -1, (int16_t)-1}; |
16 | uint8_t mapping[MAX_VACUUM_POINTS][MAX_TIMING_POINTS] = { |
16 | uint8_t mapping[MAX_VACUUM_POINTS][MAX_TIMING_POINTS] = { |
17 | /* Table in degrees. */ |
17 | /* Table in degrees. */ |
18 | /* row for 0mb = centrifugal only */ |
18 | /* row for 0mb = centrifugal only */ |
19 | {3, 0, 0, 12, 18, 22, 22, 15}, |
19 | {12, 7, 7, 19, 25, 29, 29, 22}, |
20 | /* row for 166 mB*/ |
20 | /* row for 166 mB*/ |
21 | {3, 0, 0, 14, 20, 24, 24, 17}, |
21 | {12, 7, 7, 21, 27, 31, 31, 24}, |
22 | /* row for 225 mB */ |
22 | /* row for 225 mB */ |
23 | {3, 0, 0, 18, 24, 28, 28, 21}, |
23 | {12, 7, 7, 25, 31, 35, 35, 28}, |
24 | /* row for 300 mB*/ |
24 | /* row for 300 mB*/ |
25 | {3, 0, 0, 22, 28, 32, 32, 25}, |
25 | {12, 7, 7, 29, 35, 39, 39, 33}, |
26 | /* row for 700 mB*/ |
26 | /* row for 700 mB*/ |
27 | {3, 0, 0, 22, 28, 32, 32, 25}, |
27 | {12, 7, 7, 29, 35, 39, 39, 33}, |
28 | /* unused */ |
28 | /* unused */ |
29 | {0, 0, 0, 0, 0, 0, 0, 0}, |
29 | {0, 0, 0, 0, 0, 0, 0, 0}, |
30 | /* unused */ |
30 | /* unused */ |
31 | {0, 0, 0, 0, 0, 0, 0, 0}, |
31 | {0, 0, 0, 0, 0, 0, 0, 0}, |
32 | /* unused */ |
32 | /* unused */ |
33 | {0, 0, 0, 0, 0, 0, 0, 0}}; |
33 | {0, 0, 0, 0, 0, 0, 0, 0}}; |
34 | 34 | ||
35 | // basic timing |
35 | |
36 | const int baseTiming = 7 * TimingScale; |
- | |
37 | }; |
36 | }; |
38 | 37 | ||
39 | /// @brief Lookup a point using linear interpolation |
38 | /// @brief Lookup a point using linear interpolation |
40 | /// @param point value to lookup |
39 | /// @param point value to lookup |
41 | /// @param curve data point list |
40 | /// @param curve data point list |
Line 117... | Line 116... | ||
117 | int advance = top_advance * (INTERP_SCALE - vacuum_frac) + bottom_advance * vacuum_frac; |
116 | int advance = top_advance * (INTERP_SCALE - vacuum_frac) + bottom_advance * vacuum_frac; |
118 | /* point is scaled by two multiplications */ |
117 | /* point is scaled by two multiplications */ |
119 | angle = advance * TimingScale / (INTERP_SCALE * INTERP_SCALE); |
118 | angle = advance * TimingScale / (INTERP_SCALE * INTERP_SCALE); |
120 | } |
119 | } |
121 | 120 | ||
122 | angle += baseTiming; |
- | |
123 | - | ||
124 | - | ||
125 | assert((angle >= TimingScale * 7) && (angle < TimingScale * 50 )); |
121 | assert((angle >= TimingScale * 7) && (angle < TimingScale * 50 )); |
126 | return angle; |
122 | return angle; |
127 | } |
123 | } |
128 | } |
124 | } |
129 | 125 |