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
Next revision
Previous revision
common_code_v1 [2016/08/26 12:51] – [Timer1] hakcentercommon_code_v1 [2016/08/26 12:52] (current) – [Timer1] hakcenter
Line 245: Line 245:
 ==== Timer1 ==== ==== Timer1 ====
 <code> <code>
-/* 
-  Copyright (c) 2014-2016, Curtis R Hacker 
-  All rights reserved. 
-  
-  This work is licensed under the 
-  Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. 
-  To view a copy of this license, 
-  visit http://creativecommons.org/licenses/by-nc-sa/4.0/. 
- */ 
- 
 void sweep() { void sweep() {
   if (turbo_feedback > 110) {   if (turbo_feedback > 110) {
Line 336: Line 326:
 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 345:
     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