MembersPage/FredrikHafslund/ConfigAndTables

config.txt

I've copied the file (obviously) and I am still setting it up to match my engine, therefore some of the parameters have not yet been changed. Like the first lines which describes this as the setup for a VW engine. \n

############################################################
# Last Updated April 9, 2005
# 87 Volkswagen Scirocco 16v
# 1.8 16v Stock Motor
# Staked ABA headgaskets 
# 60-2 Crank wheel
# 11th Tooth on trigger wheel is TDC
# Genboard v3.2 Assembled 
# copied from Marcell's v3.1 config and tables
# copied from Hackish config and tables
# copied from Brian's config and tables
# copied from My TEC 2 settings
# #52lb injectors 3.0bar Fuel pressure 
# Impedance 2.4ohm wired up for LowZ and PWM use
# Injectors Populated: INJA, INJB
# Wideband Heater:  WB1 
# t3/t4 turbo 60 trim 60-1 wheel .63 stage 5 wheel
############################################################
#
# STARTUP INFORMATION
#    Get fuel pressure up and define what is running vs. cranking
#    Define Rev Limit

#
# ===== Fuel Pump Priming
primep=0D # 1.3ms (0x00 * 100us)

# --- Hot start Priming pulse scaling at 170F (80= half FF = same as cold)
primep_temp_scaling=A0 #63%

# ===== Cranking Pulse Definition
# typically cwh =~ 0.2 * cwl

# TODO: these are too low compared to req_fuel;
# cwl= 4..5 x cwh could be better (than 3x), but who knows...
cwl=1E  # Cranking pulsewidth [100 usec] at -40 F (3ms)
cwh=0A  # Cranking pulsewidth [100 usec] at 170 F (1ms)



cranking_thres=03 # Cranking threshold [300 rpm]

crank_minper=50 # for std. coil tach signal


# ===== Rev limiter 
#
# Rev limit (hard) [x100 rpm] eg. 0x4B * 100rpm = 7500rpm
# fuelcut (ignition-cut would blow up the exhaust)

# REV Limit at 6kRPM
rev_limit=3c


#############################################################
# 
# INJECTOR SETTINGS
#
# Fueling Parameters 
# 
# COMMENT: 
# For Req_fuel information 
#     see: http://www.megasquirt.info/manual/mfuel.htm#reqfuel
#     see: new wiki page
#     Scaling the VE and and req_fuel effectively increases the resolution
#        of the fueling parameters. 
# EXAMPLE:
# scaling is accomplished by making:
#          req_fuel  = calculated req_value / 2
#          VE_TABLE==> j[] = j[] .*2 (matlab notation) 
#          This changes the range of values in the j[] table 
#              from 1..100 to 2..200  

# =====  Req_fuel Setup ==============
# req fuel is calculated to be 5.5ms via mega manual
# 152 cid , 6cln, 6 injectors, 1 squirts, 48lb/hr, staging: alternating 
# 
# injectors @ 3.5bar = 48lb/hr 
# engine 2500 cc == 152 cid
# for every injector: 465cc breath; 0.465 L * 1.2kg/m3 = 0.558g air 
# divide by 14.7 (gasoline) : 0.558g / 14.7 = 0.038g fuel 
# divide by injector flowrate:  0.038 g / (5.77 g/s) = 6.6 msec
# doubled VE values and divided req_fuel by two to increase resolution
#
# req fuel is changed to 11.0 mS
#
# To double the VE table resolution divide req_fuel by two 
# Calculator for req_fuel calculations
# http://www.bgsoflex.com/megasquirt.exe

req_fuel=1B    

# =====  Physical setup ===============
#       6 injectors -- 6 banks 
#       Firing sequence: alternating, 2 squirts per 720degree rotation
#
# COMMENT: Verify: The divider says how many times banks fire during 
#                  720degree rotation
#                  
# ===== Alternate Injector bank setup ======
# Alternate injector drivers Works with h[0]
# alternate = 00 means use only first (batch fire or TBI) 
# alternate = 01 means alternate between first and second 
# alternate = 03 to use indexes 3,2,1,0 
# alternate = 07 to use indexes 7,6,5,4,3,2,1,0 
#
# add 0x10  (bit4=1) to fire all at cranking
# (both 2 in this case) simultaneously at cranking
# so this is alternate=01, but bit4=1 enables squirting both banks at cranking
# Bitwise  0x0001 0001
# DONE: for 2 banks, you almost surely want alternate=11
# so both banks are firing at cranking

alternate=15   					

#
#
#
# ===== Divider ============================
# COMMENT: Better notes here required
#    For a 4clyn you want divider * (alternate + 1) = 4 
#    divider * (alternate+1) should be 4 for a 4 cyl
#    divider=02 and alternate=01 for 2 banks
#    divider=01 and alternate=03 for 4 injector banks
# DONE: for 2 banks and 4cyl divider=02 recommended
# so higher pulsewidth will make it easier to tune 
# nice idle without the need of precise injopen related config

divider=01					# Finne ut av denne

# ===== Injector open&closing times ==============
#   for more detailed information look:
#      MembersPage/MarcellGal/EngineSwap/Feed
#      http://www.vems.hu/wiki/index.php?page=MembersPage%2FMarcellGal%2FEngineSwap%2FFuelFeed
#      http://www.vems.hu/wiki/index.php?page=GenBoard%2FManual%2FConfig%2FInjectorOpening  
# BATTFAC is the extra time it would take to open if only 6V would be present (low battery)
# BATTFAC is also the decrease in time it would take to open if the applied voltage was 12V+6V
#   [ This comes from I = V/R, the current flowing varies with the voltage applied since 
#     the resistance of the injectors remains constant ]
 
# Other things that can effect opening and closing speeds:
#     The type of flyback chosen (high or low voltage)
#     The type of injector used (high or low Z )
#     The pressure differential (Force solenoid required to overcome)
#
#   MCELL suggests that INJOPEN not be set much higher than 512us = 32*16usec (0x20)
#   shows up in low kPa setting being lower than high KPa settings in VE table (j[])  

injopen=20 # 32*16 usec
battfac=10 # +- 16 * 16usec depending on VBATT
injocfuel=08 # max rampup time at VBATT=7V is 8 * 24 usec
injrampup_battfac=FF # min rampup time is injocfuel*77%

# ======== High Z INJECTORS  =============== MAY USE ONLY HIGHZ or LOWZ settings
# For non-PWM settings INJPWMT=FF, INJPWM=FF, INJPWM6=00 sets up HIGH Z injection
# COMMENT why wouldnt INJPWMT be set to 00, then it doesnt need to get "disabled"

injpwmt=FF           # Injector PWM time at which to activate pwm [100 usec] 
                      # FF=disabled (set to 1 mS per MegaManual for starting point)

injpwm=FF            # Injector PWM duty cycle (when current limiting is active) 
                      # (set to ~100% [FF] no PWM - JJR 03/31 15:15)

injpwm6=00           # added Injector PWM duty cycle during low battery voltage (6V)

# ======== Low Z INJECTORS & PWM variables ===============
# The advantage of using LOW Z injectors is faster opening and closing times,
# based on the simple physics of more current to open the injector and less stored energy
# when closing the injectors
# Low Z injectors are designed to work on a Peak and Hold manner
#    During the Peak stage the current is switched on allowing the maximum 
#    current to flow to open the injector in a fast manner. This takes place 
#    at the beginning of each injection event (squirt) for a specific period of time
#    This entered into INJPWMT ( injector PWM start timedelay ) 

#injpwmt=0A           # Injector PWM time at which to activate pwm [100 usec] 
                     # FF=disabled (set to 1 mS per MegaManual for starting point)

#
# Then the injector starts the hold mode where the PWM % becomes applicable.
# to hold an injector (solenoid) open takes significantly less power
# the injector no longer has to charge or overcome the fuel pressure to keep it open.
# the current during the hold cycle is calculated by
# I = V/R * % duty cycle
# verify by measuring OC0 with DVM
# [0.4%] unit, so FF is 100% (that measures OC0=0V; since this is before the inverting FETdriver)
# 48/256 (=3/16), that measures OC0=5V * (256-48)/256
injpwm=30            # Injector PWM duty cycle (when current limiting is active) 

# In the case of low battery to keep the same I(current) the duty cycle must be increased.
# COMMENT: this is straight forward and should be built into the firmware
#  6volts = Vbatt/2; Iold = Inew; dutycycle should be equal to 2x 12volt percentage.

#injpwm6=40           # added Injector PWM duty cycle during low battery voltage (6V)

#############################################################
#
# Ignition
#
# Distance (in degrees) from first tooth after missing tooth to cylinder #1 TDC
# 0x01=0.5 degrees
# eg 0xF0=120 degrees
# 62 degrees = 120 (from missing tooth) - 48 (trigger tooth * 6) 

ign_tdcdelay=77   # 62 degrees = 120 (from missing tooth) - 48 (trigger tooth * 6) 

# car uses Dwell 
# TODO: need help Doing this going to be using a 4-tower coil pack from a GM or FORD. 
## 
# Calculation of 4500usec DWELL
# x=4500/64
# x=70
# hex(70) = 46

ign_dwell14=15 		
ign_dwell6=2A		

# ignition advance at cranking (8 deg) [0.25crankdeg]
ign_crank_advance=20 

# TODO: double-check this. Measure that initialization is proper 
# (firmware change might be needed depending on i259 RC reset circuit)

# Dummy:70/EDIS:00/none:FF
ign_out=70 

# at least 0..ignchmax index of h[2] must be filled in (Number of separate ignition channels)
ignchmax=05			
engine_off_delay=08

############################################################
#
# RPM Calculation
# eg 0x0BB8 = 3000 = 12000 rpm/4 cyl
# 4 cylinder: rpmk[0]=0B, rpmk[1]=B8
# 5 cylinder: rpmk[0]=09, rpmk[1]=60
# 6 cylinder: rpmk[0]=07, rpmk[1]=D0
# 8 cylinder: rpmk[0]=05, rpmk[1]=DC

rpmk[0]=07   
rpmk[1]=D0

#############################################################
# TPS related information
#
# ===== TPS calibration =================
# read TPS from LCD (or serial connection Manmll)
# in both endstates of throttle and configure these
# Important for triggering idle mode and acceleration enrichment
# --- TPS calibration means that the Analog(voltage) to Digital (count) is set 
#     at zero throttle and Wide Open Throttle (WOT)
#     The standard: lowest voltage for closed throttle
#                   highest voltage for open throttle
# --- See Manual or wiki page for how to hook up.
# --- Most Tuning software has this function in them 
#         Megatune, Megatunix, etc. 
#     
# ===== TPS low and high settings from installation

tps_low=78
tps_high=EB

# ====== TPS information used during engine running
#

tpsdot_kpadot_conf=00

# --- TPS dot bins
tpsdotrate[0]=05
tpsdotrate[1]=14
tpsdotrate[2]=28
tpsdotrate[3]=4D

# --- TPS accelerator enrichement: set to 00 for inital VE tuning
tpsaq[0]=00
tpsaq[1]=00
tpsaq[2]=00
tpsaq[3]=00

# --- not sure about these
#
# Accel TPSDOT threshold (throttle sensitivity) 
# minimum rate of change to enable any acceleration enrichment
tps_thresh=05

#
# Acceleration duration [0.1 sec] eg. 0x0A * 0.1 = 1 second
tpsasync=02

#
# Acceleration cold multiplication factor, biased at 0x64 eg. 0x64 - bias = 0
acmult=64
#
# Cold acceleration added amount (at -40 F degrees) [x100 usec]. eg. 0x14 * 100uS = 2000uS
tpsacold=05

#
#  Deacceleration fuel cut, 100(0x64) means no fuelcut because of sudden tps-release. 
# This can cause lean condition, misfire, kill-the-cat etc, so take care. 
# 00 would be rough behaviour, other value under 96% (0x60) is dangerous, I'd leave it at 100%
tpsdq=64

#
# Decel fuelcut enabled above threshold [x100 rpm] eg. 0x0F * 100 = 1500rmp
decel_fuelcut_thres=0F

#
# Overrun fuelcut: injectors disabled above this [x100 rpm]
overrun_fuelcut=10      # 1600 RPM

#
# Overrun fuelresume, injectors reenabled below this [x100 rpm]
overrun_fuelresume=0F   # 1500 RPM


#############################################################
# Use to avoid enleaning of AFR when idling due to increased intake air temperature. 
# A value of 98 (decimal) will limit the leaning of AFR at idle to 98% at 25C degress.
airden_ignore=62

#############################################################
#
# Barometer settings
#
# ===== Map Sensor ===========================
# standard MPX4250AP 250kpa sensor that comes with V3.x
kpafac=7F
kpaofs=52

# ===== Mean Barometric Pressure -- TODO explain better
baro=64

# ===== max allowed difference in barometric pressure
#           else use baro=0x64 (100 kPa)
# dbaro=10 # Marcells setting
dbaro=0C 


#############################################################
#
# these are important
# These useful descriptions are left over from Megasquirt
# Number of injectors/cylinders
#
#  Format for CONFIG11
#
#   bit 0-1 = MAP Type
#   00 = MPX4115AP
#   01 = MPX4250AP
#   10 = undefined
#   11 = undefined
#   
#   bit 2   = Engine Stroke
#   0 = 4-stroke
#   1 = 2-stroke
#
#   bit 3 = Injection Type
#   0 = Port Injection
#   1 = Throttle Body
#   
#   bit 4-7 = Number of Cylinders
#   0000 - 1 cylinder
#   0001 - 2 cylinders
#   0010 - 3 cylinder
#   0011 - 4 cylinder
#   0100 - 5 cylinder
#   0101 - 6 cylinder
#   0110 - 7 cylinder
#   0111 - 8 cylinder
#   1000 - 9 cylinder
#   1001 - 10 cylinder
#   1010 - 11 cylinder
#   1011 - 12 cylinder
#
#  Format for CONFIG12
#   bit 0-1 = Coolant Sensor Type
#   00 = GM
#   01 = undefined
#   10 = undefined
#   11 = undefined
#
#   bit 2-3 = MAT Sensor Type
#   00 = GM
#   10 = Undefined
#   11 = undefined
#
#   bit 4-7 = Number of Injectors
#   0000 = 1
#   0001 = 2
#   0010 = 3
#   0011 = 4
#   0100 = 5
#   0101 = 6
#   0110 = 7
#   0111 = 8
#   1000 = 9
#   1001 = 10
#
#   Format for CONFIG13
#   bit 0   = Odd-fire averaging
#   0 = Normal
#   1 = Odd-Fire

config11=52   # old config 31
config12=50   # 6 cylinders
config13=00   # old config 00
mt_unused=FF

#############################################################
#
# TODO: explain and perform if required 
#       battery calibration for starting and dwell I believe
#
batt_cal=BC

#############################################################
#
# Coolant Fan output 
# This ouput is generally used to trigger a relay to turn on
# the electric radiator fan, or engage the electric clutch for 
# engine cooling fan
# NOTE: the GRM cars use the stock VW low temp fan switch in the radiator
#       And as such this ouput is not needed

# --- Temperature when fan will turn on degC eg. 0x55 = 85degC
fan_temp=EA


# --- Decrease in temperature required to turn fan off.
# --- fun_temp-fan_hyst=temp when fun will turn off 0x55 - 0x09 = 0x4C (76degC)
fan_hyst=05

# coolant fan, output selection (digitalout)
fan_channel=FF


#############################################################
#
# Fast Idle
#
fastidle=C6   #RPM?? makey 1080 RPM?

#############################################################
#
# Idle air controller -- I dont have one. 
#
# This is where the idle is setup lots of stuff here to screw up.
#
iac_step_seq=C9
# stepper is enabled with 7E, you probably want iac_conf=18 or 
#  whatever ..check it
# TODO: why do you enable the stepper if you have none?
# COMMENT: because I dont know how to turn it OFF.
iac_conf=18  		# Stepper = 62:PWM = 18:
iac_max_steps=F0
iac_tps_thres=05
iac_cold_idle_temp=A0
iac_warm_idle_temp=D0
iac_cold_rpm=74
iac_warm_rpm=67
iac_cold_start_pos=E2
iac_warm_start_pos=B0
iac_afterstart_rpm=1F
iac_afterstart_duration=20
iac_afterstart_steps=04
iac_kp=25
iac_ki=10
iac_kd=30
iac_integral_speed=C0
iac_integral_limit_dec=05
iac_integral_limit_inc=E0
iac_integral_deadband=0A
iac_deadband=05
iac_pid_conf=01
iac_overclose_interval=B8
iac_ref_pos[0]=35
iac_ref_pos[1]=34
iac_ref_pos[2]=33
iac_ref_pos[3]=32
iac_ref_pos[4]=31
iac_ref_pos[5]=30
iac_ref_pos[6]=2F
iac_ref_pos[7]=2E
iac_ref_pos[8]=2D
iac_ref_pos[9]=2C
iac_sol_channel=FF

# ====== Ingition based idle control ========================
# TODO: have no Air control This section must be used for idle
# TODO: idle control via ignition advance / retard works without idle air-control too
iac_ign_advance_change=28
iac_ign_retard_change=20
iac_ign_advance_limit=10
iac_ign_retard_limit=1A
iac_ign_threshold=08

#############################################################
#
# Initial Start and Warmup
#
# ======== Afterstart
# COMMENT:
# awev is the percentage added at startup that fades away
# to 0 in awc engine cycles. 
# 15..40% (0F .. 28 hexa) are common (and sometimes even higher).
# Since originally warmup enrichment is not tuned, we often 
# adjust awev (besides cwl,cwh) to start the engine, but after
# warmup enrichments tuning is done, awev must retuned 
# to get back the desired pulsewidth. Take notes of 
# working cwl,cwh, awev settings and actual CLT and
# the warmup enrichments, so when warmup values are changed
# awev can be changed with simple calculation instead of guessing
awev=0F # Afterstart warmup enrichment (percent, added value)

awev_temp_scaling=A0  # Afterstart warmup scaling at 170F (80=half, ff=same as cold)

#awec=80   # Afterstart number of engine cycles
awc=FF

# ======== Warmup Coolant 
# warmup_clt_range defines the temperature bins used for interpolation
# the values in warmup_clt_range is degrees Fahrenheit + 40
# C = 5/9 * F - 40
# F = 9/5 * C + 72
warmup_clt_range[0]=00  # -40.0 C
warmup_clt_range[1]=14  # -28.8 C
warmup_clt_range[2]=28  # -17.7 C
warmup_clt_range[3]=3C  #  -6.6 C
warmup_clt_range[4]=50  #   4.4 C
warmup_clt_range[5]=64  #  15.5 C
warmup_clt_range[6]=78  #  26.6 C
warmup_clt_range[7]=8C  #  37.7 C
warmup_clt_range[8]=AA  #  54.4 C
warmup_clt_range[9]=C8  #  71.1 C

# warmup_clt is the value of each bin defined in warmup_clt_range
# this is the actual warmup enrichment. Values biased at 100
warmup_clt[0]=A0
warmup_clt[1]=A0
warmup_clt[2]=A0
warmup_clt[3]=A0
warmup_clt[4]=A0
warmup_clt[5]=96
warmup_clt[6]=8C
warmup_clt[7]=87
warmup_clt[8]=7D
warmup_clt[9]=64

# warmup enrichment can be decreased as a function of rpm.
# this is a nice feature, eg. +16% ... +0% gives nice result
# set all to 0x64 to disable
warmup_rpm[0]=64 # 100%
warmup_rpm[1]=64
warmup_rpm[2]=64
warmup_rpm[3]=64
warmup_rpm[4]=64
warmup_rpm[5]=64
warmup_rpm[6]=64
warmup_rpm[7]=64

#############################################################
#
# EGO Exhaust Gas Oxygen -- very important. 

# =======   EGO configuration ================================
#     Dave Brul's EGO setup 
# TODO: insert valid EGO setting for LSU4 setting into reference firmware

# --- 07 Variable Air Fuel Ratio
ego_conf=07 # 07 variable afr

# --- Step size (percent) [0.4%] eg. 0x02 * 0.4% = 0.8%
ego_delta=02 

# DONE: fixed Values
# COMMENT: Better explination here then
ego_lag=04

# --- Min coolant temperature for ego enabling[F] eg. 0xC2 = 194degF (108degC)
#     C = 5/9 * F - 40
#     60 degrees celcius
#     Setting this requires you to know if F or Cel is your chosen measurement
ego_coolant=94     #C2 

# --- Max TPS position for ego correction, This setting allows for learning at WOT
ego_maxtps=FF

# --- Max MAP for O2 correction[kPa] 
ego_maxmap=FF

# --- Min RPM for ego enabling [100rpm] eg. 0x0C * 100rpm = 1200rpm
#     Ignore all information below this RPM
ego_minrpm=0C

# --- Max rpm for O2 correction [100rpm] 0x32 * 100rpm = 7500rpm
ego_maxrpm=FF

# --- Warmup time [sec] eg. 0x3C (60 sec) [IS THIS FOR THE O2 sensor?]
ego_warmup=3C

# --- Max percent to lean afr[0.4%] eg. 0x30 * 0.4% = 19.2%
ego_lean_limit=30 

# --- Max percent to rich afr[0.4%] eg. 0x80 * 0.4% = 51.2%
ego_rich_limit=30

# --- THIS NEEDS DEFINED
ego_pid_kp=40

# --- ego_target = 51 * O2_sensor_voltage
ego_target=19

# --- not used for the wbo2 incredible ego, only for NBO2_PID_EGO_EXPERIMENT
#     Does this need to be commented for WBO2 setup?
ego_pid_window=FF


# MCELL vs DaveB (X = same; - = diff)
# X ego_conf=07  DB:07
# - ego_lag=04DB:15 (tell Dave that is way too high)
# - ego_coolant=00DB:94
# X ego_maxtps=FFDB:FF
# X ego_maxmap=FFDB:FF
# - ego_minrpm=04DB:0C
# X ego_maxrpm=FFDB:FF
# X ego_warmup=3CDB:3c
# - ego_lean_limit=1DDB:30
# - ego_rich_limit=28DB:30
# X ego_pid_kp=40DB:40
# NA mt_unused=00DB: NOT DEFINED 
# - ego_delta=01DB:02
# X ego_target=19DB:19
# X ego_pid_window=FFDB:FF


#############################################################
# TODO: insert a valid LSU4 setting into reference firmware
# Dave Brul's WBO2 setup
# wbo2 config with softpwm_act; softpmw_act_var is broken!!
# You must still calibrate your WBO2 see Manual or
# wiki page: 
#

# --- Semi useful varable names
wbo2_warmup_ramp=A0
wbo2_warmup_target=FF
wbo2_abs_limit=E4
wbo2_limit_maxt=A0
wbo2_fallback=60
wbo2_retry_t=06
wbo2_edgetime_corr=BA
wbo2_edgetime_min=50

# Dave I see your calculations here. Are they for the Calibration? 
# How about putting a worksheet here?
# (2.55mA * 61.9 / 106.2 ) + 2.55 = 4.036299 mA
# 4.036299 * 510 Ohm = 2.058512712 V
# i measured +/- 2.06V -> Good!
# 1% is eaten by the 10k pump+ to pump- resistor
# but does the AE calibration value also match my Rcal of 106.2 ?

# --- O2 percentage of 'normal' air: 20.947%, calibrated to 20.95
# warning: sensor dependent.
# for verification, also measure (and write here) sensor RCal (DVM Ohmmeter mode),
# between red wire and connector pin that has no wire towards the sensor (the RCal lives in sensor connector housing). Usually between 80..180 ohm
# Wide band has to be heated up and to give 02% readings
wbo2_calibration=A2 # Sensor read 83.4 ohms adjusted to 02%=2095

# board serial number=...
# DESCRIPTION in WBO2 controllertesting., calibration
# adjust to get pump+ close (within 0.1V close if pump+ connection open) to pump- (that is appr. 3.98V)
wbo2_pump_pw_zero=64

# wbo2, target Ri (pulse amplitude) [5V/8192]
wbo2_ri_target=96 

# OPA amplification, g = 270/75 + 1 = 4.6
# Vadc = g * (5 - Vnernst)
#
# Vnernst DC at sensor wire = 4.45V 
#
# Vnernst DC at adc = 4.6 * (5 - 4.45) = 2.53
#
# nernstdc_target = Vadc / g * 256 = 141 = 0x8D

# --- wbo2, target nernstDC [5V/256] 
wbo2_nernstdc_target=A2			# +0.445VDC 

# --- I NEED A DESCRIPTION
wbo2_heater_pid_kp=46
wbo2_heater_pid_ki=10
wbo2_heater_pid_kd=1A
wbo2_heater_pid_ilimit=80


# --- I NEED A DESCRIPTION
wbo2_pump_pid_kp=40     # 2E
wbo2_pump_pid_ki=2E     # 1D 
wbo2_pump_pid_kd=00     # the D term is not needed IMHO. I didn't fine-tune the pump PID controlelr, but brief experiments suggests so. Was 08 earlier, dunno how it was made (I think originally came from Dave Brul)
wbo2_pump_pid_ilimit=84 # 84 

# --- I NEED A DESCRIPTION
wbo2_ri_confidence_scale=80


#############################################################
#
#  Knock Detection and correction  2-channel Knock sensor control
# 
#  NOTE: car NOT using Knock being used this go round
#  --- Dave Brul's notes PROBLEM his has more settings. 
# engine with bore 83mm and stroke 86mm
# f_knock = 900 / (pi*r) = 900 / (pi * 0.5 * 0.083) = 6.903 kHz 
# from datasheet tpic801.pdf page 10 table#1
# bandpass frequency selection 6.94 kHz is closest to 6.903 kHz
# filter setting = 29 hex (41 dec)

# -- Overall System SettingsKnock selection
knock_conf=00
knock_sampling_window=FF

# --- RPM range valid for  FF, FF means no knock
knock_minrpm=FF
knock_maxrpm=FF

# --- Channel #1 setup
knock1_frequency=29
knock1_gain=FF
knock1_integrator=FF

# --- Channel #2 setup
knock2_frequency=29
knock2_gain=FF
knock2_integrator=FF

# --- Trigger level
knock_threshold=FF
knock_noise_scale=FF

# --- Ignition effects

# ----- Knock getting louder
knock_max_retard=FF
knock_default_retard=00
knock_retard_step=FF
knock_retard_delay=FF

# ----- Knock getting softer
knock_advance_step=FF
knock_advance_delay=FF



#############################################################
#
# VE learning VERY important
#
# TODO: Setup for learning. coolant sensor. 
#       218 is damn close to the thermotime switch reading
#       how about we make this much lower?  
# COMMENT: Insert comments on enabling/disable/howto use
# Some basic comments:
#   VE Learning can adjusta loadsite that is visited 
#   but not a neighboring loadsite that is rarely visited causing 
#   peaks and valleys in the VE (j[]) map that will need smoothed
#
#   EGO correction is transferred across loadsites for fast loadsite-changes 
#   (that happens, especially in kPa direction)
# 
# Turn on VE Learning        
# ve_learn_conf=01 / 00 is ON / OFF
ve_learn_conf=01

ve_learn_coolant=D8 # 0x00 means -40 F
                    # 0x255 means 215F

# VE Learning speeds higher number means more agressive
ve_learn_rpm_scale=1E
ve_learn_kpa_scale=1E
ve_learn_ego_scale=43

# TODO: comment
ve_learn_speed=FF

# comment
ve_learn_max_power=FF
ve_learn_min_weight=4D

# comment
ve_learn_limit=FF


#############################################################
#
# Triggers, HW determines VR or Hall
# software defines how it reacts
# 
#
# ========== 60-2 Trigger Configration ====================
#
# ======Primary_Trigger ====================
#       FE:           Rising Edge trigger
#       FF:           Falling Edge trigger
#       01:           Multi-tooth configuration

primary_trigger=01   # Multi-Tooth configuration


# tooth_wheel:
# Used for multi-tooth wheels
# Total number of teeth
# eg For 60-2 wheel, 58 teeth between the missing tooth = 3A
# eg For 36-1 wheel, 35 teeth between the missing tooth = 23 

tooth_wheel=3A     

# tooth_wheel_twidth1:
# width (in degrees) of each tooth 
# eg For 36-1 wheel, each tooth is 10 degrees = A

tooth_wheel_twidth1=6



# trigger_tooth:
# Used for multi-tooth wheels (Tooth that triggers event)
# so that trigger tooth is ~60 degrees BTDC

trigger_tooth=00   # so that trigger tooth is ~60 degrees BTDC


# Cam trigger goes high 90 degrees BTDC on cylinder 1 compression stroke
# This results in the 0->1 trigger 20 crank degrees before the trigger_tooth (70 BTDC)
# Cylinder 1 start of intake stroke is defined as phase==0
# A) cyl 1 start of intake:        0 degrees, phase=0   | upcoming primary trigger phase: 54-7*3 = 33
# B) cyl 1 start of compression: 180 degrees, phase=54  | upcoming primary trigger phase: 87
# C) cyl 1 start of combustion:  360 degrees, phase=108 | upcoming primary trigger phase: 141
# D) cyl 1 start of exhaust:     540 degrees, phase=162 | upcoming primary trigger phase: 195
# 0->1 cam trigger arrives between B and C, thus cam_sync_r_edge_phase = 141 (dec)

# ======Secondary_Trigger ====================
#       FE:           Rising Edge trigger
#       FF:           Falling Edge trigger
#       01:           Multi-tooth configuration
#       ??:           Cam Sync setup?

secondary_trigger=1d		#02 = disable 

cam_sync_r_edge_phase=FF
cam_sync_f_edge_phase=FF
reset_engphase_after=FF			# Vet ikke helt hva denne betyr.

# another_trigger_tooth: decimal 20 is used for 60-2 toothwheel and 6 cylinder (3 events per crankrot)
another_trigger_tooth=14

# not used without camsync
tooth_wheel_twidth2=12




#############################################################
# MCELL's Trigger setup, using a 60-1 VR wheel
# Triggers, HW determines VR or Hall
# software defines how it reacts
# ======Primary  Trigger ====================
#primary_trigger=01
#tooth_wheel=3A
#trigger_tooth=10
# ======Secondary  Trigger ====================
#secondary_trigger=FF
#another_trigger_tooth=1E
#crank_minper=50
#tooth_wheel_twidth1=06
#tooth_wheel_twidth2=12
#cam_sync_r_edge_phase=FF
#cam_sync_f_edge_phase=FF
#reset_engphase_after=FF




#############################################################
#
# Fuel Pump Control 
#

pump_on_mintime=0F					
fuelpump_channel=57


#############################################################
#
# second stage of injectors
#
# NOTE: GRM not using, A description of use would be nice
inj_stage2_rate=FF
inj_stage2_start_tps=FF
inj_stage2_start_map=FF


#############################################################
#
# Anti-lag system
#
# NOTE: GRM not using, A description of use would be nice
als_lowrpm=FF
als_maxtps=FF
als_ignretard=FF
als_rich=FF


#############################################################
#
# Exhaust Gas Temperature
#
# NOTE: not using, A description of use would be nice
# COMMENT: how does EGT effect running?
egt1_cal=40
egt1_offs=00


#############################################################
#
# Boost Controller
#
# NOTE: not using, A description of use would be nice
boost_conf=00
boost_targetoffs=00
boost_minpressure=FF
boost_pid_kp=20
boost_pid_ki=80
boost_pid_kd=01
boost_pid_ilimit=FF
boost_channel=FF


#############################################################
#
# Water pump Controller
#
# NOTE: not using, described on AlphaN page
water_pump_temp=00
hybrid_rpm_a=00
hybrid_rpm_m=00
water_pump_hyst=00
water_pump_channel=FF

#############################################################
#
# Misc outputs (WOT & RPM, WOT, RPM, channel definition)
#
# FF disables the outputs
# needs/wants: 
# WOT & RPM( 4000RPM < X <7200RPM ) switched ground for relay (nitrous activation)
# RPM ( >7000 RPM) Switched ground for SuperBright LED (SHIFT LIGHT)
# RPM ( >rev_limit(7500 RPM) )Switched ground for SuperBright LED (REV Limiter) 
# TODO: wiki page reference
#
# Suggested Setup from <Dave24_> 
# ============== Misc 2 output =================
# RPM ( >7000 RPM) Switched ground for SuperBright LED (SHIFT LIGHT)
misc2out_minrpm=46
misc2out_maxrpm=FF
misc2out_mintps=00
misc2out_maxtps=FF
misc2out_minmap=00
misc2out_maxmap=FF
# select channel yourself, i would go with on of the p259 outputs
# P259 ouput 0: EC36 pin 4
misc2out_channel=07 				# EC36 pin 4

# ============== Channel Select =================
# not used
act_wot_rpm=FF
act_wot_channel=FF
# RPM ( >rev_limit(7500 RPM) )Switched ground for SuperBright LED (REV Limiter) 
act_rpm_rpm=4B 
# select channel yourself, i would go with one of the p259 outputs
# P259 ouput 1: EC36 pin 16
act_rpm_channel=17	 			# EC36 pin 16
# not sure about the wot output with rpm range

# ============== Misc 1 output =================
# WOT & RPM( 4000RPM < X <7200RPM ) switched ground for relay (nitrous activation)
misc1out_minrpm=28
misc1out_maxrpm=48
misc1out_mintps=FF
misc1out_maxtps=FF
misc1out_minmap=00
misc1out_maxmap=FF
# select channel yourself, i would go with on of the p259 outputs
# P259 ouput 6: EC36 pin 31
misc1out_channel=67				# eC36 pin 31


#############################################################
#
# LCD layout
#
# A better description would definately be helpful
# TODO: wiki page reference
lcd_c0=FE
lcd_delay=FF
lcd_backlight=FF
lcd_offs[0]=FF
lcd_offs[1]=FF
lcd_offs[2]=FF
lcd_offs[3]=FF
lcd_default_view=00


tables.txt\n

# either 2 digit hexa values (like A3)
# or 4 digit hexa values (like A32B) (effectively same as A3)
# or 0..255 decimal values (if numberformat=10 given)
# can be used.
# The 4 digit hexa values are dumped by the firmware
# so the result of VE learning can be saved. The
# LSB is not particularly impartant, but provides some
# info on which loadsites did learning happen

j[0]=667F 667F 6736 697F 6E7F 717F 717F 737F
j[1]=677F 6859 6B7F 6F7F 757F 797F 7A7F 797F
j[2]=687F 6C7F 717F 787F 837F 887F 867F 827F
j[3]=6F7F 717C 797F 847F 917F 987F 987F 927F
j[4]=7B7F 7F7F 847F 8D7F 9B7F A47F A87F A17F
j[5]=827F 837F 8C7F 937F A87F B37F B958 B37F
j[6]=867F 8B7F 937F 9C7F AF7F B87F BF7D BE7F
j[7]=877F 8CB0 967F A07F B07F BA7F C57F C27F

# NA
k[0]=14 1E 28 32 3C 4B 5A 69
r[0]=05 0A 0F 14 1E 28 32 40

l[0]=45 38 38 36 34 34 34 34
l[1]=38 38 38 38 36 36 36 36
l[2]=38 38 38 38 38 38 38 38
l[3]=38 38 38 38 38 38 38 38
l[4]=38 38 41 47 4F 4F 4F 4F
l[5]=45 45 4F 59 59 59 59 59
l[6]=6A 6A 6A 6A 6A 6A 6A 6A
l[7]=6A 6A 6A 6A 6A 6A 6A 6A
# Fero said that max l=0x5c (NA) is too rich. So he set it for 0x6A (even more rich :-)

n[0]=3C 3C 50 77 A0 B4 B4 B4
n[1]=3C 3C 50 78 A0 B1 B2 B1
n[2]=3C 3C 50 77 99 AA AB A9
n[3]=3C 3C 50 76 95 A1 A2 A1
n[4]=3C 3C 50 75 8D 99 9B 9A
n[5]=3C 3C 50 6F 83 8E 8F 8F
n[6]=3C 3C 50 67 7A 81 83 84
n[7]=3C 3C 50 5F 6F 78 78 78

h[0]=08 02 20 04 10 01 00 00
h[1]=00 00 00 00 00 00 00 00
h[2]=03 01 05 02 04 00 00 00
b[0]=28 30 38 40 48 50 58 60
t[0]=20 40 17 80 A0 C0 E0 FF


#############################
# Fuel injector table h[0]
# 
# EC36Pin	7	19	8	20	9	18	6	17
# h[0] value	Inj A	Inj B	Inj C	Inj D	Inj E	Inj F	Inj G	Inj H	
# 01		X								
# 02			X							
# 04				X						
# 08					X					
# 10						X				
# 20							X			
# 40								X		
# 80									X	
# 05(01+04)	X		X						
# 0A(02+08)		X		X


###########################
# Ign Table h[2]
#
#Name		EC36Pin	h[2]value
#Drive_00	35	00	
#Drive_01	33	01	
#Drive_02	34	02	
#Drive_03	36	03	
#Drive_04	11	04	
#Drive_05	12	05	
#Drive_06	24	06	
#Drive_07	10	07