User Tools

Site Tools


common_code_v2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
common_code_v2 [2018/07/02 13:08] – [Idle] hakcentercommon_code_v2 [2018/07/02 13:28] (current) – [Variables] hakcenter
Line 8: Line 8:
 ==== Variables ==== ==== Variables ====
 **Debug Serial Messages** **Debug Serial Messages**
-\\ ''<fc #4682b4>const boolean</fc> serial_out = **true;**'' **-- enables serial output**+\\ ''<fc #4682b4>boolean</fc> emulate <fc #ff0000>**false**</fc>;'' -- Toggles turbo eumulation 
 +\\ ''<fc #4682b4>boolean</fc> serial_reading = <fc #ff0000>**false**</fc>;'' --true when reading Serial 
 +\\ ''<fc #4682b4>boolean</fc> serial_out = <fc #ff0000>**true**</fc>;'' -- Toggles serial output
  
 **Startup** **Startup**
Line 30: Line 32:
 \\ ''<fc #4682b4>boolean</fc> performance_mode = false;'' **-- performance toggle** \\ ''<fc #4682b4>boolean</fc> performance_mode = false;'' **-- performance toggle**
 \\ ''<fc #4682b4>boolean</fc> deceleration_mode = false;'' **-- triggered for anti-surge** \\ ''<fc #4682b4>boolean</fc> deceleration_mode = false;'' **-- triggered for anti-surge**
 +
 +**Boost Mode**
 +\\ ''<fc #4682b4>boolean</fc> boost_enable = **<fc #00ff00>true</fc>**;'' -- Enables boost mode
 +\\ ''<fc #4682b4>boolean</fc> boost_mode = **<fc #ff0000>false</fc>**;'' -- boost mode toggle
 +\\ ''<fc #4682b4>int</fc> boost_timer = <fc #ff0000>0</fc>;'' -- boost time
 +\\ ''<fc #4682b4>byte</fc> boost_position = <fc #ff0000>0</fc>;'' -- boosted position
  
 **Minimum and Maximum Vane Positions** **Minimum and Maximum Vane Positions**
Line 36: Line 44:
  
 **Vane Positions** **Vane Positions**
-\\ ''<fc #4682b4>const unsigned int</fc> idle_position = **<fc #008000>480</fc>**;'' -- position used when turbo is at idle stage +\\ ''<fc #4682b4>const unsigned int</fc> idle_position = **<fc #008000>40</fc>**;'' -- position used when turbo is at idle stage 
-\\ ''<fc #4682b4>const unsigned int</fc> cruise_position = **<fc #008000>600</fc>**;'' -- position used when cruise mode is toggled+\\ ''<fc #4682b4>const unsigned int</fc> cruise_position = **<fc #008000>500</fc>**;'' -- position used when cruise mode is toggled
 \\ ''<fc #4682b4>const unsigned int</fc> deceleration_position = **<fc #ffa500>500</fc>**;'' -- position used when deceleration mode is toggled \\ ''<fc #4682b4>const unsigned int</fc> deceleration_position = **<fc #ffa500>500</fc>**;'' -- position used when deceleration mode is toggled
-\\ ''<fc #4682b4>unsigned int</fc> vane_position = 0;'' **-- calculated vane position**+\\ ''<fc #4682b4>unsigned int</fc> vane_position = 40;'' **-- calculated vane position**
 \\ ''<fc #4682b4>unsigned int</fc> last_vane_position = 0;'' **-- vane position 2ms ago** \\ ''<fc #4682b4>unsigned int</fc> last_vane_position = 0;'' **-- vane position 2ms ago**
 \\ ''<fc #4682b4>unsigned int</fc> final_vane_position = 0;'' **-- position used when sending vane position** \\ ''<fc #4682b4>unsigned int</fc> final_vane_position = 0;'' **-- position used when sending vane position**
Line 50: Line 58:
 **Turbo Idle** **Turbo Idle**
 \\ ''<fc #4682b4>long</fc> idle_rpm = <fc #ffa500>**11000**</fc>;'' -- under this value turbo is idling \\ ''<fc #4682b4>long</fc> idle_rpm = <fc #ffa500>**11000**</fc>;'' -- under this value turbo is idling
-\\ ''<fc #4682b4>long</fc> idle_walkdown_rpm = <fc #ffa500>**11000**</fc>;'' -- once turbo_rpm reaches this, start walkdown process+\\ ''<fc #4682b4>long</fc> idle_walkdown_rpm = <fc #ffa500>**20000**</fc>;'' -- once turbo_rpm reaches this, start walkdown process
  
 **Turbo Factors** **Turbo Factors**
Line 66: Line 74:
 \\ ''<fc #4682b4>const unsigned int</fc> turbo_curve_2[5] = { <fc #ffa500>**780,740,700,660,620**</fc> };'' \\ ''<fc #4682b4>const unsigned int</fc> turbo_curve_2[5] = { <fc #ffa500>**780,740,700,660,620**</fc> };''
 \\ ''<fc #4682b4>const unsigned int</fc> turbo_curve_3[5] = { <fc #ffa500>**800,760,720,680,640**</fc> };'' \\ ''<fc #4682b4>const unsigned int</fc> turbo_curve_3[5] = { <fc #ffa500>**800,760,720,680,640**</fc> };''
-\\ ''<fc #4682b4>const unsigned int</fc> turbo_curve_4[5] = { <fc #ffa500>**820,780,740,700,660**</fc> };''+\\ ''<fc #4682b4>const unsigned int</fc> turbo_curve_4[5] = { <fc #ffa500>**800,760,780,740,720**</fc> };''
  
 **Turbo Variables** **Turbo Variables**
-\\ ''<fc #4682b4>unsigned int</fc> minimum_turbo_rpm = <fc #ffa500>**1000**</fc>;'' **-- minimum required turbo rpm for pretty much everything** +\\ ''<fc #4682b4>const int</fc> minimum_turbo_rpm = <fc #ffa500>**1000**</fc>;'' **-- minimum required turbo rpm for pretty much everything** 
-\\ ''<fc #4682b4>long</fc> turbo_rpm = 0;'' -- current turbo rpm +\\ ''<fc #4682b4>volatile long</fc> turbo_rpm = 0;'' -- current turbo rpm 
-\\ ''<fc #4682b4>long</fc> last_turbo_rpm[2] 0,0 };'' -- turbo rpm 10ms & 100ms ago +\\ ''<fc #4682b4>long</fc> last_turbo_rpm = 0;'' -- turbo rpm 10ms & 100ms ago 
-\\ ''<fc #4682b4>int</fc> turbo_accel[3] { 0,0,};'' **-- turbo acceleration variable**+\\ ''<fc #4682b4>int</fc> turbo_accel = 0;'' **-- turbo acceleration variable**
  
 **CANBUS Variables** **CANBUS Variables**
Line 101: Line 109:
 The acceleration variable, is computed at 100ms and 10ms, and it represents the turbo rpm acceleration rate in, rpm per ms. The acceleration variable, is computed at 100ms and 10ms, and it represents the turbo rpm acceleration rate in, rpm per ms.
 <code> <code>
-  // Update turbo_accel before calculating vane_position +    //---- Calculate turbo_accel ----/
-  if (timer % 10 == 0) { +    turbo_accel = (int) (turbo_rpm - last_turbo_rpm) / 100.0f; 
-    turbo_accel[0] = (int) (turbo_rpm last_turbo_rpm[0]) 10.0f; +    last_turbo_rpm = turbo_rpm;
-    last_turbo_rpm[0] = turbo_rpm; +
-    if (timer % 100 == 0) { +
-      turbo_accel[1] = (int) (turbo_rpm - last_turbo_rpm[1]) / 100.0f; +
-      last_turbo_rpm[1] = turbo_rpm; +
-    } +
-    if (turbo_rpm < top_end_rpm) { turbo_accel[2] = turbo_accel[1]; } else { turbo_accel[2] = turbo_accel[0];+
-  }+
 </code> </code>
-\\ **<fc #6495ed>last_turbo_rpm[0]</fc>** is updated every 10ms +\\ **<fc #6495ed>last_turbo_rpm</fc>** is updated every 100ms
-\\ **<fc #6495ed>last_turbo_rpm[1]</fc>** is updated every 100ms+
 ---- ----
 ==== Idle ==== ==== Idle ====
common_code_v2.txt · Last modified: 2018/07/02 13:28 by hakcenter