From 8c08af245805f23e2c32dd79396df68584e47ba2 Mon Sep 17 00:00:00 2001 From: Steve Howes Date: Fri, 14 Sep 2018 20:39:35 +0100 Subject: [PATCH] Add rpm based dwell (as well as data for voltage based dwell) --- cas.ino | 4 ++-- tables.h | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/cas.ino b/cas.ino index 5186796..d1e2665 100644 --- a/cas.ino +++ b/cas.ino @@ -72,11 +72,11 @@ void cas_process() if((cylinder_next_fire == 1) || (cylinder_next_fire == 4)) { task_coil1_fire = micros() + (usec_per_degree * (180 + ignition_offset - table_ignition[rpm_current_index + (map_current_index << 4)])); - task_coil1_charge = task_coil1_fire - (coil_dwell + table_dwell[battery_voltage_index]); + task_coil1_charge = task_coil1_fire - (coil_dwell + table_dwell_voltage[battery_voltage_index] + table_dwell_rpm[rpm_current_index]); }else if((cylinder_next_fire == 2) || (cylinder_next_fire == 3)) { task_coil2_fire = micros() + (usec_per_degree * (180 + ignition_offset - table_ignition[rpm_current_index + (map_current_index << 4)])); - task_coil2_charge = task_coil2_fire - (coil_dwell + table_dwell[battery_voltage_index]); + task_coil2_charge = task_coil2_fire - (coil_dwell + table_dwell_voltage[battery_voltage_index] + table_dwell_rpm[rpm_current_index]); } } } diff --git a/tables.h b/tables.h index 0d471e6..98d312e 100644 --- a/tables.h +++ b/tables.h @@ -47,9 +47,18 @@ byte table_ignition[] = { // X = Voltage 7-16 // Index = [battery_voltage_index] // Value = additional dwell in usec -const int table_dwell[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +const int table_dwell_voltage[] = { + 2000, 2000, 2000, 2000, 1000, 0, 0, 0, 0, 0 + }; + +// X = RPM 0 - 7200 +// Index = [rpm_current_index] +// Value = additional dwell in usec +const int table_dwell_rpm[] = { + 3000, 2000, 2000, 1000, 0, 0, 0, 0, 0, 0, 0, -1000, -1000, -1000, -2000, -2000, }; + +