User Tools

Site Tools


common_code_v1

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
common_code_v1 [2016/08/26 12:51] – [Timer1] hakcentercommon_code_v1 [2016/08/26 12:51] – [Timer2] hakcenter
Line 336: Line 336:
 void keep_time() { void keep_time() {
   timer++;   timer++;
 +  // Startup Timer
 +  if (turbo_rpm < minimum_turbo_rpm) {
 +    if (startup > 249) { startup = 250; }
 +    startup++;
 +  }
   // Update vane_position every 10ms 100k+ / 25ms 60k - 100k / 100ms 0 - 60k   // Update vane_position every 10ms 100k+ / 25ms 60k - 100k / 100ms 0 - 60k
        if (timer % 10 == 0 && turbo_rpm > top_end_rpm) { update_vane_position = true; }        if (timer % 10 == 0 && turbo_rpm > top_end_rpm) { update_vane_position = true; }
Line 350: Line 355:
     if (turbo_rpm < top_end_rpm) { turbo_accel[2] = turbo_accel[1]; } else { turbo_accel[2] = turbo_accel[0]; }     if (turbo_rpm < top_end_rpm) { turbo_accel[2] = turbo_accel[1]; } else { turbo_accel[2] = turbo_accel[0]; }
   }   }
 +  // Read Serial Input
 +  if (timer % 10 == 0 && check_serial()) { read_serial(); }
 +  // Read CAN BUS
 +  if (timer % 25 == 0) { read_can_data(can_id, can_length); }
   // Modes   // Modes
   if (timer % 100 == 0 && turbo_rpm < top_end_rpm) { calculate_modes(); }   if (timer % 100 == 0 && turbo_rpm < top_end_rpm) { calculate_modes(); }
 +  // Sweep vane_position
 +  if (timer % 25 == 0 && sweep_position) { sweep(); }
   // Calculate vane_position   // Calculate vane_position
-  if (update_vane_position) {+  if (update_vane_position && !sweep_position) {
     update_vane_position = false;     update_vane_position = false;
     calculate_vane_position();     calculate_vane_position();
common_code_v1.txt · Last modified: 2016/08/26 12:52 by hakcenter