common_code_v2
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
common_code_v2 [2018/07/02 12:31] – [Cruise] hakcenter | common_code_v2 [2018/07/02 13:08] – [Idle] hakcenter | ||
---|---|---|---|
Line 127: | Line 127: | ||
idle_mode = false; | idle_mode = false; | ||
} | } | ||
- | if (turbo_accel[2] <= 2) { vane_position = idle_position; } else { vane_position = turbo_curve[0]; | + | if (turbo_accel <= 2) { |
+ | idle_counter++; | ||
+ | | ||
+ | idle_counter = 0; | ||
+ | | ||
+ | } | ||
+ | if (idle_counter > 1) { | ||
+ | idle_counter = 2; | ||
+ | vane_position = idle_position; | ||
+ | | ||
} else { | } else { | ||
// ----- | // ----- | ||
// Curve section | // Curve section | ||
if (turbo_rpm < idle_walkdown_rpm) { | if (turbo_rpm < idle_walkdown_rpm) { | ||
- | if (turbo_accel[2] <= 2) { | + | if (turbo_accel <= 2) { |
if (last_vane_position >= min_position + half_cm) { | if (last_vane_position >= min_position + half_cm) { | ||
| | ||
Line 147: | Line 156: | ||
else if (turbo_rpm <= curve_rpm[3]) { vane_position = map(turbo_rpm, | else if (turbo_rpm <= curve_rpm[3]) { vane_position = map(turbo_rpm, | ||
else { vane_position = map(turbo_rpm, | else { vane_position = map(turbo_rpm, | ||
- | if (turbo_accel[2] > 2) { idle_walkdown_mode = false; | + | if (turbo_accel > 2) { idle_walkdown_mode = false; } |
- | | + | |
</ | </ | ||
---- | ---- | ||
Line 160: | Line 168: | ||
if (port_d & SWITCH_PERFORMANCE) { performance_mode = false; } else { performance_mode = true; } | if (port_d & SWITCH_PERFORMANCE) { performance_mode = false; } else { performance_mode = true; } | ||
if (port_d & SWITCH_BRAKE) { brake_mode = false; } else { brake_mode = true; } | if (port_d & SWITCH_BRAKE) { brake_mode = false; } else { brake_mode = true; } | ||
+ | // if (digitalRead(SPARE_PIN) == LOW) { | ||
+ | // spare_value = 0; | ||
+ | // spare_mode = true; | ||
+ | // } else { | ||
+ | // spare_value = 1; | ||
+ | // spare_mode = false; | ||
+ | // } | ||
// Update current_mode | // Update current_mode | ||
current_mode = 2; | current_mode = 2; | ||
+ | if (boost_mode) { current_mode = 3; } | ||
if (idle_mode) { current_mode = 0; } | if (idle_mode) { current_mode = 0; } | ||
if (idle_walkdown_mode) { current_mode = 1; } | if (idle_walkdown_mode) { current_mode = 1; } | ||
- | if (cruise_mode) { current_mode = 5; } | + | if (cruise_mode) { current_mode = 6; } |
- | if (performance_mode) { current_mode = 6; } | + | if (performance_mode) { current_mode = 7; } |
- | if (brake_mode) { current_mode = 4; } | + | if (brake_mode) { current_mode = 5; } |
- | if (spare_mode) { current_mode = 3; } | + | if (spare_mode) { current_mode = 4; } |
// -- CRUISE MODE -- // | // -- CRUISE MODE -- // | ||
if (cruise_mode && !brake_mode && !performance_mode) { cruise(); } | if (cruise_mode && !brake_mode && !performance_mode) { cruise(); } |
common_code_v2.txt · Last modified: 2018/07/02 13:28 by hakcenter