Merge branch 'master' of git://github.com/noisymime/speeduino

This commit is contained in:
VitorBoss 2017-12-06 16:13:58 -02:00
commit 31d134c05d
55 changed files with 36381 additions and 82888 deletions

View File

@ -43,7 +43,8 @@ framework = arduino
; framework-arduinoststm32
board = bluepill_f103c8
lib_deps = EEPROM
build_flags = -fpermissive -std=gnu++11
;build_flags = -fpermissive -std=gnu++11 -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -Wl,-Map,output.map
build_flags = -fpermissive -std=gnu++11 -Os
[platformio]

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<msq xmlns="http://www.msefi.com/:msq">
<bibliography author="TunerStudio MS 3.0.28 - EFI Analytics, Inc." tuneComment="" writeDate="Mon Oct 09 11:58:20 AEDT 2017"/>
<versionInfo fileFormat="5.0" firmwareInfo="Speeduino+2017.09" nPages="10" signature="speeduino 201709"/>
<bibliography author="TunerStudio MS(Beta) 3.0.50.10 - EFI Analytics, Inc." tuneComment="" writeDate="Tue Nov 07 22:13:14 AEDT 2017"/>
<versionInfo fileFormat="5.0" firmwareInfo="Speeduino+2017.09" nPages="10" signature="speeduino 201710"/>
<page>
<pcVariable name="tsCanId">"CAN ID 0"</pcVariable>
</page>
@ -82,8 +82,6 @@
<constant name="pinLayout">"Speeduino v0.4"</constant>
<constant name="tachoPin">"Board Default"</constant>
<constant name="tachoDiv">"Normal"</constant>
<constant digits="1" name="tdePct" units="ms">3.2</constant>
<constant digits="1" name="taeColdA" units="ms">0.0</constant>
<constant digits="0" name="tpsThresh" units="%/s">70.0</constant>
<constant digits="0" name="taeTime" units="ms">200.0</constant>
<constant name="display">"Unused"</constant>
@ -113,8 +111,6 @@
<constant name="twoStroke">"Four-stroke"</constant>
<constant name="injType">"Port"</constant>
<constant name="nCylinders">"4"</constant>
<constant name="cltType">"GM"</constant>
<constant name="matType">"GM"</constant>
<constant name="nInjectors">"4"</constant>
<constant name="engineType">"Even fire"</constant>
<constant name="flexEnabled">"Off"</constant>
@ -210,7 +206,7 @@
71.0
</constant>
<constant digits="0" name="UNALLOCATED_TOP_1" units="RAW">
0.0
255.0
</constant>
</page>
<page number="2" size="288">
@ -283,19 +279,15 @@
<constant name="fuelPumpPin">"Board Default"</constant>
<constant name="useResync">"No"</constant>
<constant digits="1" name="sparkDur" units="ms">1.0</constant>
<constant digits="0" name="IdleAdvRPM" units="RPM">3200.0</constant>
<constant digits="1" name="IdleAdvCLT" units="C">-21.0</constant>
<constant digits="0" name="IdleDelayTime" units="sec">38.0</constant>
<constant digits="0" name="StgCycles" units="cycles">2.0</constant>
<constant name="dwellcont">"Dwell control"</constant>
<constant digits="0" name="SkipCycles" units="cycles">1.0</constant>
<constant name="useDwellLim">"On"</constant>
<constant name="sparkMode">"Wasted Spark"</constant>
<constant name="TrigFilter">"Off"</constant>
<constant name="ignCranklock">"On"</constant>
<constant digits="1" name="dwellcrank" units="ms">4.5</constant>
<constant digits="1" name="dwellrun" units="ms">3.0</constant>
<constant digits="0" name="numteeth" units="teeth">36.0</constant>
<constant digits="0" name="onetwo" units="teeth">1.0</constant>
<constant digits="0" name="numTeeth" units="teeth">36.0</constant>
<constant digits="0" name="missingTeeth" units="teeth">1.0</constant>
<constant digits="0" name="crankRPM" units="rpm">400.0</constant>
<constant digits="0" name="tpsflood" units="%">80.0</constant>
<constant digits="0" name="SoftRevLim" units="rpm">6500.0</constant>
@ -423,7 +415,7 @@
145.0
</constant>
<constant digits="0" name="UNALLOCATED_TOP_3" units="RAW">
0.0
255.0
</constant>
</page>
<page number="4" size="288">
@ -493,7 +485,6 @@
<constant digits="0" name="egoKD" units="%">0.0</constant>
<constant digits="0" name="egoTemp" units="C">70.0</constant>
<constant digits="0" name="egoCount">16.0</constant>
<constant digits="0" name="egoDelta" units="%">1.0</constant>
<constant digits="0" name="egoLimit">15.0</constant>
<constant digits="1" name="ego_min" units="AFR">9.0</constant>
<constant digits="1" name="ego_max" units="AFR">19.0</constant>
@ -833,54 +824,6 @@
<constant name="caninput_sel13">"Off"</constant>
<constant name="caninput_sel14">"Off"</constant>
<constant name="caninput_sel15">"Off"</constant>
<constant name="caninput_param_group0">"blank"</constant>
<constant name="caninput_param_group1">"blank"</constant>
<constant name="caninput_param_group2">"blank"</constant>
<constant name="caninput_param_group3">"blank"</constant>
<constant name="caninput_param_group4">"blank"</constant>
<constant name="caninput_param_group5">"blank"</constant>
<constant name="caninput_param_group6">"blank"</constant>
<constant name="caninput_param_group7">"blank"</constant>
<constant name="caninput_param_group8">"blank"</constant>
<constant name="caninput_param_group9">"blank"</constant>
<constant name="caninput_param_group10">"blank"</constant>
<constant name="caninput_param_group11">"blank"</constant>
<constant name="caninput_param_group12">"blank"</constant>
<constant name="caninput_param_group13">"blank"</constant>
<constant name="caninput_param_group14">"blank"</constant>
<constant name="caninput_param_group15">"blank"</constant>
<constant name="caninput_param_start_byte0">"7"</constant>
<constant name="caninput_param_start_byte1">"0"</constant>
<constant name="caninput_param_start_byte2">"0"</constant>
<constant name="caninput_param_start_byte3">"0"</constant>
<constant name="caninput_param_start_byte4">"0"</constant>
<constant name="caninput_param_start_byte5">"0"</constant>
<constant name="caninput_param_start_byte6">"0"</constant>
<constant name="caninput_param_start_byte7">"0"</constant>
<constant name="caninput_param_start_byte8">"0"</constant>
<constant name="caninput_param_start_byte9">"7"</constant>
<constant name="caninput_param_start_byte10">"7"</constant>
<constant name="caninput_param_start_byte11">"7"</constant>
<constant name="caninput_param_start_byte12">"7"</constant>
<constant name="caninput_param_start_byte13">"7"</constant>
<constant name="caninput_param_start_byte14">"7"</constant>
<constant name="caninput_param_start_byte15">"7"</constant>
<constant name="caninput_param_num_bytes0">"1"</constant>
<constant name="caninput_param_num_bytes1">"1"</constant>
<constant name="caninput_param_num_bytes2">"1"</constant>
<constant name="caninput_param_num_bytes3">"1"</constant>
<constant name="caninput_param_num_bytes4">"1"</constant>
<constant name="caninput_param_num_bytes5">"1"</constant>
<constant name="caninput_param_num_bytes6">"1"</constant>
<constant name="caninput_param_num_bytes7">"1"</constant>
<constant name="caninput_param_num_bytes8">"1"</constant>
<constant name="caninput_param_num_bytes9">"1"</constant>
<constant name="caninput_param_num_bytes10">"1"</constant>
<constant name="caninput_param_num_bytes11">"1"</constant>
<constant name="caninput_param_num_bytes12">"1"</constant>
<constant name="caninput_param_num_bytes13">"1"</constant>
<constant name="caninput_param_num_bytes14">"1"</constant>
<constant name="caninput_param_num_bytes15">"1"</constant>
<constant digits="0" name="unused10_53">255.0</constant>
<constant digits="0" name="unused10_54">255.0</constant>
<constant name="enable_candata_out">"On"</constant>
@ -1148,7 +1091,7 @@
25500.0
</constant>
<constant digits="0" name="UNALLOCATED_TOP_9" units="RAW">
0.0
255.0
</constant>
</page>
<settings Comment="These setting are only used if this msq is opened without a project.">

File diff suppressed because it is too large Load Diff

View File

@ -2,35 +2,230 @@
; THROUGH (PLATED) HOLES START AT T100
M48
INCH
T1C0.165354
T2C0.125984
T3C0.033465
T100C0.031496
T101C0.030000
T102C0.038000
T103C0.043302
T104C0.035433
T105C0.038194
T106C0.042000
T107C0.015748
T108C0.040000
T1C0.033465
T2C0.165354
T3C0.125984
T100C0.038194
T101C0.042000
T102C0.015748
T103C0.040000
T104C0.031496
T105C0.030000
T106C0.038000
T107C0.043302
T108C0.035433
%
T1
X030651Y022829
X018002Y017668
X016821Y017668
T2
X001895Y003148
X030651Y013731
X001895Y036497
X001895Y018448
T2
X035411Y030780
X037661Y012030
X030651Y022829
T3
X016821Y017668
X018002Y017668
X037661Y012030
X035411Y030780
T100
X022161Y007733
X022161Y004780
X037911Y022780
X012911Y011780
X036911Y014780
X021911Y011780
X021911Y030780
X037911Y018780
X030911Y011780
X015311Y030780
X030911Y030780
X036911Y029780
X037911Y021780
X036911Y013780
X015911Y011780
X037911Y017780
X024911Y011780
X009311Y030780
X024911Y030780
X036911Y028780
X033911Y011780
X037911Y020780
X033911Y030780
X037911Y016780
X010311Y030780
X018911Y030780
X036911Y027780
X027911Y030780
X010911Y011780
X036911Y030780
X037911Y015780
X036911Y026780
X013311Y030780
X037911Y014780
X013911Y011780
X022911Y011780
X036911Y025780
X007311Y030780
X022911Y030780
X031911Y011780
X016311Y030780
X037911Y029780
X031911Y030780
X037911Y013780
X016911Y011780
X036911Y024780
X025911Y011780
X037911Y028780
X034911Y011780
X036911Y023780
X019911Y011780
X011311Y030780
X019911Y030780
X037911Y027780
X028911Y011780
X036911Y019780
X028911Y030780
X037911Y030780
X036911Y022780
X011911Y011780
X020911Y011780
X020911Y030780
X037911Y026780
X036911Y018780
X014311Y030780
X036911Y021780
X014911Y011780
X037911Y025780
X008311Y030780
X023911Y011780
X036911Y017780
X023911Y030780
X032911Y011780
X032911Y030780
X036911Y020780
X037911Y024780
X017911Y011780
X036911Y016780
X017911Y030780
X026911Y011780
X026911Y030780
X035911Y011780
X037911Y023780
X036911Y015780
X012311Y030780
X037911Y019780
X029911Y011780
X029911Y030780
T101
X023681Y004280
X026661Y004280
T102
X007161Y006030
X003661Y002280
X029161Y013780
X037661Y005530
X017161Y015280
X026661Y016280
X022161Y006280
X018911Y029780
X017161Y033030
X018411Y015030
X027911Y029780
X015161Y002280
X035661Y031780
X002161Y026030
X022161Y017780
X027833Y004925
X028423Y006894
X006911Y013030
X033161Y016030
X022661Y017780
X022161Y019030
X025411Y029530
X026161Y028030
X011161Y006030
X032951Y003941
X002161Y021530
X005161Y011280
X035911Y018530
X007411Y012530
X006661Y028780
X001911Y033030
X008911Y017530
X028161Y020530
X005161Y007280
X031661Y004280
X029014Y005516
X018661Y028530
X007411Y034030
X005911Y004280
X009411Y009280
X011661Y017530
X035661Y008030
X028661Y020530
X029161Y008030
X007661Y019280
X009161Y015280
X023411Y014530
X007661Y037030
X024911Y027280
X028411Y008530
X008661Y006030
X035661Y004780
X009411Y011280
X008661Y022780
X026661Y019780
X033411Y010280
X009411Y006030
X011661Y003030
X033911Y006030
X005161Y015530
X034911Y033030
X034911Y034280
X009411Y010280
X003411Y004280
X008411Y032530
X014161Y003030
X023161Y035780
X033911Y005030
X016911Y005530
X030161Y025030
X011911Y015280
X025411Y008030
X032557Y005910
X009661Y008030
X029161Y020530
X014411Y008780
X013411Y007280
X026911Y009530
X029661Y020530
X013911Y006030
X011161Y028780
X035661Y004280
X019161Y008780
X017661Y018030
X025411Y030280
X013911Y017530
X035161Y018280
X030911Y020030
X019161Y007780
X017911Y010530
X006411Y035280
X024911Y028530
X012161Y002280
X014661Y015280
X015911Y009780
T103
X025927Y019780
X025927Y016780
X025927Y020780
X025927Y017780
X025927Y015779
X025927Y018780
T104
X022161Y004780
X022161Y007733
T105
X031906Y028285
X028906Y033285
X029906Y028285
X030906Y033285
X031906Y033285
@ -45,9 +240,18 @@ X027906Y028285
X028906Y028285
X030906Y028285
X027906Y033285
X031906Y028285
X028906Y033285
T102
T106
X011911Y026280
X022911Y023280
X016911Y024280
X020911Y026280
X019911Y025280
X010911Y021280
X013911Y022280
X018911Y020280
X011911Y025280
X016911Y023280
X022911Y022280
X014911Y026280
X020911Y025280
X019911Y024280
@ -149,18 +353,13 @@ X010911Y022280
X015911Y020280
X013911Y023280
X018911Y021280
X011911Y026280
X022911Y023280
X016911Y024280
X020911Y026280
X019911Y025280
X010911Y021280
X013911Y022280
X018911Y020280
X011911Y025280
X016911Y023280
X022911Y022280
T103
T107
X005911Y005140
X005911Y011281
X005911Y028172
X004141Y025810
X005911Y034510
X004141Y010098
X005911Y019664
X004141Y017223
X005911Y022264
@ -187,8 +386,8 @@ X005911Y006515
X004141Y029356
X005911Y021047
X004141Y007740
X004141Y026989
X005911Y024631
X004141Y026989
X004141Y031756
X004141Y023447
X004141Y013644
@ -203,208 +402,10 @@ X004141Y006515
X004141Y021047
X004141Y024631
X004141Y030535
X005911Y005140
X005911Y011281
X005911Y028172
X004141Y025810
X005911Y034510
X004141Y010098
T104
X037661Y004480
T108
X037661Y007280
X037661Y011030
X037661Y008230
T105
X015911Y011780
X037911Y017780
X024911Y011780
X009311Y030780
X024911Y030780
X036911Y028780
X033911Y011780
X037911Y020780
X033911Y030780
X037911Y016780
X010311Y030780
X018911Y030780
X036911Y027780
X027911Y030780
X010911Y011780
X036911Y030780
X037911Y015780
X036911Y026780
X013311Y030780
X037911Y014780
X013911Y011780
X022911Y011780
X036911Y025780
X007311Y030780
X022911Y030780
X031911Y011780
X016311Y030780
X037911Y029780
X031911Y030780
X037911Y013780
X016911Y011780
X036911Y024780
X025911Y011780
X037911Y028780
X034911Y011780
X036911Y023780
X019911Y011780
X011311Y030780
X019911Y030780
X037911Y027780
X028911Y011780
X036911Y019780
X028911Y030780
X037911Y030780
X036911Y022780
X011911Y011780
X020911Y011780
X020911Y030780
X037911Y026780
X036911Y018780
X014311Y030780
X036911Y021780
X014911Y011780
X037911Y025780
X008311Y030780
X023911Y011780
X036911Y017780
X023911Y030780
X032911Y011780
X032911Y030780
X036911Y020780
X037911Y024780
X017911Y011780
X036911Y016780
X017911Y030780
X026911Y011780
X026911Y030780
X035911Y011780
X037911Y023780
X036911Y015780
X012311Y030780
X037911Y019780
X029911Y011780
X029911Y030780
X037911Y022780
X012911Y011780
X036911Y014780
X021911Y011780
X021911Y030780
X037911Y018780
X030911Y011780
X015311Y030780
X030911Y030780
X036911Y029780
X037911Y021780
X036911Y013780
T106
X026661Y004280
X023681Y004280
T107
X022161Y017780
X027833Y004925
X028423Y006894
X006911Y013030
X033161Y016030
X022661Y017780
X022161Y019030
X025411Y029530
X026161Y028030
X011161Y006030
X032951Y003941
X002161Y021530
X005161Y011280
X035911Y018530
X007411Y012530
X006661Y028780
X001911Y033030
X008911Y017530
X023161Y010030
X028161Y020530
X005161Y007280
X031661Y004280
X029014Y005516
X018661Y028530
X007411Y034030
X005911Y004280
X009411Y009280
X011661Y017530
X035661Y008030
X028661Y020530
X029161Y008030
X007661Y019280
X009161Y015280
X023411Y014530
X007661Y037030
X024911Y027280
X028411Y008530
X008661Y006030
X035661Y004780
X009411Y011280
X008661Y022780
X026661Y019780
X033411Y010280
X009411Y006030
X011661Y003030
X033911Y006030
X005161Y015530
X034911Y033030
X034911Y034280
X009411Y010280
X003411Y004280
X014161Y003030
X008411Y032530
X012161Y007280
X023161Y035780
X033911Y005030
X016911Y005530
X030161Y025030
X011911Y015280
X025411Y008030
X032557Y005910
X009661Y008030
X029161Y020530
X014411Y008780
X011661Y002280
X013411Y007280
X026911Y009530
X029661Y020530
X013911Y006030
X035661Y004280
X011161Y028780
X017661Y018030
X025411Y030280
X013911Y017530
X035161Y018280
X030911Y020030
X006411Y035280
X024911Y028530
X014661Y015280
X015911Y009780
X007161Y006030
X003661Y002280
X029161Y013780
X037661Y005530
X017161Y015280
X026661Y016280
X022161Y006280
X018911Y029780
X017161Y033030
X027911Y029780
X018411Y015030
X015161Y002280
X035661Y031780
X002161Y026030
T108
X025927Y019780
X025927Y016780
X025927Y020780
X025927Y017780
X025927Y015779
X025927Y018780
X037661Y004480
T00
M30

View File

@ -9,8 +9,8 @@ G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%OFA0B0*%
%SFA1.0B1.0*%
%ADD10C,0.049370*%
%ADD11C,0.082917*%
%ADD12C,0.088000*%
%ADD11C,0.088000*%
%ADD12C,0.082917*%
%ADD13C,0.065433*%
%ADD14C,0.084000*%
%ADD15C,0.175354*%
@ -28,10 +28,17 @@ G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
G90*
G70*
G54D10*
X1916Y878D03*
X1916Y778D03*
X1391Y603D03*
X1216Y228D03*
G54D11*
X466Y228D03*
G54D10*
X591Y428D03*
X1416Y303D03*
X941Y603D03*
X966Y803D03*
X1216Y728D03*
X2216Y1778D03*
X2216Y1903D03*
X2266Y1778D03*
@ -79,7 +86,7 @@ X2816Y2053D03*
X2866Y2053D03*
X2916Y2053D03*
X2966Y2053D03*
G54D11*
G54D12*
X2991Y1178D03*
X1391Y1178D03*
X3091Y1178D03*
@ -168,8 +175,8 @@ X3791Y1378D03*
X2891Y1178D03*
G54D10*
X3566Y803D03*
X2316Y1003D03*
G54D12*
X1791Y1053D03*
G54D11*
X1291Y2428D03*
X2091Y2028D03*
X2091Y2428D03*
@ -438,7 +445,7 @@ X866Y2278D03*
X1391Y1753D03*
X1166Y1753D03*
X891Y1753D03*
G54D12*
G54D11*
X3791Y3203D03*
X3791Y3303D03*
X3791Y3403D03*
@ -485,12 +492,6 @@ X3295Y394D03*
X3166Y428D03*
X3391Y503D03*
X2783Y493D03*
X1391Y603D03*
X1166Y228D03*
G54D12*
X466Y228D03*
G54D10*
X591Y428D03*
G54D21*
X2916Y1003D03*
X2884Y1003D03*

View File

@ -9,9 +9,9 @@ G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%OFA0B0*%
%SFA1.0B1.0*%
%ADD10C,0.049370*%
%ADD11C,0.043465*%
%ADD12C,0.082917*%
%ADD13C,0.088000*%
%ADD11C,0.088000*%
%ADD12C,0.043465*%
%ADD13C,0.082917*%
%ADD14C,0.065433*%
%ADD15C,0.084000*%
%ADD16C,0.175354*%
@ -33,21 +33,27 @@ G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%ADD32R,0.084000X0.084000*%
%ADD33R,0.080000X0.080000*%
%ADD34R,0.092000X0.092000*%
%ADD35R,0.060000X0.067874*%
%ADD36R,0.104488X0.112362*%
%ADD37R,0.084803X0.072992*%
%ADD38R,0.096614X0.088740*%
%ADD39R,0.036000X0.090000*%
%ADD40R,0.214724X0.214724*%
%ADD41R,0.001000X0.001000*%
%ADD35R,0.104488X0.112362*%
%ADD36R,0.084803X0.072992*%
%ADD37R,0.096614X0.088740*%
%ADD38R,0.036000X0.090000*%
%ADD39R,0.214724X0.214724*%
%ADD40R,0.001000X0.001000*%
%LNMASK1*%
G90*
G70*
G54D10*
X1916Y878D03*
X1916Y778D03*
X1391Y603D03*
X1216Y228D03*
G54D11*
X466Y228D03*
G54D10*
X591Y428D03*
X1416Y303D03*
X941Y603D03*
X966Y803D03*
X1216Y728D03*
X2216Y1778D03*
X2216Y1903D03*
X2266Y1778D03*
@ -59,7 +65,7 @@ X366Y228D03*
X3491Y3428D03*
X3566Y3178D03*
X191Y3303D03*
G54D11*
G54D12*
X1800Y1767D03*
X1682Y1767D03*
G54D10*
@ -99,7 +105,7 @@ X2816Y2053D03*
X2866Y2053D03*
X2916Y2053D03*
X2966Y2053D03*
G54D12*
G54D13*
X2991Y1178D03*
X1391Y1178D03*
X3091Y1178D03*
@ -188,8 +194,8 @@ X3791Y1378D03*
X2891Y1178D03*
G54D10*
X3566Y803D03*
X2316Y1003D03*
G54D13*
X1791Y1053D03*
G54D11*
X1291Y2428D03*
X2091Y2028D03*
X2091Y2428D03*
@ -401,7 +407,7 @@ X866Y2278D03*
X1391Y1753D03*
X1166Y1753D03*
X891Y1753D03*
G54D13*
G54D11*
X3791Y3203D03*
X3791Y3303D03*
X3791Y3403D03*
@ -448,12 +454,6 @@ X3295Y394D03*
X3166Y428D03*
X3391Y503D03*
X2783Y493D03*
X1391Y603D03*
X1166Y228D03*
G54D13*
X466Y228D03*
G54D10*
X591Y428D03*
G54D22*
X1840Y1878D03*
X1741Y1878D03*
@ -462,8 +462,8 @@ X1840Y1656D03*
X1741Y1656D03*
X1643Y1656D03*
G54D23*
X1897Y1303D03*
X1816Y1303D03*
X2291Y1003D03*
X2210Y1003D03*
X2641Y2728D03*
X2722Y2728D03*
G54D24*
@ -553,8 +553,8 @@ G54D23*
X716Y2978D03*
X797Y2978D03*
G54D29*
X1932Y1403D03*
X1841Y1403D03*
X1966Y1403D03*
X1876Y1403D03*
G54D30*
X916Y2978D03*
X916Y2887D03*
@ -578,8 +578,8 @@ X1066Y653D03*
G54D32*
X2593Y2078D03*
G54D23*
X1941Y978D03*
X1860Y978D03*
X2116Y1003D03*
X2035Y1003D03*
X760Y1578D03*
X841Y1578D03*
G54D33*
@ -594,14 +594,11 @@ X1566Y1478D03*
X1647Y1478D03*
X1566Y1578D03*
X1647Y1578D03*
X1866Y878D03*
X1947Y878D03*
G54D35*
X416Y353D03*
X585Y353D03*
X1941Y1003D03*
X1860Y1003D03*
G54D29*
X2166Y978D03*
X2257Y978D03*
X2116Y878D03*
X2026Y878D03*
G54D23*
X841Y1178D03*
X760Y1178D03*
@ -634,7 +631,7 @@ X1285Y803D03*
G54D28*
X1016Y453D03*
X1016Y534D03*
G54D36*
G54D35*
X2016Y476D03*
X2016Y728D03*
G54D23*
@ -655,17 +652,19 @@ X760Y1478D03*
X2316Y3478D03*
X2235Y3478D03*
G54D28*
X1566Y403D03*
X1566Y484D03*
X1466Y578D03*
X1466Y659D03*
X1466Y403D03*
X1466Y484D03*
G54D23*
X2266Y253D03*
X2185Y253D03*
X1366Y303D03*
X1285Y303D03*
X2266Y253D03*
X2185Y253D03*
G54D28*
X1566Y403D03*
X1566Y484D03*
G54D23*
X841Y1378D03*
X760Y1378D03*
X2766Y428D03*
@ -680,7 +679,7 @@ X1391Y1378D03*
X1310Y1378D03*
X1648Y1378D03*
X1567Y1378D03*
G54D37*
G54D36*
X3641Y853D03*
X3641Y975D03*
X3641Y553D03*
@ -694,7 +693,7 @@ X2316Y3378D03*
X2235Y3378D03*
X1866Y3378D03*
X1947Y3378D03*
G54D38*
G54D37*
X3466Y971D03*
X3466Y853D03*
X3491Y671D03*
@ -777,7 +776,7 @@ X1041Y1578D03*
X1121Y1578D03*
X1041Y1678D03*
X1122Y1678D03*
G54D39*
G54D38*
X2016Y1603D03*
X2066Y1603D03*
X2116Y1603D03*
@ -809,9 +808,9 @@ X691Y928D03*
X772Y928D03*
X772Y1028D03*
X691Y1028D03*
G54D40*
G54D39*
X3148Y701D03*
G54D41*
G54D40*
X545Y2013D02*
X636Y2013D01*
X545Y2012D02*

View File

@ -21,13 +21,12 @@ G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%ADD20R,0.024803X0.032677*%
%ADD21R,0.032677X0.024803*%
%ADD22R,0.087000X0.024000*%
%ADD23R,0.050000X0.057874*%
%ADD24R,0.094488X0.102362*%
%ADD25R,0.074803X0.062992*%
%ADD26R,0.086614X0.078740*%
%ADD27R,0.026000X0.080000*%
%ADD28R,0.204724X0.204724*%
%ADD29R,0.001000X0.001000*%
%ADD23R,0.094488X0.102362*%
%ADD24R,0.074803X0.062992*%
%ADD25R,0.086614X0.078740*%
%ADD26R,0.026000X0.080000*%
%ADD27R,0.204724X0.204724*%
%ADD28R,0.001000X0.001000*%
%LNPASTEMASK1*%
G90*
G70*
@ -52,8 +51,8 @@ X1840Y1656D03*
X1741Y1656D03*
X1643Y1656D03*
G54D14*
X1897Y1303D03*
X1816Y1303D03*
X2291Y1003D03*
X2210Y1003D03*
X2641Y2728D03*
X2722Y2728D03*
G54D15*
@ -143,8 +142,8 @@ G54D14*
X716Y2978D03*
X797Y2978D03*
G54D20*
X1932Y1403D03*
X1841Y1403D03*
X1966Y1403D03*
X1876Y1403D03*
G54D21*
X916Y2978D03*
X916Y2887D03*
@ -166,8 +165,8 @@ X1066Y803D03*
X860Y803D03*
X1066Y653D03*
G54D14*
X1941Y978D03*
X1860Y978D03*
X2116Y1003D03*
X2035Y1003D03*
X760Y1578D03*
X841Y1578D03*
X760Y1678D03*
@ -176,14 +175,11 @@ X1566Y1478D03*
X1647Y1478D03*
X1566Y1578D03*
X1647Y1578D03*
X1866Y878D03*
X1947Y878D03*
G54D23*
X416Y353D03*
X585Y353D03*
X1941Y1003D03*
X1860Y1003D03*
G54D20*
X2166Y978D03*
X2257Y978D03*
X2116Y878D03*
X2026Y878D03*
G54D14*
X841Y1178D03*
X760Y1178D03*
@ -216,7 +212,7 @@ X1285Y803D03*
G54D19*
X1016Y453D03*
X1016Y534D03*
G54D24*
G54D23*
X2016Y476D03*
X2016Y728D03*
G54D14*
@ -237,8 +233,6 @@ X760Y1478D03*
X2316Y3478D03*
X2235Y3478D03*
G54D19*
X1566Y403D03*
X1566Y484D03*
X1466Y578D03*
X1466Y659D03*
X1466Y403D03*
@ -248,6 +242,10 @@ X1366Y303D03*
X1285Y303D03*
X2266Y253D03*
X2185Y253D03*
G54D19*
X1566Y403D03*
X1566Y484D03*
G54D14*
X841Y1378D03*
X760Y1378D03*
X2766Y428D03*
@ -262,7 +260,7 @@ X1391Y1378D03*
X1310Y1378D03*
X1648Y1378D03*
X1567Y1378D03*
G54D25*
G54D24*
X3641Y853D03*
X3641Y975D03*
X3641Y553D03*
@ -276,7 +274,7 @@ X2316Y3378D03*
X2235Y3378D03*
X1866Y3378D03*
X1947Y3378D03*
G54D26*
G54D25*
X3466Y971D03*
X3466Y853D03*
X3491Y671D03*
@ -359,7 +357,7 @@ X1041Y1578D03*
X1121Y1578D03*
X1041Y1678D03*
X1122Y1678D03*
G54D27*
G54D26*
X2016Y1603D03*
X2066Y1603D03*
X2116Y1603D03*
@ -391,9 +389,9 @@ X691Y928D03*
X772Y928D03*
X772Y1028D03*
X691Y1028D03*
G54D28*
G54D27*
X3148Y701D03*
G54D29*
G54D28*
D02*
G04 End of PasteMask1*
M02*

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

Before

Width:  |  Height:  |  Size: 571 KiB

After

Width:  |  Height:  |  Size: 571 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

File diff suppressed because it is too large Load Diff

View File

@ -2,56 +2,177 @@
; THROUGH (PLATED) HOLES START AT T100
M48
INCH
T1C0.165354
T2C0.125984
T100C0.038000
T101C0.038194
T102C0.035000
T103C0.042000
T104C0.015748
T105C0.059055
T106C0.031496
T107C0.031497
T108C0.030000
T109C0.039370
T1C0.125984
T2C0.165354
T100C0.030000
T101C0.039370
T102C0.038000
T103C0.038194
T104C0.035000
T105C0.042000
T106C0.015748
T107C0.059055
T108C0.040000
T109C0.031496
T110C0.031497
%
T1
X003698Y011951
X003717Y002840
T2
X001921Y001914
X005921Y036414
X035421Y036414
X037921Y017414
X001921Y052414
X001921Y001914
T2
X003707Y002865
X003707Y011963
T100
X005932Y015914
X031182Y044414
X017182Y019664
X022921Y010914
X030182Y024914
X015932Y019664
X010921Y015412
X005932Y013914
X026432Y015664
X014421Y010914
X023182Y006664
X025182Y006664
X017921Y008914
X032682Y038414
X011921Y014914
X025932Y011164
X026432Y013664
X034921Y038414
X017182Y021664
X011921Y012914
X028421Y035414
X022921Y008914
X015932Y021664
X010921Y016414
X034932Y043414
X036932Y043414
X003921Y015914
X024932Y015664
X021182Y009414
X028921Y014914
X030421Y035414
X017182Y026414
X015182Y026414
X014421Y008914
X003921Y013914
X031182Y046414
X017921Y010914
X024932Y013664
X032682Y040414
X021182Y007414
X028921Y012914
X025932Y009164
X028182Y024914
X034921Y040414
T101
X030921Y031914
X027921Y033914
X027932Y026414
X030921Y032914
X027932Y027414
X030921Y033914
X030932Y026414
X027932Y028414
X030932Y027414
X027932Y029414
X027921Y030914
X030932Y028414
X027921Y031914
X030932Y029414
X030921Y030914
X027921Y032914
T102
X022432Y025164
X022932Y021414
X034932Y019414
X025432Y026164
X025932Y022414
X019932Y023414
X031932Y021414
X034932Y022414
X028932Y023414
X035921Y014914
X019932Y019414
X022932Y020414
X028932Y019414
X025432Y025164
X025932Y021414
X019932Y022414
X020932Y023414
X031932Y020414
X034932Y021414
X028932Y022414
X020932Y019414
X020432Y026164
X025932Y020414
X019932Y021414
X020932Y022414
X023932Y023414
X034932Y020414
X028932Y021414
X035921Y012914
X032932Y023414
X023932Y019414
X020432Y025164
X019932Y020414
X020932Y021414
X032932Y019414
X023432Y026164
X023932Y022414
X028932Y020414
X032932Y022414
X026932Y023414
X037932Y009914
X020932Y020414
X026932Y019414
X023432Y025164
X023932Y021414
X032932Y021414
X026932Y022414
X029932Y023414
X037932Y008914
X036921Y014914
X023932Y020414
X029932Y019414
X032932Y020414
X026932Y021414
X021932Y023414
X029932Y022414
X030932Y023414
X021932Y019414
X030932Y019414
X021432Y026164
X026932Y020414
X021932Y022414
X029932Y021414
X024932Y023414
X030932Y022414
X024932Y023414
X036921Y012914
X033932Y023414
X024932Y019414
X021432Y025164
X021932Y021414
X033932Y019414
X021932Y021414
X024432Y026164
X018932Y023414
X029932Y020414
X024932Y022414
X030932Y021414
X024932Y022414
X033932Y022414
X027932Y023414
X018932Y019414
X021932Y020414
X027932Y019414
X021932Y020414
X024432Y025164
X018932Y022414
X024932Y021414
X030932Y020414
X024932Y021414
X033932Y021414
X027932Y022414
X020932Y039914
@ -71,117 +192,13 @@ X031932Y019414
X022432Y026164
X027932Y020414
X022932Y022414
X031932Y022414
X025932Y023414
X031932Y022414
X037921Y012914
X034932Y023414
X020932Y040914
X025932Y019414
X022432Y025164
X034932Y019414
X022932Y021414
X025432Y026164
X031932Y021414
X025932Y022414
X019932Y023414
X034932Y022414
X028932Y023414
X035921Y014914
X008421Y009914
X019932Y019414
X028932Y019414
X022932Y020414
X025432Y025164
X031932Y020414
X025932Y021414
X019932Y022414
X020932Y023414
X034932Y021414
X028932Y022414
X008421Y008914
X020932Y019414
X020432Y026164
X025932Y020414
X019932Y021414
X020932Y022414
X034932Y020414
X028932Y021414
X023932Y023414
X035921Y012914
X008421Y007914
X032932Y023414
X023932Y019414
X020432Y025164
X019932Y020414
X020932Y021414
X032932Y019414
X023432Y026164
X028932Y020414
X023932Y022414
X008421Y006914
X026932Y023414
X032932Y022414
X037932Y009914
X026932Y019414
X020932Y020414
X023432Y025164
X023932Y021414
X008421Y005914
X026932Y022414
X032932Y021414
X029932Y023414
X036921Y014914
X037932Y008914
X029932Y019414
X023932Y020414
X008421Y004914
X026932Y021414
X021932Y023414
X032932Y020414
X029932Y022414
X030932Y023414
X021932Y019414
T101
X016920Y017414
X037920Y022414
X025920Y017414
X036921Y035414
X013921Y017414
X037920Y021414
X011320Y036414
X031921Y017414
X036921Y034414
X031921Y036414
X037920Y036414
X011920Y017414
X037920Y020414
X020920Y017414
X020920Y036414
X036921Y033414
X014320Y036414
X034921Y017414
X037920Y035414
X036921Y029414
X019921Y017414
X019921Y036414
X036921Y032414
X008320Y036414
X028921Y017414
X028921Y036414
X032920Y017414
X037920Y034414
X032920Y036414
X036921Y028414
X017920Y017414
X036921Y031414
X017920Y036414
X037920Y033414
X035920Y017414
X036921Y027414
X014921Y017414
X037920Y029414
X036921Y030414
X023921Y017414
T103
X023921Y036414
X012320Y036414
X037920Y032414
@ -219,8 +236,8 @@ X037920Y024414
X033921Y036414
X036921Y021414
X010321Y036414
X018921Y036414
X022920Y017414
X018921Y036414
X007320Y036414
X022920Y036414
X037920Y023414
@ -228,61 +245,52 @@ X016320Y036414
X036921Y036414
X037920Y019414
X036921Y020414
T102
X020921Y044414
X018921Y035414
X027432Y013164
X033921Y015414
X024432Y008164
X013932Y019914
X027432Y009164
X014432Y026914
X031921Y033914
X025932Y027414
X011932Y025914
X008421Y044414
X019932Y012414
X019932Y031414
X035921Y026414
X021921Y031414
X030921Y012414
X033921Y048414
X017182Y037664
X027421Y048414
X026432Y034664
X022921Y035414
X020932Y012414
X031921Y035414
X018921Y048414
X010421Y048414
X035921Y044414
X029421Y044414
X033921Y012414
X016921Y035414
X013182Y010414
X031921Y027914
X031921Y015414
X012421Y044414
X015182Y015914
X013182Y006414
X026432Y029664
X031921Y030914
X021932Y015414
X016682Y027414
X018921Y031414
X021182Y037664
X011932Y021914
X031921Y029414
X032682Y010914
X025421Y048414
X031921Y032414
X020921Y035414
X016920Y017414
X037920Y022414
X025920Y017414
X036921Y035414
X013921Y017414
X037920Y021414
X011320Y036414
X031921Y017414
X036921Y034414
X031921Y036414
X037920Y036414
X011920Y017414
X037920Y020414
X020920Y017414
X020920Y036414
X036921Y033414
X014320Y036414
X034921Y017414
X037920Y035414
X036921Y029414
X019921Y017414
X019921Y036414
X036921Y032414
X008320Y036414
X028921Y017414
X032920Y017414
X028921Y036414
X037920Y034414
X032920Y036414
X036921Y028414
X017920Y017414
X036921Y031414
X017920Y036414
X037920Y033414
X035920Y017414
X036921Y027414
X014921Y017414
X037920Y029414
X036921Y030414
X023921Y017414
T104
X016932Y015914
X014432Y021914
X016432Y018414
X032682Y006914
X016921Y048414
X033921Y044414
X016921Y048414
X018932Y015414
X020682Y027414
X027421Y044414
@ -291,34 +299,34 @@ X012932Y028414
X022921Y031414
X031921Y024914
X031921Y012414
X019921Y010914
X035921Y033914
X019921Y010914
X018921Y044414
X010421Y044414
X021932Y012414
X019921Y006914
X016921Y031414
X013682Y015914
X021932Y027414
X015182Y011914
X021932Y027414
X037921Y048414
X017921Y035414
X009932Y025914
X032921Y015414
X031921Y026414
X020921Y048414
X016921Y030414
X035921Y035414
X016921Y030414
X025182Y034914
X006682Y026914
X018932Y012414
X035921Y027914
X018932Y012414
X031432Y010914
X008421Y048414
X025421Y044414
X020921Y031414
X016932Y011914
X035921Y030914
X016932Y011914
X031432Y006914
X019932Y035414
X016921Y044414
@ -338,179 +346,173 @@ X012932Y023414
X035921Y032414
X013682Y011914
X020932Y015414
X012421Y048414
X037921Y044414
X012421Y048414
X017921Y031414
X009932Y021914
X024432Y012164
X012432Y018414
X035921Y024914
T103
X025952Y006664
X033921Y052414
X023932Y038414
X016921Y049434
X012921Y031914
X013921Y031914
X011421Y051914
X025421Y052414
X014921Y031914
X012421Y051914
X010421Y051914
X037921Y051914
X035921Y051914
X008421Y049434
X036921Y051914
X036921Y039414
X011932Y008414
X036921Y040414
X007921Y034414
X009921Y034414
X023932Y041394
X028421Y051914
X012432Y018414
X020921Y044414
X018921Y035414
X027432Y013164
X033921Y015414
X013932Y019914
X024432Y008164
X027432Y009164
X014432Y026914
X031921Y033914
X025932Y027414
X011932Y025914
X008421Y044414
X019932Y012414
X019932Y031414
X035921Y026414
X021921Y031414
X030921Y012414
X033921Y048414
X017182Y037664
X027421Y048414
X026432Y034664
X022921Y035414
X020932Y012414
X031921Y035414
X035921Y044414
X018921Y048414
X010421Y048414
X029421Y044414
X033921Y012414
X013182Y010414
X016921Y035414
X031921Y027914
X031921Y015414
X012421Y044414
X015182Y015914
X013182Y006414
X026432Y029664
X031921Y030914
X021932Y015414
X016682Y027414
X018921Y031414
X021182Y037664
X011932Y021914
X031921Y029414
X032682Y010914
X025421Y048414
X020921Y035414
X031921Y032414
X016432Y018414
T105
X016921Y052414
X008921Y034414
X029421Y051914
X027421Y051914
X007921Y034414
X009921Y034414
X023932Y041394
X028421Y051914
X033921Y049434
X012921Y034414
X031162Y043414
X008421Y052414
X013921Y034414
X028912Y007914
X028182Y043414
X025421Y049434
X028932Y006664
X018921Y051914
X012921Y034414
X014921Y034414
X031162Y043414
X008421Y052414
X019921Y051914
X013921Y034414
X028182Y043414
X036921Y041414
X011932Y011394
X025421Y049434
X008921Y031914
X007921Y031914
X009921Y031914
X020921Y051914
X025932Y007914
X008921Y031914
T104
X034932Y033414
X025952Y006664
X016921Y049434
X033921Y052414
X023932Y038414
X012921Y031914
X014921Y031914
X012421Y051914
X010421Y051914
X013921Y031914
X011421Y051914
X025421Y052414
X036921Y051914
X037921Y051914
X035921Y051914
X036921Y039414
X008421Y049434
X011932Y008414
X036921Y040414
T106
X019432Y032164
X016432Y023414
X034932Y026914
X034932Y033414
X027932Y039414
X035182Y015664
X038432Y013914
X019432Y032164
X034932Y026914
X011432Y034414
X016182Y033914
T105
T107
X004421Y045398
X022432Y003414
X018432Y003414
X004421Y017804
X004421Y021804
X036432Y003414
X004432Y028304
X034432Y003414
X004432Y032304
X004421Y047398
X012432Y003414
X028432Y003414
X004421Y019804
X004421Y040367
X030432Y003414
X026432Y003414
X004421Y023804
X024432Y003414
X004432Y034304
X004421Y049398
X018432Y003414
X038432Y003414
X004421Y038367
X020432Y003414
X036432Y003414
X016432Y003414
X004421Y043398
X014432Y003414
X032432Y003414
X026432Y003414
X028432Y003414
X004432Y030304
X004421Y045398
X022432Y003414
X038432Y003414
X004421Y017804
X004421Y021804
X016432Y003414
X004432Y028304
T106
T108
X008431Y007914
X008431Y008914
X008432Y009914
X008432Y004913
X008431Y005914
X008431Y006914
T109
X011873Y038914
X008921Y038914
T107
T110
X007421Y024914
X008405Y024914
X006421Y051930
X031921Y052914
X023421Y052914
X014921Y052914
X007421Y017414
X023421Y052914
X008405Y017414
X006421Y052914
X007421Y019914
X031921Y051930
X007421Y022414
X008405Y019914
X023421Y051930
X008405Y022414
X014921Y051930
X007421Y024914
X023421Y051930
X008405Y024914
X006421Y051930
T108
X034921Y038414
X003921Y015914
X017182Y021664
X011921Y012914
X021182Y009414
X034932Y043414
X036932Y043414
X015182Y026414
X024932Y015664
X003921Y013914
X028921Y014914
X030421Y035414
X031182Y046414
X017921Y010914
X017182Y026414
X021182Y007414
X014421Y008914
X025932Y009164
X028182Y024914
X024932Y013664
X032682Y040414
X028921Y012914
X005932Y015914
X031182Y044414
X022921Y010914
X034921Y040414
X015932Y019664
X010921Y015412
X017182Y019664
X005932Y013914
X030182Y024914
X026432Y015664
X023182Y006664
X025182Y006664
X014421Y010914
X017921Y008914
X025932Y011164
X026432Y013664
X032682Y038414
X011921Y014914
X028421Y035414
X022921Y008914
X015932Y021664
X010921Y016414
T109
X027921Y033914
X027932Y026414
X030921Y032914
X027932Y027414
X030921Y033914
X030932Y026414
X027932Y028414
X030932Y027414
X027932Y029414
X027921Y030914
X030932Y028414
X027921Y031914
X030932Y029414
X030921Y030914
X027921Y032914
X030921Y031914
T00
M30

View File

@ -8,45 +8,67 @@ G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%MOIN*%
%OFA0B0*%
%SFA1.0B1.0*%
%ADD10C,0.080000*%
%ADD11C,0.085000*%
%ADD12C,0.049370*%
%ADD13C,0.092000*%
%ADD14C,0.088000*%
%ADD15C,0.135984*%
%ADD16C,0.082917*%
%ADD17C,0.175354*%
%ADD18C,0.061496*%
%ADD19C,0.089370*%
%ADD20C,0.072992*%
%ADD21C,0.109055*%
%ADD22R,0.092000X0.092000*%
%ADD23R,0.085000X0.085000*%
%ADD24R,0.089370X0.089370*%
%ADD25R,0.072992X0.072992*%
%ADD26R,0.109055X0.109055*%
%ADD10C,0.084000*%
%ADD11C,0.175354*%
%ADD12C,0.080000*%
%ADD13C,0.085000*%
%ADD14C,0.049370*%
%ADD15C,0.092000*%
%ADD16C,0.088000*%
%ADD17C,0.135984*%
%ADD18C,0.082917*%
%ADD19C,0.061496*%
%ADD20C,0.089370*%
%ADD21C,0.072992*%
%ADD22C,0.109055*%
%ADD23R,0.084000X0.084000*%
%ADD24R,0.092000X0.092000*%
%ADD25R,0.085000X0.085000*%
%ADD26R,0.089370X0.089370*%
%ADD27R,0.072992X0.072992*%
%ADD28R,0.109055X0.109055*%
%LNMASK0*%
G90*
G70*
G54D10*
X843Y991D03*
X843Y891D03*
X843Y791D03*
X843Y691D03*
X843Y591D03*
X843Y491D03*
G54D11*
X371Y1196D03*
X371Y287D03*
G54D10*
X843Y991D03*
X843Y891D03*
X843Y791D03*
X843Y691D03*
X843Y591D03*
X843Y491D03*
G54D11*
X371Y1196D03*
X371Y287D03*
G54D12*
X2118Y941D03*
X2118Y741D03*
X2518Y666D03*
X2318Y666D03*
G54D11*
G54D13*
X1718Y3766D03*
X2118Y3766D03*
G54D12*
G54D14*
X1943Y3216D03*
X1143Y3441D03*
X1618Y3391D03*
X1643Y2341D03*
G54D13*
G54D15*
X2893Y666D03*
X2595Y666D03*
X2593Y791D03*
X2891Y791D03*
G54D11*
G54D13*
X1893Y1241D03*
X1893Y1541D03*
X1993Y1241D03*
@ -55,7 +77,7 @@ X2093Y1241D03*
X2093Y1541D03*
X2193Y1241D03*
X2193Y1541D03*
G54D14*
G54D16*
X2693Y2341D03*
X3093Y2341D03*
X2193Y2341D03*
@ -159,17 +181,17 @@ X2243Y2516D03*
X2343Y2516D03*
X2443Y2516D03*
X2543Y2516D03*
G54D12*
G54D14*
X3493Y3341D03*
X3843Y1391D03*
X3518Y1566D03*
X3493Y2691D03*
X2793Y3941D03*
G54D15*
G54D17*
X3792Y1741D03*
X3542Y3641D03*
X592Y3641D03*
G54D13*
G54D15*
X992Y3441D03*
X892Y3441D03*
X792Y3441D03*
@ -182,13 +204,13 @@ X1292Y3191D03*
X992Y3191D03*
X892Y3191D03*
X792Y3191D03*
G54D10*
G54D12*
X1092Y1641D03*
X1092Y1541D03*
G54D11*
G54D13*
X1318Y641D03*
X1318Y1041D03*
G54D16*
G54D18*
X2992Y1741D03*
X1392Y1741D03*
X3092Y1741D03*
@ -275,26 +297,16 @@ X3792Y2141D03*
X3792Y2041D03*
X3792Y1941D03*
X2892Y1741D03*
G54D13*
G54D15*
X2393Y3841D03*
X2393Y4139D03*
G54D11*
G54D13*
X1243Y1841D03*
X1643Y1841D03*
G54D17*
X372Y284D03*
X370Y1195D03*
G54D15*
X192Y191D03*
X192Y5241D03*
G54D14*
X842Y991D03*
X842Y891D03*
X842Y791D03*
X842Y691D03*
X842Y591D03*
X842Y491D03*
G54D11*
G54D13*
X3092Y1241D03*
X3092Y1541D03*
X3192Y1241D03*
@ -303,7 +315,7 @@ X3292Y1241D03*
X3292Y1541D03*
X3392Y1241D03*
X3392Y1541D03*
G54D14*
G54D16*
X3592Y1291D03*
X3692Y1291D03*
X3792Y1291D03*
@ -313,17 +325,17 @@ X3592Y1491D03*
X2093Y3891D03*
X2093Y3991D03*
X2093Y4091D03*
G54D11*
G54D13*
X3143Y1091D03*
X3143Y691D03*
X3268Y1091D03*
X3268Y691D03*
G54D14*
G54D16*
X3518Y991D03*
X3518Y891D03*
X3793Y991D03*
X3793Y891D03*
G54D11*
G54D13*
X3592Y2491D03*
X3192Y2491D03*
X2292Y3541D03*
@ -340,11 +352,11 @@ X2092Y3041D03*
X1692Y3041D03*
X3592Y3541D03*
X3192Y3541D03*
G54D13*
G54D15*
X3692Y4141D03*
X3692Y4041D03*
X3692Y3941D03*
G54D10*
G54D12*
X3693Y4341D03*
X3493Y4341D03*
X3492Y4041D03*
@ -353,13 +365,13 @@ X3118Y4641D03*
X3118Y4441D03*
X3268Y4041D03*
X3268Y3841D03*
G54D13*
G54D15*
X3116Y4341D03*
X2818Y4341D03*
G54D18*
G54D19*
X892Y3891D03*
X1187Y3891D03*
G54D19*
G54D20*
X3093Y2641D03*
X2793Y2641D03*
X3093Y2741D03*
@ -376,7 +388,7 @@ X3092Y3291D03*
X2792Y3291D03*
X3092Y3391D03*
X2792Y3391D03*
G54D11*
G54D13*
X3592Y2641D03*
X3192Y2641D03*
X2192Y3541D03*
@ -393,12 +405,12 @@ X1692Y3541D03*
X1692Y3141D03*
X3592Y3391D03*
X3192Y3391D03*
G54D10*
G54D12*
X3018Y2491D03*
X2818Y2491D03*
X3042Y3541D03*
X2842Y3541D03*
G54D11*
G54D13*
X1443Y2191D03*
X1443Y2691D03*
X2518Y2991D03*
@ -415,7 +427,7 @@ X993Y1991D03*
X1393Y1991D03*
X993Y2191D03*
X993Y2591D03*
G54D20*
G54D21*
X841Y1991D03*
X742Y1991D03*
X841Y2491D03*
@ -424,14 +436,14 @@ X841Y1741D03*
X742Y1741D03*
X841Y2241D03*
X742Y2241D03*
G54D11*
G54D13*
X2068Y2741D03*
X1668Y2741D03*
X1693Y1591D03*
X1693Y1191D03*
X1518Y1591D03*
X1518Y1191D03*
G54D10*
G54D12*
X2493Y1366D03*
X2493Y1566D03*
X1792Y1091D03*
@ -440,15 +452,15 @@ X1192Y1291D03*
X1192Y1491D03*
X1442Y1091D03*
X1442Y891D03*
G54D11*
G54D13*
X1992Y691D03*
X1992Y1091D03*
X1368Y1191D03*
X1368Y1591D03*
G54D13*
G54D15*
X1193Y841D03*
X1193Y1139D03*
G54D21*
G54D22*
X443Y2830D03*
X443Y3030D03*
X443Y3230D03*
@ -467,7 +479,7 @@ X1843Y341D03*
X1643Y341D03*
X1443Y341D03*
X1243Y341D03*
G54D10*
G54D12*
X2892Y1291D03*
X2892Y1491D03*
X1593Y1966D03*
@ -482,19 +494,19 @@ X2593Y1116D03*
X2593Y916D03*
X2292Y1091D03*
X2292Y891D03*
G54D11*
G54D13*
X2743Y916D03*
X2743Y1316D03*
X2443Y816D03*
X2443Y1216D03*
X2593Y2741D03*
X2193Y2741D03*
G54D10*
G54D12*
X1518Y2641D03*
X1718Y2641D03*
X1718Y1966D03*
X1718Y2166D03*
G54D11*
G54D13*
X1793Y2641D03*
X1793Y2241D03*
X842Y4441D03*
@ -505,7 +517,7 @@ X1692Y4441D03*
X1692Y4841D03*
X3392Y4441D03*
X3392Y4841D03*
G54D20*
G54D21*
X642Y5193D03*
X642Y5291D03*
X2342Y5193D03*
@ -514,7 +526,7 @@ X1492Y5193D03*
X1492Y5291D03*
X3192Y5193D03*
X3192Y5291D03*
G54D13*
G54D15*
X842Y5241D03*
X842Y4943D03*
X2542Y5241D03*
@ -535,7 +547,7 @@ X2092Y5191D03*
X3592Y5191D03*
X3692Y5191D03*
X3792Y5191D03*
G54D11*
G54D13*
X1042Y4441D03*
X1042Y4841D03*
X2742Y4441D03*
@ -552,7 +564,7 @@ X2092Y4441D03*
X2092Y4841D03*
X3792Y4441D03*
X3792Y4841D03*
G54D21*
G54D22*
X442Y3837D03*
X442Y4037D03*
X442Y1780D03*
@ -563,41 +575,44 @@ X442Y4340D03*
X442Y4540D03*
X442Y4740D03*
X442Y4940D03*
G54D22*
G54D23*
X843Y991D03*
X843Y991D03*
G54D24*
X2894Y666D03*
X2592Y791D03*
G54D23*
G54D25*
X1893Y1241D03*
G54D22*
G54D24*
X992Y3441D03*
X1492Y3441D03*
X1492Y3191D03*
X992Y3191D03*
X2393Y3840D03*
G54D23*
G54D25*
X3092Y1241D03*
G54D22*
G54D24*
X3692Y4141D03*
X3117Y4341D03*
G54D24*
G54D26*
X3093Y2641D03*
X3092Y3091D03*
G54D25*
G54D27*
X841Y1991D03*
X841Y2491D03*
X841Y1741D03*
X841Y2241D03*
G54D22*
G54D24*
X1193Y840D03*
G54D26*
G54D28*
X443Y2830D03*
X3843Y341D03*
G54D25*
G54D27*
X642Y5193D03*
X2342Y5193D03*
X1492Y5193D03*
X3192Y5193D03*
G54D22*
G54D24*
X842Y5242D03*
X2542Y5242D03*
X1692Y5242D03*
@ -606,7 +621,7 @@ X1042Y5191D03*
X2742Y5191D03*
X1892Y5191D03*
X3592Y5191D03*
G54D26*
G54D28*
X442Y3837D03*
X442Y1780D03*
X442Y4340D03*

View File

@ -8,45 +8,57 @@ G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%MOIN*%
%OFA0B0*%
%SFA1.0B1.0*%
%ADD10C,0.080000*%
%ADD11C,0.085000*%
%ADD12C,0.049370*%
%ADD13C,0.092000*%
%ADD14C,0.088000*%
%ADD15C,0.135984*%
%ADD16C,0.082917*%
%ADD17C,0.175354*%
%ADD18C,0.061496*%
%ADD19C,0.089370*%
%ADD20C,0.072992*%
%ADD21C,0.109055*%
%ADD22R,0.092000X0.092000*%
%ADD23R,0.085000X0.085000*%
%ADD24R,0.089370X0.089370*%
%ADD25R,0.072992X0.072992*%
%ADD26R,0.109055X0.109055*%
%ADD10C,0.084000*%
%ADD11C,0.175354*%
%ADD12C,0.080000*%
%ADD13C,0.085000*%
%ADD14C,0.049370*%
%ADD15C,0.092000*%
%ADD16C,0.088000*%
%ADD17C,0.135984*%
%ADD18C,0.082917*%
%ADD19C,0.061496*%
%ADD20C,0.089370*%
%ADD21C,0.072992*%
%ADD22C,0.109055*%
%ADD23R,0.084000X0.084000*%
%ADD24R,0.092000X0.092000*%
%ADD25R,0.085000X0.085000*%
%ADD26R,0.089370X0.089370*%
%ADD27R,0.072992X0.072992*%
%ADD28R,0.109055X0.109055*%
%LNMASK1*%
G90*
G70*
G54D10*
X843Y991D03*
X843Y891D03*
X843Y791D03*
X843Y691D03*
X843Y591D03*
X843Y491D03*
G54D11*
X371Y1196D03*
X371Y287D03*
G54D12*
X2118Y941D03*
X2118Y741D03*
X2518Y666D03*
X2318Y666D03*
G54D11*
G54D13*
X1718Y3766D03*
X2118Y3766D03*
G54D12*
G54D14*
X1943Y3216D03*
X1143Y3441D03*
X1618Y3391D03*
X1643Y2341D03*
G54D13*
G54D15*
X2893Y666D03*
X2595Y666D03*
X2593Y791D03*
X2891Y791D03*
G54D11*
G54D13*
X1893Y1241D03*
X1893Y1541D03*
X1993Y1241D03*
@ -55,7 +67,7 @@ X2093Y1241D03*
X2093Y1541D03*
X2193Y1241D03*
X2193Y1541D03*
G54D14*
G54D16*
X2693Y2341D03*
X3093Y2341D03*
X2193Y2341D03*
@ -159,17 +171,17 @@ X2243Y2516D03*
X2343Y2516D03*
X2443Y2516D03*
X2543Y2516D03*
G54D12*
G54D14*
X3493Y3341D03*
X3843Y1391D03*
X3518Y1566D03*
X3493Y2691D03*
X2793Y3941D03*
G54D15*
G54D17*
X3792Y1741D03*
X3542Y3641D03*
X592Y3641D03*
G54D13*
G54D15*
X992Y3441D03*
X892Y3441D03*
X792Y3441D03*
@ -182,13 +194,13 @@ X1292Y3191D03*
X992Y3191D03*
X892Y3191D03*
X792Y3191D03*
G54D10*
G54D12*
X1092Y1641D03*
X1092Y1541D03*
G54D11*
G54D13*
X1318Y641D03*
X1318Y1041D03*
G54D16*
G54D18*
X2992Y1741D03*
X1392Y1741D03*
X3092Y1741D03*
@ -275,26 +287,16 @@ X3792Y2141D03*
X3792Y2041D03*
X3792Y1941D03*
X2892Y1741D03*
G54D13*
G54D15*
X2393Y3841D03*
X2393Y4139D03*
G54D11*
G54D13*
X1243Y1841D03*
X1643Y1841D03*
G54D17*
X372Y284D03*
X370Y1195D03*
G54D15*
X192Y191D03*
X192Y5241D03*
G54D14*
X842Y991D03*
X842Y891D03*
X842Y791D03*
X842Y691D03*
X842Y591D03*
X842Y491D03*
G54D11*
G54D13*
X3092Y1241D03*
X3092Y1541D03*
X3192Y1241D03*
@ -303,7 +305,7 @@ X3292Y1241D03*
X3292Y1541D03*
X3392Y1241D03*
X3392Y1541D03*
G54D14*
G54D16*
X3592Y1291D03*
X3692Y1291D03*
X3792Y1291D03*
@ -313,17 +315,17 @@ X3592Y1491D03*
X2093Y3891D03*
X2093Y3991D03*
X2093Y4091D03*
G54D11*
G54D13*
X3143Y1091D03*
X3143Y691D03*
X3268Y1091D03*
X3268Y691D03*
G54D14*
G54D16*
X3518Y991D03*
X3518Y891D03*
X3793Y991D03*
X3793Y891D03*
G54D11*
G54D13*
X3592Y2491D03*
X3192Y2491D03*
X2292Y3541D03*
@ -340,11 +342,11 @@ X2092Y3041D03*
X1692Y3041D03*
X3592Y3541D03*
X3192Y3541D03*
G54D13*
G54D15*
X3692Y4141D03*
X3692Y4041D03*
X3692Y3941D03*
G54D10*
G54D12*
X3693Y4341D03*
X3493Y4341D03*
X3492Y4041D03*
@ -353,15 +355,15 @@ X3118Y4641D03*
X3118Y4441D03*
X3268Y4041D03*
X3268Y3841D03*
G54D13*
G54D15*
X3116Y4341D03*
X2818Y4341D03*
G54D18*
X892Y3891D03*
X1187Y3891D03*
X892Y3891D03*
X1187Y3891D03*
G54D19*
X892Y3891D03*
X1187Y3891D03*
X892Y3891D03*
X1187Y3891D03*
G54D20*
X3093Y2641D03*
X2793Y2641D03*
X3093Y2741D03*
@ -378,7 +380,7 @@ X3092Y3291D03*
X2792Y3291D03*
X3092Y3391D03*
X2792Y3391D03*
G54D11*
G54D13*
X3592Y2641D03*
X3192Y2641D03*
X2192Y3541D03*
@ -395,12 +397,12 @@ X1692Y3541D03*
X1692Y3141D03*
X3592Y3391D03*
X3192Y3391D03*
G54D10*
G54D12*
X3018Y2491D03*
X2818Y2491D03*
X3042Y3541D03*
X2842Y3541D03*
G54D11*
G54D13*
X1443Y2191D03*
X1443Y2691D03*
X2518Y2991D03*
@ -417,7 +419,7 @@ X993Y1991D03*
X1393Y1991D03*
X993Y2191D03*
X993Y2591D03*
G54D20*
G54D21*
X841Y1991D03*
X742Y1991D03*
X841Y2491D03*
@ -426,14 +428,14 @@ X841Y1741D03*
X742Y1741D03*
X841Y2241D03*
X742Y2241D03*
G54D11*
G54D13*
X2068Y2741D03*
X1668Y2741D03*
X1693Y1591D03*
X1693Y1191D03*
X1518Y1591D03*
X1518Y1191D03*
G54D10*
G54D12*
X2493Y1366D03*
X2493Y1566D03*
X1792Y1091D03*
@ -442,15 +444,15 @@ X1192Y1291D03*
X1192Y1491D03*
X1442Y1091D03*
X1442Y891D03*
G54D11*
G54D13*
X1992Y691D03*
X1992Y1091D03*
X1368Y1191D03*
X1368Y1591D03*
G54D13*
G54D15*
X1193Y841D03*
X1193Y1139D03*
G54D21*
G54D22*
X443Y2830D03*
X443Y3030D03*
X443Y3230D03*
@ -469,7 +471,7 @@ X1843Y341D03*
X1643Y341D03*
X1443Y341D03*
X1243Y341D03*
G54D10*
G54D12*
X2892Y1291D03*
X2892Y1491D03*
X1593Y1966D03*
@ -484,19 +486,19 @@ X2593Y1116D03*
X2593Y916D03*
X2292Y1091D03*
X2292Y891D03*
G54D11*
G54D13*
X2743Y916D03*
X2743Y1316D03*
X2443Y816D03*
X2443Y1216D03*
X2593Y2741D03*
X2193Y2741D03*
G54D10*
G54D12*
X1518Y2641D03*
X1718Y2641D03*
X1718Y1966D03*
X1718Y2166D03*
G54D11*
G54D13*
X1793Y2641D03*
X1793Y2241D03*
X842Y4441D03*
@ -507,7 +509,7 @@ X1692Y4441D03*
X1692Y4841D03*
X3392Y4441D03*
X3392Y4841D03*
G54D20*
G54D21*
X642Y5193D03*
X642Y5291D03*
X2342Y5193D03*
@ -516,7 +518,7 @@ X1492Y5193D03*
X1492Y5291D03*
X3192Y5193D03*
X3192Y5291D03*
G54D13*
G54D15*
X842Y5241D03*
X842Y4943D03*
X2542Y5241D03*
@ -537,7 +539,7 @@ X2092Y5191D03*
X3592Y5191D03*
X3692Y5191D03*
X3792Y5191D03*
G54D11*
G54D13*
X1042Y4441D03*
X1042Y4841D03*
X2742Y4441D03*
@ -554,7 +556,7 @@ X2092Y4441D03*
X2092Y4841D03*
X3792Y4441D03*
X3792Y4841D03*
G54D21*
G54D22*
X442Y3837D03*
X442Y4037D03*
X442Y1780D03*
@ -565,41 +567,43 @@ X442Y4340D03*
X442Y4540D03*
X442Y4740D03*
X442Y4940D03*
G54D22*
G54D23*
X843Y991D03*
G54D24*
X2894Y666D03*
X2592Y791D03*
G54D23*
G54D25*
X1893Y1241D03*
G54D22*
G54D24*
X992Y3441D03*
X1492Y3441D03*
X1492Y3191D03*
X992Y3191D03*
X2393Y3840D03*
G54D23*
G54D25*
X3092Y1241D03*
G54D22*
G54D24*
X3692Y4141D03*
X3117Y4341D03*
G54D24*
G54D26*
X3093Y2641D03*
X3092Y3091D03*
G54D25*
G54D27*
X841Y1991D03*
X841Y2491D03*
X841Y1741D03*
X841Y2241D03*
G54D22*
G54D24*
X1193Y840D03*
G54D26*
G54D28*
X443Y2830D03*
X3843Y341D03*
G54D25*
G54D27*
X642Y5193D03*
X2342Y5193D03*
X1492Y5193D03*
X3192Y5193D03*
G54D22*
G54D24*
X842Y5242D03*
X2542Y5242D03*
X1692Y5242D03*
@ -608,7 +612,7 @@ X1042Y5191D03*
X2742Y5191D03*
X1892Y5191D03*
X3592Y5191D03*
G54D26*
G54D28*
X442Y3837D03*
X442Y1780D03*
X442Y4340D03*

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 KiB

After

Width:  |  Height:  |  Size: 940 KiB

View File

@ -1,30 +1,33 @@
#ifndef CANCOMMS_H
#define CANCOMMS_H
//These are the page numbers that the Tuner Studio serial protocol uses to transverse the different map and config pages.
#define veMapPage 1
uint8_t currentcanCommand;
uint8_t currentCanPage = 1;//Not the same as the speeduino config page numbers
uint8_t nCanretry = 0; //no of retrys
uint8_t cancmdfail = 0; //command fail yes/no
uint8_t canlisten = 0;
uint8_t Lbuffer[8]; //8 byte buffer to store incomng can data
uint8_t Gdata[9];
uint8_t Glow, Ghigh;
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
HardwareSerial &CANSerial = Serial3;
#elif defined(CORE_STM32)
#if defined(ARDUINO_ARCH_STM32) // STM32GENERIC core
SerialUART &CANSerial = Serial2;
#else //libmaple core aka STM32DUINO
HardwareSerial &CANSerial = Serial2;
#endif
#elif defined(CORE_TEENSY)
HardwareSerial &CANSerial = Serial2;
#endif
void canCommand();//This is the heart of the Command Line Interpeter. All that needed to be done was to make it human readable.
void sendCancommand(uint8_t cmdtype , uint16_t canadddress, uint8_t candata1, uint8_t candata2, uint16_t paramgroup);
#ifndef CANCOMMS_H
#define CANCOMMS_H
//These are the page numbers that the Tuner Studio serial protocol uses to transverse the different map and config pages.
#define veMapPage 1
#define CAN_PACKET_SIZE 75
uint8_t currentcanCommand;
uint8_t currentCanPage = 1;//Not the same as the speeduino config page numbers
uint8_t nCanretry = 0; //no of retrys
uint8_t cancmdfail = 0; //command fail yes/no
uint8_t canlisten = 0;
uint8_t Lbuffer[8]; //8 byte buffer to store incomng can data
uint8_t Gdata[9];
uint8_t Glow, Ghigh;
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
HardwareSerial &CANSerial = Serial3;
#elif defined(CORE_STM32)
#if defined(ARDUINO_ARCH_STM32) // STM32GENERIC core
SerialUART &CANSerial = Serial2;
#else //libmaple core aka STM32DUINO
HardwareSerial &CANSerial = Serial2;
#endif
#elif defined(CORE_TEENSY)
HardwareSerial &CANSerial = Serial2;
#endif
void canCommand();//This is the heart of the Command Line Interpeter. All that needed to be done was to make it human readable.
void sendcanValues(uint16_t offset, uint16_t packetLength, byte cmd, byte portNum);
void sendCancommand(uint8_t cmdtype , uint16_t canadddress, uint8_t candata1, uint8_t candata2, uint16_t sourcecanAddress);
#endif // CANCOMMS_H

View File

@ -18,27 +18,27 @@ void canCommand()
switch (currentcanCommand)
{
case 'A': // sends the bytes of realtime values
sendValues(0, packetSize,0x30,3); //send values to serial3
sendcanValues(0, CAN_PACKET_SIZE, 0x30, 1); //send values to serial3
break;
case 'G': // this is the reply command sent by the Can interface
byte destcaninchannel;
if (CANSerial.available() >= 10)
if (CANSerial.available() >= 9)
{
cancmdfail = CANSerial.read();
destcaninchannel = CANSerial.read();
cancmdfail = CANSerial.read(); //0 == fail, 1 == good.
destcaninchannel = CANSerial.read(); // the input channel that requested the data value
if (cancmdfail != 0)
{ // read all 8 bytes of data.
for (byte Gx = 0; Gx < 8; Gx++) // first two are the can address the data is from. next two are the can address the data is for.then next 1 or two bytes of data
{
Gdata[Gx] = CANSerial.read();
}
Glow = Gdata[(configPage10.caninput_param_start_byte[destcaninchannel]&7)];
if ((BIT_CHECK(configPage10.caninput_param_num_bytes,destcaninchannel))) //if true then num bytes is 2
Glow = Gdata[(configPage10.caninput_source_start_byte[destcaninchannel]&7)];
if ((BIT_CHECK(configPage10.caninput_source_num_bytes,destcaninchannel))) //if true then num bytes is 2
{
if ((configPage10.caninput_param_start_byte[destcaninchannel]&7) < 8) //you cant have a 2 byte value starting at byte 7(8 on the list)
if ((configPage10.caninput_source_start_byte[destcaninchannel]&7) < 8) //you cant have a 2 byte value starting at byte 7(8 on the list)
{
Ghigh = Gdata[((configPage10.caninput_param_start_byte[destcaninchannel]&7)+1)];
Ghigh = Gdata[((configPage10.caninput_source_start_byte[destcaninchannel]&7)+1)];
}
else{Ghigh = 0;}
}
@ -52,14 +52,6 @@ void canCommand()
else{} //continue as command request failed and/or data/device was not available
if (currentStatus.current_caninchannel < 15) // if channel is < 15 then we can do another one
{
currentStatus.current_caninchannel++; //inc to next channel
}
else
{
currentStatus.current_caninchannel = 0; //reset to start
}
}
break;
@ -100,7 +92,7 @@ void canCommand()
offset = word(CANSerial.read(), tmp);
tmp = CANSerial.read();
length = word(CANSerial.read(), tmp);
sendValues(offset, length,Cmd, 3);
sendcanValues(offset, length,Cmd, 1);
//Serial.print(Cmd);
}
else
@ -133,9 +125,127 @@ void canCommand()
break;
}
}
void sendcanValues(uint16_t offset, uint16_t packetLength, byte cmd, byte portType)
{
byte fullStatus[CAN_PACKET_SIZE];
//CAN serial
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)|| defined(CORE_STM32) || defined (CORE_TEENSY) //ATmega2561 does not have Serial3
if (offset == 0)
{
CANSerial.write("A"); //confirm cmd type
}
else
{
CANSerial.write("r"); //confirm cmd type
CANSerial.write(cmd);
}
#endif
currentStatus.spark ^= (-currentStatus.hasSync ^ currentStatus.spark) & (1 << BIT_SPARK_SYNC); //Set the sync bit of the Spark variable to match the hasSync variable
fullStatus[0] = currentStatus.secl; //secl is simply a counter that increments each second. Used to track unexpected resets (Which will reset this count to 0)
fullStatus[1] = currentStatus.status1; //status1 Bitfield
fullStatus[2] = currentStatus.engine; //Engine Status Bitfield
fullStatus[3] = (byte)(divu100(currentStatus.dwell)); //Dwell in ms * 10
fullStatus[4] = lowByte(currentStatus.MAP); //2 bytes for MAP
fullStatus[5] = highByte(currentStatus.MAP);
fullStatus[6] = (byte)(currentStatus.IAT + CALIBRATION_TEMPERATURE_OFFSET); //mat
fullStatus[7] = (byte)(currentStatus.coolant + CALIBRATION_TEMPERATURE_OFFSET); //Coolant ADC
fullStatus[8] = currentStatus.batCorrection; //Battery voltage correction (%)
fullStatus[9] = currentStatus.battery10; //battery voltage
fullStatus[10] = currentStatus.O2; //O2
fullStatus[11] = currentStatus.egoCorrection; //Exhaust gas correction (%)
fullStatus[12] = currentStatus.iatCorrection; //Air temperature Correction (%)
fullStatus[13] = currentStatus.wueCorrection; //Warmup enrichment (%)
fullStatus[14] = lowByte(currentStatus.RPM); //rpm HB
fullStatus[15] = highByte(currentStatus.RPM); //rpm LB
fullStatus[16] = currentStatus.TAEamount; //acceleration enrichment (%)
fullStatus[17] = currentStatus.corrections; //Total GammaE (%)
fullStatus[18] = currentStatus.VE; //Current VE 1 (%)
fullStatus[19] = currentStatus.afrTarget;
fullStatus[20] = lowByte(currentStatus.PW1); //Pulsewidth 1 multiplied by 10 in ms. Have to convert from uS to mS.
fullStatus[21] = highByte(currentStatus.PW1); //Pulsewidth 1 multiplied by 10 in ms. Have to convert from uS to mS.
fullStatus[22] = currentStatus.tpsDOT; //TPS DOT
fullStatus[23] = currentStatus.advance;
fullStatus[24] = currentStatus.TPS; // TPS (0% to 100%)
//Need to split the int loopsPerSecond value into 2 bytes
fullStatus[25] = lowByte(currentStatus.loopsPerSecond);
fullStatus[26] = highByte(currentStatus.loopsPerSecond);
//The following can be used to show the amount of free memory
currentStatus.freeRAM = freeRam();
fullStatus[27] = lowByte(currentStatus.freeRAM); //(byte)((currentStatus.loopsPerSecond >> 8) & 0xFF);
fullStatus[28] = highByte(currentStatus.freeRAM);
fullStatus[29] = (byte)(currentStatus.boostTarget >> 1); //Divide boost target by 2 to fit in a byte
fullStatus[30] = (byte)(currentStatus.boostDuty / 100);
fullStatus[31] = currentStatus.spark; //Spark related bitfield
//rpmDOT must be sent as a signed integer
fullStatus[32] = lowByte(currentStatus.rpmDOT);
fullStatus[33] = highByte(currentStatus.rpmDOT);
fullStatus[34] = currentStatus.ethanolPct; //Flex sensor value (or 0 if not used)
fullStatus[35] = currentStatus.flexCorrection; //Flex fuel correction (% above or below 100)
fullStatus[36] = currentStatus.flexIgnCorrection; //Ignition correction (Increased degrees of advance) for flex fuel
fullStatus[37] = currentStatus.idleLoad;
fullStatus[38] = currentStatus.testOutputs;
fullStatus[39] = currentStatus.O2_2; //O2
fullStatus[40] = currentStatus.baro; //Barometer value
fullStatus[41] = lowByte(currentStatus.canin[0]);
fullStatus[42] = highByte(currentStatus.canin[0]);
fullStatus[43] = lowByte(currentStatus.canin[1]);
fullStatus[44] = highByte(currentStatus.canin[1]);
fullStatus[45] = lowByte(currentStatus.canin[2]);
fullStatus[46] = highByte(currentStatus.canin[2]);
fullStatus[47] = lowByte(currentStatus.canin[3]);
fullStatus[48] = highByte(currentStatus.canin[3]);
fullStatus[49] = lowByte(currentStatus.canin[4]);
fullStatus[50] = highByte(currentStatus.canin[4]);
fullStatus[51] = lowByte(currentStatus.canin[5]);
fullStatus[52] = highByte(currentStatus.canin[5]);
fullStatus[53] = lowByte(currentStatus.canin[6]);
fullStatus[54] = highByte(currentStatus.canin[6]);
fullStatus[55] = lowByte(currentStatus.canin[7]);
fullStatus[56] = highByte(currentStatus.canin[7]);
fullStatus[57] = lowByte(currentStatus.canin[8]);
fullStatus[58] = highByte(currentStatus.canin[8]);
fullStatus[59] = lowByte(currentStatus.canin[9]);
fullStatus[60] = highByte(currentStatus.canin[9]);
fullStatus[61] = lowByte(currentStatus.canin[10]);
fullStatus[62] = highByte(currentStatus.canin[10]);
fullStatus[63] = lowByte(currentStatus.canin[11]);
fullStatus[64] = highByte(currentStatus.canin[11]);
fullStatus[65] = lowByte(currentStatus.canin[12]);
fullStatus[66] = highByte(currentStatus.canin[12]);
fullStatus[67] = lowByte(currentStatus.canin[13]);
fullStatus[68] = highByte(currentStatus.canin[13]);
fullStatus[69] = lowByte(currentStatus.canin[14]);
fullStatus[70] = highByte(currentStatus.canin[14]);
fullStatus[71] = lowByte(currentStatus.canin[15]);
fullStatus[72] = highByte(currentStatus.canin[15]);
fullStatus[73] = currentStatus.tpsADC;
fullStatus[74] = getNextError();
for(byte x=0; x<packetLength; x++)
{
if (portType == 1){ CANSerial.write(fullStatus[offset+x]); }
else if (portType == 2)
{
//sendto canbus transmit routine
}
}
}
// this routine sends a request(either "0" for a "G" , "1" for a "L" , "2" for a "R" to the Can interface or "3" sends the request via the actual local canbus
void sendCancommand(uint8_t cmdtype, uint16_t canaddress, uint8_t candata1, uint8_t candata2, uint16_t paramgroup)
void sendCancommand(uint8_t cmdtype, uint16_t canaddress, uint8_t candata1, uint8_t candata2, uint16_t sourcecanAddress)
{
switch (cmdtype)
{
@ -154,8 +264,8 @@ void sendCancommand(uint8_t cmdtype, uint16_t canaddress, uint8_t candata1, uint
case 2: // requests via serial3
CANSerial.print("R"); //send "R" to request data from the parmagroup can address whos value is sent next
CANSerial.write(candata1); //the currentStatus.current_caninchannel
CANSerial.write(lowByte(paramgroup) ); //send lsb first
CANSerial.write(highByte(paramgroup) );
CANSerial.write(lowByte(sourcecanAddress) ); //send lsb first
CANSerial.write(highByte(sourcecanAddress) );
break;
case 3:

View File

@ -12,7 +12,7 @@
#define canbusPage 9//Config Page 9
#define warmupPage 10 //Config Page 10
#define packetSize 74
#define SERIAL_PACKET_SIZE 75
byte currentPage = 1;//Not the same as the speeduino config page numbers
bool isMap = true;

View File

@ -5,14 +5,11 @@ A full copy of the license may be found in the projects root directory
*/
/*
This is called when a command is received over serial from TunerStudio / Megatune
It parses the command and calls the relevant function
A detailed description of each call can be found at: http://www.msextra.com/doc/ms1extra/COM_RS232.htm
Processes the data on the serial buffer.
Can be either a new command or a continuation of one that is already in progress:
* cmdPending = If a command has started but is wairing on further data to complete
* chunkPending = Specifically for the new receive value method where TS will send a known number of contiguous bytes to be written to a table
*/
//#include "comms.h"
//#include "globals.h"
//#include "storage.h"
void command()
{
@ -22,7 +19,7 @@ void command()
{
case 'A': // send x bytes of realtime values
sendValues(0, packetSize,0x30, 0); //send values to serial0
sendValues(0, SERIAL_PACKET_SIZE, 0x30, 0); //send values to serial0
break;
@ -135,7 +132,7 @@ void command()
break;
case 'Q': // send code version
Serial.print("speeduino 201710-dev");
Serial.print("speeduino 201711-dev");
break;
case 'r': //New format for the optimised OutputChannels
@ -165,7 +162,7 @@ void command()
break;
case 'S': // send code version
Serial.print("Speeduino 2017.10-dev");
Serial.print("Speeduino 2017.11-dev");
currentStatus.secl = 0; //This is required in TS3 due to its stricter timings
break;
@ -226,8 +223,8 @@ void command()
//7 bytes required:
//2 - Page identifier
//2 - offset
//2 - Length (Should always be 1 until chunk write is setup)
//1 - New value
//2 - Length
//1 - 1st New value
if(Serial.available() >= 7)
{
byte offset1, offset2, length1, length2;
@ -245,6 +242,7 @@ void command()
chunkPending = true;
chunkComplete = 0;
}
if(chunkComplete >= chunkSize) { cmdPending = false; chunkPending = false; }
}
//This CANNOT be an else of the above if statement as chunkPending gets set to true above
if(chunkPending == true)
@ -259,6 +257,7 @@ void command()
break;
case 'Z': //Totally non-standard testing function. Will be removed once calibration testing is completed. This function takes 1.5kb of program space! :S
#ifndef SMALL_FLASH_MODE
Serial.println(F("Coolant"));
for (int x = 0; x < CALIBRATION_TABLE_SIZE; x++)
{
@ -288,6 +287,7 @@ void command()
Serial.println(configPage1.wueValues[x]);
}
Serial.flush();
#endif
break;
case 'z': //Send 256 tooth log entries to a terminal emulator
@ -295,6 +295,7 @@ void command()
break;
case '?':
#ifndef SMALL_FLASH_MODE
Serial.println
(F(
"\n"
@ -322,6 +323,7 @@ void command()
"r - Displays 256 tooth log entries\n"
"? - Displays this help page"
));
#endif
break;
@ -336,7 +338,7 @@ This function returns the current values of a fixed group of variables
//void sendValues(int packetlength, byte portNum)
void sendValues(uint16_t offset, uint16_t packetLength, byte cmd, byte portNum)
{
byte fullStatus[packetSize];
byte fullStatus[SERIAL_PACKET_SIZE];
if (portNum == 3)
{
@ -362,7 +364,7 @@ void sendValues(uint16_t offset, uint16_t packetLength, byte cmd, byte portNum)
currentStatus.spark ^= (-currentStatus.hasSync ^ currentStatus.spark) & (1 << BIT_SPARK_SYNC); //Set the sync bit of the Spark variable to match the hasSync variable
fullStatus[0] = currentStatus.secl; //secl is simply a counter that increments each second. Used to track unexpected resets (Which will reset this count to 0)
fullStatus[1] = currentStatus.squirt; //Squirt Bitfield
fullStatus[1] = currentStatus.status1; //status1 Bitfield
fullStatus[2] = currentStatus.engine; //Engine Status Bitfield
fullStatus[3] = (byte)(divu100(currentStatus.dwell)); //Dwell in ms * 10
fullStatus[4] = lowByte(currentStatus.MAP); //2 bytes for MAP
@ -377,7 +379,7 @@ void sendValues(uint16_t offset, uint16_t packetLength, byte cmd, byte portNum)
fullStatus[13] = currentStatus.wueCorrection; //Warmup enrichment (%)
fullStatus[14] = lowByte(currentStatus.RPM); //rpm HB
fullStatus[15] = highByte(currentStatus.RPM); //rpm LB
fullStatus[16] = currentStatus.TAEamount; //acceleration enrichment (%)
fullStatus[16] = (byte)(currentStatus.TAEamount >> 1); //TPS acceleration enrichment (%) divided by 2 (Can exceed 255)
fullStatus[17] = currentStatus.corrections; //Total GammaE (%)
fullStatus[18] = currentStatus.VE; //Current VE 1 (%)
fullStatus[19] = currentStatus.afrTarget;
@ -563,7 +565,7 @@ void receiveValue(int valueOffset, byte newValue)
}
break;
case boostvvtPage: //Boost and VVT maps (8x8)
case boostvvtPage: //Boost, VVT and staging maps (all 8x8)
if (valueOffset < 64) //New value is part of the boost map
{
boostTable.values[7 - (valueOffset / 8)][valueOffset % 8] = newValue;
@ -576,6 +578,7 @@ void receiveValue(int valueOffset, byte newValue)
{
boostTable.axisY[(7 - (valueOffset - 72))] = int(newValue); //TABLE_LOAD_MULTIPLIER is NOT used for boost as it is TPS based (0-100)
}
//End of boost table
else if (valueOffset < 144) //New value is part of the vvt map
{
tempOffset = valueOffset - 80;
@ -586,11 +589,27 @@ void receiveValue(int valueOffset, byte newValue)
tempOffset = valueOffset - 144;
vvtTable.axisX[tempOffset] = int(newValue) * TABLE_RPM_MULTIPLIER; //The RPM values sent by TunerStudio are divided by 100, need to multiply it back by 100 to make it correct (TABLE_RPM_MULTIPLIER)
}
else if (valueOffset < 161) //New value is on the Y (Load) axis of the vvt table
else if (valueOffset < 160) //New value is on the Y (Load) axis of the vvt table
{
tempOffset = valueOffset - 152;
vvtTable.axisY[(7 - tempOffset)] = int(newValue); //TABLE_LOAD_MULTIPLIER is NOT used for vvt as it is TPS based (0-100)
}
//End of vvt table
else if (valueOffset < 224) //New value is part of the staging map
{
tempOffset = valueOffset - 160;
stagingTable.values[7 - (tempOffset / 8)][tempOffset % 8] = newValue;
}
else if (valueOffset < 232) //New value is on the X (RPM) axis of the staging table
{
tempOffset = valueOffset - 224;
stagingTable.axisX[tempOffset] = int(newValue) * TABLE_RPM_MULTIPLIER; //The RPM values sent by TunerStudio are divided by 100, need to multiply it back by 100 to make it correct (TABLE_RPM_MULTIPLIER)
}
else if (valueOffset < 240) //New value is on the Y (Load) axis of the staging table
{
tempOffset = valueOffset - 232;
stagingTable.axisY[(7 - tempOffset)] = int(newValue) * TABLE_LOAD_MULTIPLIER;
}
break;
case seqFuelPage:
@ -849,17 +868,23 @@ void sendPage(bool useChar)
else
{
//Need to perform a translation of the values[MAP/TPS][RPM] into the MS expected format
byte response[160]; //Bit hacky, but the size is: (8x8 + 8 + 8) + (8x8 + 8 + 8) = 160
byte response[80]; //Bit hacky, but send 1 map at a time (Each map is 8x8, so 64 + 8 + 8)
//Boost table
for (int x = 0; x < 64; x++) { response[x] = boostTable.values[7 - (x / 8)][x % 8]; }
for (int x = 64; x < 72; x++) { response[x] = byte(boostTable.axisX[(x - 64)] / TABLE_RPM_MULTIPLIER); }
for (int y = 72; y < 80; y++) { response[y] = byte(boostTable.axisY[7 - (y - 72)]); }
Serial.write((byte *)&response, 80);
//VVT table
for (int x = 0; x < 64; x++) { response[x + 80] = vvtTable.values[7 - (x / 8)][x % 8]; }
for (int x = 64; x < 72; x++) { response[x + 80] = byte(vvtTable.axisX[(x - 64)] / TABLE_RPM_MULTIPLIER); }
for (int y = 72; y < 80; y++) { response[y + 80] = byte(vvtTable.axisY[7 - (y - 72)]); }
Serial.write((byte *)&response, sizeof(response));
for (int x = 0; x < 64; x++) { response[x] = vvtTable.values[7 - (x / 8)][x % 8]; }
for (int x = 64; x < 72; x++) { response[x] = byte(vvtTable.axisX[(x - 64)] / TABLE_RPM_MULTIPLIER); }
for (int y = 72; y < 80; y++) { response[y] = byte(vvtTable.axisY[7 - (y - 72)]); }
Serial.write((byte *)&response, 80);
//Staging table
for (int x = 0; x < 64; x++) { response[x] = stagingTable.values[7 - (x / 8)][x % 8]; }
for (int x = 64; x < 72; x++) { response[x] = byte(stagingTable.axisX[(x - 64)] / TABLE_RPM_MULTIPLIER); }
for (int y = 72; y < 80; y++) { response[y] = byte(stagingTable.axisY[7 - (y - 72)] / TABLE_LOAD_MULTIPLIER); }
Serial.write((byte *)&response, 80);
sendComplete = true;
}
break;
@ -950,7 +975,9 @@ void sendPage(bool useChar)
break;
default:
#ifndef SMALL_FLASH_MODE
Serial.println(F("\nPage has not been implemented yet"));
#endif
//Just set default Values to avoid warnings
pnt_configPage = &configPage11;
currentTable = fuelTable;
@ -1121,7 +1148,7 @@ byte getPageValue(byte page, uint16_t valueAddress)
else if(valueAddress < 72) { returnValue = byte(boostTable.axisX[(valueAddress - 64)] / TABLE_RPM_MULTIPLIER); }
else if(valueAddress < 80) { returnValue = byte(boostTable.axisY[7 - (valueAddress - 72)]); }
}
else
else if(valueAddress < 160)
{
tempAddress = valueAddress - 80;
//VVT table
@ -1129,6 +1156,14 @@ byte getPageValue(byte page, uint16_t valueAddress)
else if(tempAddress < 72) { returnValue = byte(vvtTable.axisX[(tempAddress - 64)] / TABLE_RPM_MULTIPLIER); }
else if(tempAddress < 80) { returnValue = byte(vvtTable.axisY[7 - (tempAddress - 72)]); }
}
else
{
tempAddress = valueAddress - 160;
//Staging table
if(tempAddress < 64) { returnValue = stagingTable.values[7 - (tempAddress / 8)][tempAddress % 8]; }
else if(tempAddress < 72) { returnValue = byte(stagingTable.axisX[(tempAddress - 64)] / TABLE_RPM_MULTIPLIER); }
else if(tempAddress < 80) { returnValue = byte(stagingTable.axisY[7 - (tempAddress - 72)] / TABLE_LOAD_MULTIPLIER); }
}
}
break;
@ -1181,7 +1216,9 @@ byte getPageValue(byte page, uint16_t valueAddress)
break;
default:
#ifndef SMALL_FLASH_MODE
Serial.println(F("\nPage has not been implemented yet"));
#endif
//Just set default Values to avoid warnings
pnt_configPage = &configPage11;
break;
@ -1324,7 +1361,7 @@ void sendToothLog(bool useChar)
Serial.write(highByte(tempToothHistory[x]));
Serial.write(lowByte(tempToothHistory[x]));
}
BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_TOOTHLOG1READY);
BIT_CLEAR(currentStatus.status1, BIT_STATUS1_TOOTHLOG1READY);
}
toothLogRead = true;
}
@ -1436,4 +1473,4 @@ void commandButtons()
default:
break;
}
}
}

View File

@ -7,18 +7,18 @@ All functions in the gamma file return
void initialiseCorrections();
byte correctionsFuel();
static inline byte correctionWUE(); //Warmup enrichment
static inline byte correctionCranking(); //Cranking enrichment
static inline byte correctionASE(); //After Start Enrichment
static inline byte correctionAccel(); //Acceleration Enrichment
static inline byte correctionFloodClear(); //Check for flood clear on cranking
static inline byte correctionAFRClosedLoop(); //Closed loop AFR adjustment
static inline byte correctionFlex(); //Flex fuel adjustment
static inline byte correctionBatVoltage(); //Battery voltage correction
static inline byte correctionIATDensity(); //Inlet temp density correction
static inline byte correctionLaunch(); //Launch control correction
static inline bool correctionDFCO(); //Decelleration fuel cutoff
static inline byte correctionsFuel() __attribute__((always_inline));
static inline byte correctionWUE() __attribute__((always_inline)); //Warmup enrichment
static inline byte correctionCranking() __attribute__((always_inline)); //Cranking enrichment
static inline byte correctionASE() __attribute__((always_inline)); //After Start Enrichment
static inline int16_t correctionAccel() __attribute__((always_inline)); //Acceleration Enrichment
static inline byte correctionFloodClear() __attribute__((always_inline)); //Check for flood clear on cranking
static inline byte correctionAFRClosedLoop() __attribute__((always_inline)); //Closed loop AFR adjustment
static inline byte correctionFlex() __attribute__((always_inline)); //Flex fuel adjustment
static inline byte correctionBatVoltage() __attribute__((always_inline)); //Battery voltage correction
static inline byte correctionIATDensity() __attribute__((always_inline)); //Inlet temp density correction
static inline byte correctionLaunch() __attribute__((always_inline)); //Launch control correction
static inline bool correctionDFCO() __attribute__((always_inline)); //Decelleration fuel cutoff
int8_t correctionsIgn(int8_t advance);
static inline int8_t correctionFixedTiming(int8_t);
@ -31,4 +31,6 @@ static inline int8_t correctionSoftFlatShift(int8_t);
uint16_t correctionsDwell(uint16_t dwell);
uint16_t AFRnextCycle;
#endif // CORRECTIONS_H

View File

@ -23,13 +23,15 @@ void initialiseCorrections()
{
egoPID.SetMode(AUTOMATIC); //Turn O2 PID on
currentStatus.flexIgnCorrection = 0;
currentStatus.egoCorrection = 100; //Default value of no adjustment must be set to avoid randomness on first correction cycle after startup
AFRnextCycle = 0;
}
/*
correctionsTotal() calls all the other corrections functions and combines their results.
This is the only function that should be called from anywhere outside the file
*/
byte correctionsFuel()
static inline byte correctionsFuel()
{
unsigned long sumCorrections = 100;
byte activeCorrections = 0;
@ -73,8 +75,8 @@ byte correctionsFuel()
currentStatus.launchCorrection = correctionLaunch();
if (currentStatus.launchCorrection != 100) { sumCorrections = (sumCorrections * currentStatus.launchCorrection); activeCorrections++; }
bitWrite(currentStatus.squirt, BIT_SQUIRT_DFCO, correctionDFCO());
if ( bitRead(currentStatus.squirt, BIT_SQUIRT_DFCO) == 1 ) { sumCorrections = 0; }
bitWrite(currentStatus.status1, BIT_STATUS1_DFCO, correctionDFCO());
if ( bitRead(currentStatus.status1, BIT_STATUS1_DFCO) == 1 ) { sumCorrections = 0; }
sumCorrections = sumCorrections / powint(100,activeCorrections);
@ -148,10 +150,11 @@ static inline byte correctionASE()
TPS based acceleration enrichment
Calculates the % change of the throttle over time (%/second) and performs a lookup based on this
When the enrichment is turned on, it runs at that amount for a fixed period of time (taeTime)
Note that as the maximum enrichment amount is +255%, the overall return value from this function can be 100+255=355. Hence this function returns a int16_t rather than byte
*/
static inline byte correctionAccel()
static inline int16_t correctionAccel()
{
byte accelValue = 100;
int16_t accelValue = 100;
//First, check whether the accel. enrichment is already running
if( BIT_CHECK(currentStatus.engine, BIT_ENGINE_ACC) )
{
@ -264,7 +267,7 @@ static inline bool correctionDFCO()
bool DFCOValue = false;
if ( configPage1.dfcoEnabled == 1 )
{
if ( bitRead(currentStatus.squirt, BIT_SQUIRT_DFCO) == 1 ) { DFCOValue = ( currentStatus.RPM > ( configPage2.dfcoRPM * 10) ) && ( currentStatus.TPS < configPage2.dfcoTPSThresh ); }
if ( bitRead(currentStatus.status1, BIT_STATUS1_DFCO) == 1 ) { DFCOValue = ( currentStatus.RPM > ( configPage2.dfcoRPM * 10) ) && ( currentStatus.TPS < configPage2.dfcoTPSThresh ); }
else { DFCOValue = ( currentStatus.RPM > (unsigned int)( (configPage2.dfcoRPM * 10) + configPage2.dfcoHyster) ) && ( currentStatus.TPS < configPage2.dfcoTPSThresh ); }
}
return DFCOValue;
@ -306,21 +309,23 @@ static inline byte correctionAFRClosedLoop()
{
currentStatus.afrTarget = currentStatus.O2; //Catch all incase the below doesn't run. This prevents the Include AFR option from doing crazy things if the AFR target conditions aren't met. This value is changed again below if all conditions are met.
//Check the ignition count to see whether the next step is required
//This if statement is the equivalent of ( (ignitionCount % configPage3.egoCount) == 0 ) but without the expensive modulus operation. ie It results in True every <egoCount> ignition loops. Note that it only works for power of two vlaues for egoCount
//if( (ignitionCount & (configPage3.egoCount - 1)) == 1 )
{
//Determine whether the Y axis of the AFR target table tshould be MAP (Speed-Density) or TPS (Alpha-N)
byte yValue;
if (configPage1.algorithm == 0) { yValue = currentStatus.MAP; }
else { yValue = currentStatus.TPS; }
currentStatus.afrTarget = get3DTableValue(&afrTable, yValue, currentStatus.RPM); //Perform the target lookup
//Determine whether the Y axis of the AFR target table tshould be MAP (Speed-Density) or TPS (Alpha-N)
byte yValue;
if (configPage1.algorithm == 0) { yValue = currentStatus.MAP; }
else { yValue = currentStatus.TPS; }
currentStatus.afrTarget = get3DTableValue(&afrTable, yValue, currentStatus.RPM); //Perform the target lookup
//Check all other requirements for closed loop adjustments
if( (currentStatus.coolant > (int)(configPage3.egoTemp - CALIBRATION_TEMPERATURE_OFFSET)) && (currentStatus.RPM > (unsigned int)(configPage3.egoRPM * 100)) && (currentStatus.TPS < configPage3.egoTPSMax) && (currentStatus.O2 < configPage3.ego_max) && (currentStatus.O2 > configPage3.ego_min) && (currentStatus.runSecs > configPage3.ego_sdelay) )
//Check all other requirements for closed loop adjustments
if( (currentStatus.coolant > (int)(configPage3.egoTemp - CALIBRATION_TEMPERATURE_OFFSET)) && (currentStatus.RPM > (unsigned int)(configPage3.egoRPM * 100)) && (currentStatus.TPS < configPage3.egoTPSMax) && (currentStatus.O2 < configPage3.ego_max) && (currentStatus.O2 > configPage3.ego_min) && (currentStatus.runSecs > configPage3.ego_sdelay) )
{
AFRValue = currentStatus.egoCorrection; //Need to record this here, just to make sure the correction stays 'on' even if the nextCycle count isn't ready
if(ignitionCount >= AFRnextCycle)
{
AFRnextCycle = ignitionCount + configPage3.egoCount; //Set the target ignition event for the next calculation
//Check which algorithm is used, simple or PID
if (configPage3.egoAlgorithm == 0)
if (configPage3.egoAlgorithm == EGO_ALGORITHM_SIMPLE)
{
//*************************************************************************************************************************************
//Simple algorithm
@ -330,7 +335,7 @@ static inline byte correctionAFRClosedLoop()
if(currentStatus.egoCorrection < (100 + configPage3.egoLimit) ) //Fueling adjustment must be at most the egoLimit amount (up or down)
{
if(currentStatus.egoCorrection >= 100) { AFRValue = (currentStatus.egoCorrection + 1); } //Increase the fueling by 1%
else { AFRValue = 100; } //This means that the last reading had been rich, so simply return back to no adjustment (100%)
else { AFRValue += 1; } //This means that the last reading had been rich, so start counting back towards 100%
}
else { AFRValue = currentStatus.egoCorrection; } //Means we're at the maximum adjustment amount, so simply return then again
}
@ -339,11 +344,11 @@ static inline byte correctionAFRClosedLoop()
if(currentStatus.egoCorrection > (100 - configPage3.egoLimit) ) //Fueling adjustment must be at most the egoLimit amount (up or down)
{
if(currentStatus.egoCorrection <= 100) { AFRValue = (currentStatus.egoCorrection - 1); } //Increase the fueling by 1%
else { AFRValue = 100; } //This means that the last reading had been lean, so simply return back to no adjustment (100%)
else { AFRValue -= 1; } //This means that the last reading had been lean, so start count back towards 100%
}
else { AFRValue = currentStatus.egoCorrection; } //Means we're at the maximum adjustment amount, so simply return then again
}
else if(configPage3.egoAlgorithm == 2)
else if(configPage3.egoAlgorithm == EGO_ALGORITHM_PID)
{
//*************************************************************************************************************************************
//PID algorithm
@ -357,9 +362,8 @@ static inline byte correctionAFRClosedLoop()
AFRValue = 100 + PID_output;
}
else { AFRValue = 100; } // Occurs if the egoAlgorithm is set to 0 (No Correction)
} //Multi variable check
} //ignitionCount
} //Ignition count check
} //Multi variable check
} //egoType
return AFRValue; //Catch all (Includes when AFR target = current AFR

View File

@ -46,7 +46,7 @@ volatile unsigned long toothLastMinusOneToothTime = 0; //The time (micros()) tha
volatile unsigned long toothOneTime = 0; //The time (micros()) that tooth 1 last triggered
volatile unsigned long toothOneMinusOneTime = 0; //The 2nd to last time (micros()) that tooth 1 last triggered
volatile bool revolutionOne = 0; // For sequential operation, this tracks whether the current revolution is 1 or 2 (not 1)
volatile unsigned int toothHistory[TOOTH_LOG_BUFFER];
volatile uint16_t toothHistory[TOOTH_LOG_BUFFER];
volatile unsigned int toothHistoryIndex = 0;
volatile bool toothLogRead = false; //Flag to indicate whether the current tooth log values have been read out yet
@ -62,6 +62,7 @@ volatile int triggerToothAngle; //The number of crank degrees that elapse per to
bool secondDerivEnabled; //The use of the 2nd derivative calculation is limited to certain decoders. This is set to either true or false in each decoders setup routine
bool decoderIsSequential; //Whether or not the decoder supports sequential operation
bool decoderIsLowRes = false; //Is set true, certain extra calculations are performed for better timing accuracy
bool decoderHasFixedCrankingTiming = false; //Whether or not the decoder supports fixed cranking timing
byte checkSyncToothCount; //How many teeth must've been seen on this revolution before we try to confirm sync (Useful for missing tooth type decoders)
int16_t ignition1EndTooth = 0;
@ -69,7 +70,7 @@ int16_t ignition2EndTooth = 0;
int16_t ignition3EndTooth = 0;
int16_t ignition4EndTooth = 0;
int toothAngles[24]; //An array for storing fixed tooth angles. Currently sized at 24 for the GM 24X decoder, but may grow later if there are other decoders that use this style
int16_t toothAngles[24]; //An array for storing fixed tooth angles. Currently sized at 24 for the GM 24X decoder, but may grow later if there are other decoders that use this style
//Used for identifying long and short pulses on the 4G63 (And possibly other) trigger patterns
#define LONG 0;

View File

@ -31,7 +31,7 @@ static inline void addToothLogEntry(unsigned long toothTime)
if (toothLogRead)
{
toothHistoryIndex = 0;
BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_TOOTHLOG1READY);
BIT_CLEAR(currentStatus.status1, BIT_STATUS1_TOOTHLOG1READY);
toothLogRead = false; //The tooth log ready bit is cleared to ensure that we only get a set of concurrent values.
}
}
@ -51,7 +51,8 @@ static inline uint16_t stdGetRPM()
if( currentStatus.hasSync == true )
{
if( (BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK)) && (currentStatus.startRevolutions == 0) ) { tempRPM = 0; } //Prevents crazy RPM spike when there has been less than 1 full revolution
if( (currentStatus.RPM < currentStatus.crankRPM) && (currentStatus.startRevolutions == 0) ) { tempRPM = 0; } //Prevents crazy RPM spike when there has been less than 1 full revolution
else if( (toothOneTime == 0) || (toothOneMinusOneTime == 0) ) { tempRPM = 0; }
else
{
noInterrupts();
@ -88,9 +89,9 @@ It takes an argument of the full (COMPLETE) number of teeth per revolution. For
static inline int crankingGetRPM(byte totalTeeth)
{
uint16_t tempRPM = 0;
if( currentStatus.startRevolutions >= 2 )
if( (currentStatus.startRevolutions >= configPage2.StgCycles) && (currentStatus.hasSync == true) )
{
if( (toothLastToothTime > 0) && (toothLastMinusOneToothTime > 0) )
if( (toothLastToothTime > 0) && (toothLastMinusOneToothTime > 0) && (toothLastToothTime > toothLastMinusOneToothTime) )
{
noInterrupts();
revolutionTime = (toothLastToothTime - toothLastMinusOneToothTime) * totalTeeth;
@ -130,14 +131,15 @@ void triggerSetup_missingTooth()
secondDerivEnabled = false;
decoderIsSequential = false;
checkSyncToothCount = (configPage2.triggerTeeth) >> 1; //50% of the total teeth.
toothLastMinusOneToothTime = 0;
toothCurrentCount = 0;
toothOneTime = 0;
toothOneMinusOneTime = 0;
MAX_STALL_TIME = (3333UL * triggerToothAngle * (configPage2.triggerMissingTeeth + 1)); //Minimum 50rpm. (3333uS is the time per degree at 50rpm)
}
void triggerPri_missingTooth()
{
// http://www.msextra.com/forums/viewtopic.php?f=94&t=22976
// http://www.megamanual.com/ms2/wheel.htm
curTime = micros();
curGap = curTime - toothLastToothTime;
if ( curGap >= triggerFilterTime ) //Pulses should never be less than triggerFilterTime, so if they are it means a false trigger. (A 36-1 wheel at 8000pm will have triggers approx. every 200uS)
@ -153,6 +155,8 @@ void triggerPri_missingTooth()
if(configPage2.triggerMissingTeeth == 1) { targetGap = (3 * (toothLastToothTime - toothLastMinusOneToothTime)) >> 1; } //Multiply by 1.5 (Checks for a gap 1.5x greater than the last one) (Uses bitshift to multiply by 3 then divide by 2. Much faster than multiplying by 1.5)
else { targetGap = ((toothLastToothTime - toothLastMinusOneToothTime)) * 2; } //Multiply by 2 (Checks for a gap 2x greater than the last one)
if( (toothLastToothTime == 0) || (toothLastMinusOneToothTime == 0) ) { curGap = 0; }
if ( (curGap > targetGap) || (toothCurrentCount > triggerActualTeeth) )
{
if(toothCurrentCount < (triggerActualTeeth) && (currentStatus.hasSync == true) ) { currentStatus.hasSync = false; } //This occurs when we're at tooth #1, but haven't seen all the other teeth. This indicates a signal issue so we flag lost sync so this will attempt to resync on the next revolution.
@ -198,10 +202,14 @@ void triggerSec_missingTooth()
uint16_t getRPM_missingTooth()
{
uint16_t tempRPM = 0;
if( (currentStatus.RPM < currentStatus.crankRPM) && (toothCurrentCount != 1) ) //Can't do per tooth RPM if we're at tooth #1 as the missing tooth messes the calculation
if( (currentStatus.RPM < currentStatus.crankRPM) )
{
if(configPage2.TrigSpeed == 1) { crankingGetRPM(configPage2.triggerTeeth/2); } //Account for cam speed
else { tempRPM = crankingGetRPM(configPage2.triggerTeeth); }
if(toothCurrentCount != 1)
{
if(configPage2.TrigSpeed == 1) { tempRPM = crankingGetRPM(configPage2.triggerTeeth/2); } //Account for cam speed
else { tempRPM = crankingGetRPM(configPage2.triggerTeeth); }
}
else { tempRPM = currentStatus.RPM; } //Can't do per tooth RPM if we're at tooth #1 as the missing tooth messes the calculation
}
else
{
@ -428,7 +436,7 @@ void triggerSetup_BasicDistributor()
secondDerivEnabled = false;
decoderIsSequential = false;
toothCurrentCount = 0; //Default value
decoderHasFixedCrankingTiming = true;
if(configPage1.nCylinders <= 4) { MAX_STALL_TIME = (1851UL * triggerToothAngle); }//Minimum 90rpm. (1851uS is the time per degree at 90rpm). This uses 90rpm rather than 50rpm due to the potentially very high stall time on a 4 cylinder if we wait that long.
else { MAX_STALL_TIME = (3200UL * triggerToothAngle); } //Minimum 50rpm. (3200uS is the time per degree at 50rpm).
@ -639,6 +647,7 @@ void triggerSetup_4G63()
toothCurrentCount = 99; //Fake tooth count represents no sync
secondDerivEnabled = false;
decoderIsSequential = true;
decoderHasFixedCrankingTiming = true;
MAX_STALL_TIME = 366667UL; //Minimum 50rpm based on the 110 degree tooth spacing
if(initialisationComplete == false) { toothLastToothTime = micros(); } //Set a startup value here to avoid filter errors when starting. This MUST have the initi check to prevent the fuel pump just staying on all the time
//decoderIsLowRes = true;
@ -1398,6 +1407,7 @@ void triggerSetup_Miata9905()
MAX_STALL_TIME = (3333UL * triggerToothAngle); //Minimum 50rpm. (3333uS is the time per degree at 50rpm)
triggerFilterTime = 1500; //10000 rpm, assuming we're triggering on both edges off the crank tooth.
triggerSecFilterTime = 0; //Need to figure out something better for this
decoderHasFixedCrankingTiming = true;
}
void triggerPri_Miata9905()
@ -1573,6 +1583,7 @@ void triggerSetup_MazdaAU()
MAX_STALL_TIME = (3333UL * triggerToothAngle); //Minimum 50rpm. (3333uS is the time per degree at 50rpm)
triggerFilterTime = 1500; //10000 rpm, assuming we're triggering on both edges off the crank tooth.
triggerSecFilterTime = (int)(1000000 / (MAX_RPM / 60 * 2)) / 2; //Same as above, but fixed at 2 teeth on the secondary input and divided by 2 (for cam speed)
decoderHasFixedCrankingTiming = true;
}
void triggerPri_MazdaAU()

View File

@ -25,6 +25,11 @@
#define LED_BUILTIN PA7
#endif
//Specific mode for Bluepill due to its small flash size. This disables a number of strings from being compiled into the flash
#if defined(MCU_STM32F103C8)
#define SMALL_FLASH_MODE
#endif
extern "C" char* sbrk(int incr); //Used to freeRam
inline unsigned char digitalPinToInterrupt(unsigned char Interrupt_pin) { return Interrupt_pin; } //This isn't included in the stm32duino libs (yet)
#if defined(ARDUINO_ARCH_STM32) // STM32GENERIC core
@ -60,15 +65,15 @@
#define BIT_ENGINE_MAPACC 6 // MAP acceleration mode
#define BIT_ENGINE_MAPDCC 7 // MAP decelleration mode
//Define masks for Squirt
#define BIT_SQUIRT_INJ1 0 //inj1 Squirt
#define BIT_SQUIRT_INJ2 1 //inj2 Squirt
#define BIT_SQUIRT_INJ3 2 //inj3 Squirt
#define BIT_SQUIRT_INJ4 3 //inj4 Squirt
#define BIT_SQUIRT_DFCO 4 //Decelleration fuel cutoff
#define BIT_SQUIRT_BOOSTCUT 5 //Fuel component of MAP based boost cut out
#define BIT_SQUIRT_TOOTHLOG1READY 6 //Used to flag if tooth log 1 is ready
#define BIT_SQUIRT_TOOTHLOG2READY 7 //Used to flag if tooth log 2 is ready (Log is not currently used)
//Define masks for Status1
#define BIT_STATUS1_INJ1 0 //inj1
#define BIT_STATUS1_INJ2 1 //inj2
#define BIT_STATUS1_INJ3 2 //inj3
#define BIT_STATUS1_INJ4 3 //inj4
#define BIT_STATUS1_DFCO 4 //Decelleration fuel cutoff
#define BIT_STATUS1_BOOSTCUT 5 //Fuel component of MAP based boost cut out
#define BIT_STATUS1_TOOTHLOG1READY 6 //Used to flag if tooth log 1 is ready
#define BIT_STATUS1_TOOTHLOG2READY 7 //Used to flag if tooth log 2 is ready (Log is not currently used)
//Define masks for spark variable
#define BIT_SPARK_HLAUNCH 0 //Hard Launch indicator
@ -128,7 +133,11 @@
#define EVEN_FIRE 0
#define ODD_FIRE 1
#define EGO_ALGORITHM_SIMPLE 0
#define EGO_ALGORITHM_PID 2
#define MAX_RPM 18000 //This is the maximum rpm that the ECU will attempt to run at. It is NOT related to the rev limiter, but is instead dictates how fast certain operations will be allowed to run. Lower number gives better performance
#define engineSquirtsPerCycle 2 //Would be 1 for a 2 stroke
//Table sizes
#define CALIBRATION_TABLE_SIZE 512
@ -145,13 +154,14 @@ const char TSfirmwareVersion[] = "Speeduino 2016.09";
const byte data_structure_version = 2; //This identifies the data structure when reading / writing.
//const byte page_size = 64;
const int16_t npage_size[11] = {0,288,128,288,128,288,128,160,192,128,192};
const int16_t npage_size[11] = {0,288,128,288,128,288,128,240,192,128,192};
//const byte page11_size = 128;
#define MAP_PAGE_SIZE 288
struct table3D fuelTable; //16x16 fuel map
struct table3D ignitionTable; //16x16 ignition map
struct table3D afrTable; //16x16 afr target map
struct table3D stagingTable; //8x8 fuel staging table
struct table3D boostTable; //8x8 boost map
struct table3D vvtTable; //8x8 vvt map
struct table3D trim1Table; //6x6 Fuel trim 1 map
@ -250,7 +260,7 @@ struct statuses {
byte battery10; //The current BRV in volts (multiplied by 10. Eg 12.5V = 125)
int8_t advance; //Signed 8 bit as advance can now go negative (ATDC)
byte corrections;
byte TAEamount; //The amount of accleration enrichment currently being applied
int16_t TAEamount; //The amount of accleration enrichment currently being applied
byte egoCorrection; //The amount of closed loop AFR enrichment currently being applied
byte wueCorrection; //The amount of warmup enrichment currently being applied
byte batCorrection; //The amount of battery voltage enrichment currently being applied
@ -263,7 +273,7 @@ struct statuses {
bool fanOn; //Whether or not the fan is turned on
volatile byte ethanolPct; //Ethanol reading (if enabled). 0 = No ethanol, 100 = pure ethanol. Eg E85 = 85.
unsigned long TAEEndTime; //The target end time used whenever TAE is turned on
volatile byte squirt;
volatile byte status1;
volatile byte spark;
volatile byte spark2;
byte engine;
@ -311,8 +321,8 @@ struct config1 {
byte pinMapping; // The board / ping mapping to be used
byte tachoPin : 6; //Custom pin setting for tacho output
byte tachoDiv : 2; //Whether to change the tacho speed
byte tdePct; // TPS decelleration (%)
byte taeColdA;
byte unused2_17;
byte unused2_18;
byte tpsThresh;
byte taeTime;
@ -387,7 +397,10 @@ struct config1 {
byte iacCLmaxDuty;
byte boostMinDuty;
byte unused1_64[64];
int8_t baroMin; //Must be signed
uint16_t baroMax;
byte unused1_64[61];
#if defined(CORE_AVR)
};
@ -415,9 +428,9 @@ struct config2 {
byte useResync : 1;
byte sparkDur; //Spark duration in ms * 10
byte IdleAdvRPM;
byte IdleAdvCLT; //The temperature below which the idle is advanced
byte IdleDelayTime;
byte unused4_8;
byte unused4_9;
byte unused4_10;
byte StgCycles; //The number of initial cycles before the ignition should fire when first cranking
byte dwellCont : 1; //Fixed duty dwell control
@ -474,7 +487,7 @@ struct config3 {
byte egoKD;
byte egoTemp; //The temperature above which closed loop functions
byte egoCount; //The number of ignition cylces per step
byte egoDelta; //The step size (In %) when using simple algorithm
byte unused6_6;
byte egoLimit; //Maximum amount the closed loop will vary the fueling
byte ego_min; //AFR must be above this for closed loop to function
byte ego_max; //AFR must be below this for closed loop to function
@ -542,7 +555,7 @@ struct config3 {
byte fanInv : 1; // Fan output inversion bit
byte fanEnable : 1; // Fan enable bit. 0=Off, 1=On/Off
byte fanPin : 5;
byte fanPin : 6;
byte fanSP; // Cooling fan start temperature
byte fanHyster; // Fan hysteresis
byte fanFreq; // Fan PWM frequency
@ -559,9 +572,9 @@ struct config10 {
byte enable_canbus:2;
byte enable_candata_in:1;
uint16_t caninput_sel; //bit status on/off if input is enabled
uint16_t caninput_param_group[16]; //u16 [15] array holding can address of input
uint8_t caninput_param_start_byte[16]; //u08 [15] array holds the start byte number(value of 0-7)
uint16_t caninput_param_num_bytes; //u16 bit status of the number of bytes length 1 or 2
uint16_t caninput_source_can_address[16]; //u16 [15] array holding can address of input
uint8_t caninput_source_start_byte[16]; //u08 [15] array holds the start byte number(value of 0-7)
uint16_t caninput_source_num_bytes; //u16 bit status of the number of bytes length 1 or 2
byte unused10_53;
byte unused10_54;
byte enable_candata_out : 1;
@ -614,7 +627,9 @@ struct config11 {
byte crankingEnrichValues[4];
byte rotaryType : 2;
byte unused11_8c : 6;
byte stagingEnabled : 1;
byte stagingMode : 1;
byte unused11_8e : 4;
byte rotarySplitValues[8];
byte rotarySplitBins[8];
@ -694,6 +709,7 @@ extern struct statuses currentStatus; // from speeduino.ino
extern struct table3D fuelTable; //16x16 fuel map
extern struct table3D ignitionTable; //16x16 ignition map
extern struct table3D afrTable; //16x16 afr target map
extern struct table3D stagingTable; //8x8 afr target map
extern struct table2D taeTable; //4 bin TPS Acceleration Enrichment map (2D)
extern struct table2D WUETable; //10 bin Warm Up Enrichment map (2D)
extern struct table2D crankingEnrichTable; //4 bin cranking Enrichment map (2D)
@ -704,7 +720,7 @@ extern struct config10 configPage10;
extern struct config11 configPage11;
extern unsigned long currentLoopTime; //The time the current loop started (uS)
extern unsigned long previousLoopTime; //The time the previous loop started (uS)
extern byte ignitionCount;
volatile uint16_t ignitionCount; //The count of ignition events that have taken place since the engine started
extern byte cltCalibrationTable[CALIBRATION_TABLE_SIZE];
extern byte iatCalibrationTable[CALIBRATION_TABLE_SIZE];
extern byte o2CalibrationTable[CALIBRATION_TABLE_SIZE];

View File

@ -256,7 +256,7 @@ void idleControl()
case IAC_ALGORITHM_STEP_OL: //Case 4 is open loop stepper control
//First thing to check is whether there is currently a step going on and if so, whether it needs to be turned off
if( isStepperHomed() && !checkForStepping() ) //Check that homing is complete and that there's not currently a step already taking place
if( (checkForStepping() == false) && (isStepperHomed() == true) ) //Check that homing is complete and that there's not currently a step already taking place. MUST BE IN THIS ORDER!
{
//Check for cranking pulsewidth
if( BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK) )
@ -282,7 +282,7 @@ void idleControl()
case IAC_ALGORITHM_STEP_CL://Case 5 is closed loop stepper control
//First thing to check is whether there is currently a step going on and if so, whether it needs to be turned off
if( isStepperHomed() && !checkForStepping() ) //Check that homing is complete and that there's not currently a step already taking place
if( (checkForStepping() == false) && (isStepperHomed() == true) ) //Check that homing is complete and that there's not currently a step already taking place. MUST BE IN THIS ORDER!
{
if( (idleCounter & 31) == 1)
{
@ -319,6 +319,7 @@ static inline byte isStepperHomed()
if( completedHomeSteps < (configPage3.iacStepHome * 3) ) //Home steps are divided by 3 from TS
{
digitalWrite(pinStepperDir, STEPPER_BACKWARD); //Sets stepper direction to backwards
digitalWrite(pinStepperEnable, LOW); //Enable the DRV8825
digitalWrite(pinStepperStep, HIGH);
idleStepper.stepStartTime = micros();
idleStepper.stepperStatus = STEPPING;
@ -394,8 +395,12 @@ static inline void disableIdle()
}
else if ( (configPage3.iacAlgorithm == IAC_ALGORITHM_STEP_CL) || (configPage3.iacAlgorithm == IAC_ALGORITHM_STEP_OL) )
{
digitalWrite(pinStepperEnable, HIGH); //Disable the DRV8825
idleStepper.targetIdleStep = idleStepper.curIdleStep; //Don't try to move anymore
//Only disable the stepper motor if homing is completed
if( isStepperHomed() == true )
{
digitalWrite(pinStepperEnable, HIGH); //Disable the DRV8825
idleStepper.targetIdleStep = idleStepper.curIdleStep; //Don't try to move anymore
}
}
}

View File

@ -4,8 +4,13 @@
int fastMap1023toX(int, int);
unsigned long percentage(byte, unsigned long);
#define degreesToUS(degrees) (decoderIsLowRes == true ) ? ((degrees * 166666UL) / currentStatus.RPM) : degrees * (unsigned long)timePerDegree
//#define degreesToUS(degrees) (decoderIsLowRes == true ) ? ((degrees * 166666UL) / currentStatus.RPM) : (degrees * (unsigned long)timePerDegree)
#define degreesToUS(degrees) ((degrees * revolutionTime) / 360)
//#define degreesToUS(degrees) ((degrees * revolutionTime * 3054198967ULL) >> 40) //Fast version of divide by 360
//#define degreesToUS(degrees) (degrees * (unsigned long)timePerDegree)
#define uSToDegrees(time) (((unsigned long)time * currentStatus.RPM) / 166666)
//#define uSToDegrees(time) ( (((uint64_t)time * currentStatus.RPM * 211107077ULL) >> 45) ) //Crazy magic numbers method from Hackers delight (www.hackersdelight.org/magic.htm)
#define DIV_ROUND_CLOSEST(n, d) ((((n) < 0) ^ ((d) < 0)) ? (((n) - (d)/2)/(d)) : (((n) + (d)/2)/(d)))
//This is a dedicated function that specifically handles the case of mapping 0-1023 values into a 0 to X range

View File

@ -22,14 +22,14 @@ inline void endTrailingCoilCharge1();
inline void endTrailingCoilCharge2();
#define openInjector1() *inj1_pin_port |= (inj1_pin_mask); BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ1)
#define closeInjector1() *inj1_pin_port &= ~(inj1_pin_mask); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ1)
#define openInjector2() *inj2_pin_port |= (inj2_pin_mask); BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ2)
#define closeInjector2() *inj2_pin_port &= ~(inj2_pin_mask); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ2)
#define openInjector3() *inj3_pin_port |= (inj3_pin_mask); BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ3)
#define closeInjector3() *inj3_pin_port &= ~(inj3_pin_mask); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ3)
#define openInjector4() *inj4_pin_port |= (inj4_pin_mask); BIT_SET(currentStatus.squirt, BIT_SQUIRT_INJ4)
#define closeInjector4() *inj4_pin_port &= ~(inj4_pin_mask); BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_INJ4)
#define openInjector1() *inj1_pin_port |= (inj1_pin_mask); BIT_SET(currentStatus.status1, BIT_STATUS1_INJ1)
#define closeInjector1() *inj1_pin_port &= ~(inj1_pin_mask); BIT_CLEAR(currentStatus.status1, BIT_STATUS1_INJ1)
#define openInjector2() *inj2_pin_port |= (inj2_pin_mask); BIT_SET(currentStatus.status1, BIT_STATUS1_INJ2)
#define closeInjector2() *inj2_pin_port &= ~(inj2_pin_mask); BIT_CLEAR(currentStatus.status1, BIT_STATUS1_INJ2)
#define openInjector3() *inj3_pin_port |= (inj3_pin_mask); BIT_SET(currentStatus.status1, BIT_STATUS1_INJ3)
#define closeInjector3() *inj3_pin_port &= ~(inj3_pin_mask); BIT_CLEAR(currentStatus.status1, BIT_STATUS1_INJ3)
#define openInjector4() *inj4_pin_port |= (inj4_pin_mask); BIT_SET(currentStatus.status1, BIT_STATUS1_INJ4)
#define closeInjector4() *inj4_pin_port &= ~(inj4_pin_mask); BIT_CLEAR(currentStatus.status1, BIT_STATUS1_INJ4)
#define openInjector5() *inj5_pin_port |= (inj5_pin_mask)
#define closeInjector5() *inj5_pin_port &= ~(inj5_pin_mask)

View File

@ -77,7 +77,8 @@ See page 136 of the processors datasheet: http://www.atmel.com/Images/doc2549.pd
#define IGN4_TIMER_DISABLE() TIMSK4 &= ~(1 << OCIE4A) //Turn off this output compare unit
#define IGN5_TIMER_DISABLE() TIMSK1 &= ~(1 << OCIE1C) //Turn off this output compare unit
#define MAX_TIMER_PERIOD 262140 //The longest period of time (in uS) that the timer can permit (IN this case it is 65535 * 4, as each timer tick is 4uS)
#define MAX_TIMER_PERIOD 262140UL //The longest period of time (in uS) that the timer can permit (IN this case it is 65535 * 4, as each timer tick is 4uS)
#define MAX_TIMER_PERIOD_SLOW 1048560UL //The longest period of time (in uS) that the timer can permit (IN this case it is 65535 * 16, as each timer tick is 16uS)
#define uS_TO_TIMER_COMPARE(uS1) (uS1 >> 2) //Converts a given number of uS into the required number of timer ticks until that time has passed
//This is a hack until I make all the AVR timers run at the same speed
#define uS_TO_TIMER_COMPARE_SLOW(uS1) (uS1 >> 4)
@ -157,12 +158,14 @@ See page 136 of the processors datasheet: http://www.atmel.com/Images/doc2549.pd
#define IGN8_TIMER_DISABLE() FTM3_C7SC &= ~FTM_CSC_CHIE
#define MAX_TIMER_PERIOD 139808 // 2.13333333uS * 65535
#define MAX_TIMER_PERIOD_SLOW 139808
#define uS_TO_TIMER_COMPARE(uS) ((uS * 15) >> 5) //Converts a given number of uS into the required number of timer ticks until that time has passed.
//Hack compatibility with AVR timers that run at different speeds
#define uS_TO_TIMER_COMPARE_SLOW(uS) ((uS * 15) >> 5)
#elif defined(CORE_STM32)
#define MAX_TIMER_PERIOD 131070 //The longest period of time (in uS) that the timer can permit (IN this case it is 65535 * 2, as each timer tick is 2uS)
#define MAX_TIMER_PERIOD_SLOW 131070 //The longest period of time (in uS) that the timer can permit (IN this case it is 65535 * 2, as each timer tick is 2uS)
#define uS_TO_TIMER_COMPARE(uS) (uS >> 1) //Converts a given number of uS into the required number of timer ticks until that time has passed.
#define uS_TO_TIMER_COMPARE_SLOW(uS) (uS >> 1) //Converts a given number of uS into the required number of timer ticks until that time has passed.
#if defined(ARDUINO_ARCH_STM32) // STM32GENERIC core
@ -279,6 +282,8 @@ void setIgnitionSchedule6(void (*startCallback)(), unsigned long timeout, unsign
void setIgnitionSchedule7(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)());
void setIgnitionSchedule8(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)());
static inline void refreshIgnitionSchedule1(unsigned long timeToEnd) __attribute__((always_inline));
//Needed for STM32 interrupt handlers
#if defined(CORE_STM32)
static inline void fuelSchedule1Interrupt();

View File

@ -254,9 +254,14 @@ void setFuelSchedule1(unsigned long timeout, unsigned long duration)
//fuelSchedule1.EndCallback = endCallback;
fuelSchedule1.duration = duration;
//Need to check that the timeout doesn't exceed the overflow
uint16_t timeout_timer_compare;
if (timeout > MAX_TIMER_PERIOD_SLOW) { timeout_timer_compare = uS_TO_TIMER_COMPARE_SLOW( (MAX_TIMER_PERIOD_SLOW - 1) ); } // If the timeout is >16x (Each tick represents 16uS) the maximum allowed value of unsigned int (65535), the timer compare value will overflow when appliedcausing erratic behaviour such as erroneous sparking.
else { timeout_timer_compare = uS_TO_TIMER_COMPARE_SLOW(timeout); } //Normal case
//The following must be enclosed in the noInterupts block to avoid contention caused if the relevant interrupt fires before the state is fully set
noInterrupts();
fuelSchedule1.startCompare = FUEL1_COUNTER + uS_TO_TIMER_COMPARE_SLOW(timeout);
fuelSchedule1.startCompare = FUEL1_COUNTER + timeout_timer_compare;
fuelSchedule1.endCompare = fuelSchedule1.startCompare + uS_TO_TIMER_COMPARE_SLOW(duration);
fuelSchedule1.Status = PENDING; //Turn this schedule on
fuelSchedule1.schedulesSet++; //Increment the number of times this schedule has been set
@ -286,9 +291,14 @@ void setFuelSchedule2(unsigned long timeout, unsigned long duration)
//fuelSchedule2.EndCallback = endCallback;
fuelSchedule2.duration = duration;
//Need to check that the timeout doesn't exceed the overflow
uint16_t timeout_timer_compare;
if (timeout > MAX_TIMER_PERIOD_SLOW) { timeout_timer_compare = uS_TO_TIMER_COMPARE_SLOW( (MAX_TIMER_PERIOD - 1) ); } // If the timeout is >4x (Each tick represents 4uS) the maximum allowed value of unsigned int (65535), the timer compare value will overflow when appliedcausing erratic behaviour such as erroneous sparking.
else { timeout_timer_compare = uS_TO_TIMER_COMPARE_SLOW(timeout); } //Normal case
//The following must be enclosed in the noInterupts block to avoid contention caused if the relevant interrupt fires before the state is fully set
noInterrupts();
fuelSchedule2.startCompare = FUEL2_COUNTER + uS_TO_TIMER_COMPARE_SLOW(timeout);
fuelSchedule2.startCompare = FUEL2_COUNTER + timeout_timer_compare;
fuelSchedule2.endCompare = fuelSchedule2.startCompare + uS_TO_TIMER_COMPARE_SLOW(duration);
FUEL2_COMPARE = fuelSchedule2.startCompare; //Use the B compare unit of timer 3
fuelSchedule2.Status = PENDING; //Turn this schedule on
@ -315,9 +325,14 @@ void setFuelSchedule3(unsigned long timeout, unsigned long duration)
//fuelSchedule3.EndCallback = endCallback;
fuelSchedule3.duration = duration;
//Need to check that the timeout doesn't exceed the overflow
uint16_t timeout_timer_compare;
if (timeout > MAX_TIMER_PERIOD_SLOW) { timeout_timer_compare = uS_TO_TIMER_COMPARE_SLOW( (MAX_TIMER_PERIOD - 1) ); } // If the timeout is >4x (Each tick represents 4uS) the maximum allowed value of unsigned int (65535), the timer compare value will overflow when appliedcausing erratic behaviour such as erroneous sparking.
else { timeout_timer_compare = uS_TO_TIMER_COMPARE_SLOW(timeout); } //Normal case
//The following must be enclosed in the noInterupts block to avoid contention caused if the relevant interrupt fires before the state is fully set
noInterrupts();
fuelSchedule3.startCompare = FUEL3_COUNTER + uS_TO_TIMER_COMPARE_SLOW(timeout);
fuelSchedule3.startCompare = FUEL3_COUNTER + timeout_timer_compare;
fuelSchedule3.endCompare = fuelSchedule3.startCompare + uS_TO_TIMER_COMPARE_SLOW(duration);
FUEL3_COMPARE = fuelSchedule3.startCompare; //Use the C copmare unit of timer 3
fuelSchedule3.Status = PENDING; //Turn this schedule on
@ -344,9 +359,14 @@ void setFuelSchedule4(unsigned long timeout, unsigned long duration) //Uses time
//fuelSchedule4.EndCallback = endCallback;
fuelSchedule4.duration = duration;
//Need to check that the timeout doesn't exceed the overflow
uint16_t timeout_timer_compare;
if (timeout > MAX_TIMER_PERIOD_SLOW) { timeout_timer_compare = uS_TO_TIMER_COMPARE_SLOW( (MAX_TIMER_PERIOD - 1) ); } // If the timeout is >4x (Each tick represents 4uS) the maximum allowed value of unsigned int (65535), the timer compare value will overflow when appliedcausing erratic behaviour such as erroneous sparking.
else { timeout_timer_compare = uS_TO_TIMER_COMPARE_SLOW(timeout); } //Normal case
//The following must be enclosed in the noInterupts block to avoid contention caused if the relevant interrupt fires before the state is fully set
noInterrupts();
fuelSchedule4.startCompare = FUEL4_COUNTER + uS_TO_TIMER_COMPARE_SLOW(timeout);
fuelSchedule4.startCompare = FUEL4_COUNTER + timeout_timer_compare;
fuelSchedule4.endCompare = fuelSchedule4.startCompare + uS_TO_TIMER_COMPARE_SLOW(duration);
FUEL4_COMPARE = fuelSchedule4.startCompare; //Use the C copmare unit of timer 3
fuelSchedule4.Status = PENDING; //Turn this schedule on
@ -418,6 +438,18 @@ void setIgnitionSchedule1(void (*startCallback)(), unsigned long timeout, unsign
IGN1_TIMER_ENABLE();
}
}
static inline void refreshIgnitionSchedule1(unsigned long timeToEnd)
{
if( (ignitionSchedule1.Status == RUNNING) && (timeToEnd < ignitionSchedule1.duration) )
{
noInterrupts();
ignitionSchedule1.endCompare = IGN1_COUNTER + uS_TO_TIMER_COMPARE(timeToEnd);
IGN1_COMPARE = ignitionSchedule1.endCompare;
interrupts();
}
}
void setIgnitionSchedule2(void (*startCallback)(), unsigned long timeout, unsigned long duration, void(*endCallback)())
{
if(ignitionSchedule2.Status != RUNNING) //Check that we're not already part way through a schedule

View File

@ -1,107 +1,109 @@
#ifndef SENSORS_H
#define SENSORS_H
#include "Arduino.h"
// The following are alpha values for the ADC filters.
// Their values are from 0 to 255 with 0 being no filtering and 255 being maximum
#define ADCFILTER_TPS 128
#define ADCFILTER_CLT 180
#define ADCFILTER_IAT 180
#define ADCFILTER_O2 128
#define ADCFILTER_BAT 128
#define ADCFILTER_MAP 20 //This is only used on Instantaneous MAP readings and is intentionally very weak to allow for faster response
#define ADCFILTER_BARO 64
#define BARO_MIN 87
#define BARO_MAX 108
/*
#if defined(CORE_AVR)
#define ANALOG_ISR
#endif
*/
volatile byte flexCounter = 0;
volatile int AnChannel[15];
unsigned long MAPrunningValue; //Used for tracking either the total of all MAP readings in this cycle (Event average) or the lowest value detected in this cycle (event minimum)
unsigned int MAPcount; //Number of samples taken in the current MAP cycle
uint16_t MAPcurRev; //Tracks which revolution we're sampling on
/*
* Simple low pass IIR filter macro for the analog inputs
* This is effectively implementing the smooth filter from http://playground.arduino.cc/Main/Smooth
* But removes the use of floats and uses 8 bits of fixed precision.
*/
#define ADC_FILTER(input, alpha, prior) (((long)input * (256 - alpha) + ((long)prior * alpha))) >> 8
void instanteneousMAPReading();
void readMAP();
void flexPulse();
#if defined(ANALOG_ISR)
//Analog ISR interrupt routine
/*
ISR(ADC_vect)
{
byte nChannel;
int result = ADCL | (ADCH << 8);
//ADCSRA = 0x6E; // ADC disabled by clearing bit 7(ADEN)
//BIT_CLEAR(ADCSRA, ADIE);
nChannel = ADMUX & 0x07;
#if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
if (nChannel==7) { ADMUX = 0x40; }
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
if(ADCSRB & 0x08) { nChannel += 8; } //8 to 15
if(nChannel == 15)
{
ADMUX = 0x40; //channel 0
ADCSRB = 0x00; //clear MUX5 bit
}
else if (nChannel == 7) //channel 7
{
ADMUX = 0x40;
ADCSRB = 0x08; //Set MUX5 bit
}
#endif
else { ADMUX++; }
AnChannel[nChannel-1] = result;
//BIT_SET(ADCSRA, ADIE);
//ADCSRA = 0xEE; // ADC Interrupt Flag enabled
}
*/
ISR(ADC_vect)
{
byte nChannel = ADMUX & 0x07;
int result = ADCL | (ADCH << 8);
BIT_CLEAR(ADCSRA, ADEN); //Disable ADC for Changing Channel (see chapter 26.5 of datasheet)
#if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
if (nChannel==7) { ADMUX = 0x40; }
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
if( (ADCSRB & 0x08) > 0) { nChannel += 8; } //8 to 15
if(nChannel == 15)
{
ADMUX = 0x40; //channel 0
ADCSRB = 0x00; //clear MUX5 bit
}
else if (nChannel == 7) //channel 7
{
ADMUX = 0x40;
ADCSRB = 0x08; //Set MUX5 bit
}
#endif
else { ADMUX++; }
AnChannel[nChannel] = result;
BIT_SET(ADCSRA, ADEN); //Enable ADC
}
#endif
#endif // SENSORS_H
#ifndef SENSORS_H
#define SENSORS_H
#include "Arduino.h"
// The following are alpha values for the ADC filters.
// Their values are from 0 to 255 with 0 being no filtering and 255 being maximum
#define ADCFILTER_TPS 128
#define ADCFILTER_CLT 180
#define ADCFILTER_IAT 180
#define ADCFILTER_O2 128
#define ADCFILTER_BAT 128
#define ADCFILTER_MAP 20 //This is only used on Instantaneous MAP readings and is intentionally very weak to allow for faster response
#define ADCFILTER_BARO 64
#define BARO_MIN 87
#define BARO_MAX 108
/*
#if defined(CORE_AVR)
#define ANALOG_ISR
#endif
*/
volatile byte flexCounter = 0;
volatile int AnChannel[15];
unsigned long MAPrunningValue; //Used for tracking either the total of all MAP readings in this cycle (Event average) or the lowest value detected in this cycle (event minimum)
unsigned int MAPcount; //Number of samples taken in the current MAP cycle
uint16_t MAPcurRev; //Tracks which revolution we're sampling on
/*
* Simple low pass IIR filter macro for the analog inputs
* This is effectively implementing the smooth filter from http://playground.arduino.cc/Main/Smooth
* But removes the use of floats and uses 8 bits of fixed precision.
*/
#define ADC_FILTER(input, alpha, prior) (((long)input * (256 - alpha) + ((long)prior * alpha))) >> 8
static inline void instanteneousMAPReading() __attribute__((always_inline));
static inline void readMAP() __attribute__((always_inline));
void readTPS();
void flexPulse();
#if defined(ANALOG_ISR)
//Analog ISR interrupt routine
/*
ISR(ADC_vect)
{
byte nChannel;
int result = ADCL | (ADCH << 8);
//ADCSRA = 0x6E; // ADC disabled by clearing bit 7(ADEN)
//BIT_CLEAR(ADCSRA, ADIE);
nChannel = ADMUX & 0x07;
#if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
if (nChannel==7) { ADMUX = 0x40; }
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
if(ADCSRB & 0x08) { nChannel += 8; } //8 to 15
if(nChannel == 15)
{
ADMUX = 0x40; //channel 0
ADCSRB = 0x00; //clear MUX5 bit
}
else if (nChannel == 7) //channel 7
{
ADMUX = 0x40;
ADCSRB = 0x08; //Set MUX5 bit
}
#endif
else { ADMUX++; }
AnChannel[nChannel-1] = result;
//BIT_SET(ADCSRA, ADIE);
//ADCSRA = 0xEE; // ADC Interrupt Flag enabled
}
*/
ISR(ADC_vect)
{
byte nChannel = ADMUX & 0x07;
int result = ADCL | (ADCH << 8);
BIT_CLEAR(ADCSRA, ADEN); //Disable ADC for Changing Channel (see chapter 26.5 of datasheet)
#if defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
if (nChannel==7) { ADMUX = 0x40; }
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
if( (ADCSRB & 0x08) > 0) { nChannel += 8; } //8 to 15
if(nChannel == 15)
{
ADMUX = 0x40; //channel 0
ADCSRB = 0x00; //clear MUX5 bit
}
else if (nChannel == 7) //channel 7
{
ADMUX = 0x40;
ADCSRB = 0x08; //Set MUX5 bit
}
#endif
else { ADMUX++; }
AnChannel[nChannel] = result;
BIT_SET(ADCSRA, ADEN); //Enable ADC
}
#endif
#endif // SENSORS_H

View File

@ -50,7 +50,7 @@ void initialiseADC()
MAPrunningValue = 0;
}
void instanteneousMAPReading()
static inline void instanteneousMAPReading()
{
unsigned int tempReading;
//Instantaneous MAP readings
@ -73,7 +73,7 @@ void instanteneousMAPReading()
}
void readMAP()
static inline void readMAP()
{
unsigned int tempReading;
//MAP Sampling system
@ -121,7 +121,6 @@ void readMAP()
if(currentStatus.MAP < 0) { currentStatus.MAP = 0; } //Sanity check
}
else { instanteneousMAPReading(); }
MAPcurRev = currentStatus.startRevolutions; //Reset the current rev count
MAPrunningValue = 0;
MAPcount = 0;
@ -229,7 +228,7 @@ void readBaro()
currentStatus.baroADC = ADC_FILTER(tempReading, ADCFILTER_BARO, currentStatus.baroADC); //Very weak filter
currentStatus.baro = fastMap10Bit(currentStatus.baroADC, configPage1.mapMin, configPage1.mapMax); //Get the current MAP value
currentStatus.baro = fastMap10Bit(currentStatus.baroADC, configPage1.baroMin, configPage1.baroMax); //Get the current MAP value
}
}

6
speeduino/speeduino.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef SPEEDUINO_H
#define SPEEDUINO_H
static inline unsigned int PW(int REQ_FUEL, byte VE, long MAP, int corrections, int injOpen) __attribute__((always_inline));
#endif

View File

@ -17,14 +17,9 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//**************************************************************************************************
// Config section
#define engineSquirtsPerCycle 2 //Would be 1 for a 2 stroke
//**************************************************************************************************
//https://developer.mbed.org/handbook/C-Data-Types
#include <stdint.h>
#include <stdint.h> //https://developer.mbed.org/handbook/C-Data-Types
//************************************************
#include "speeduino.h"
#include "globals.h"
#include "utils.h"
#include "table.h"
@ -92,7 +87,6 @@ static byte fanLOW = LOW; // Used to invert the cooling fan output
volatile uint16_t mainLoopCount;
byte deltaToothCount = 0; //The last tooth that was used with the deltaV calc
int rpmDelta;
byte ignitionCount;
byte maxIgnOutputs = 1; //Used for rolling rev limiter
byte curRollingCut = 0; //Rolling rev limiter, current ignition channel being cut
uint16_t fixedCrankingOverride = 0;
@ -139,6 +133,7 @@ void setup()
table3D_setSize(&fuelTable, 16);
table3D_setSize(&ignitionTable, 16);
table3D_setSize(&afrTable, 16);
table3D_setSize(&stagingTable, 8);
table3D_setSize(&boostTable, 8);
table3D_setSize(&vvtTable, 8);
table3D_setSize(&trim1Table, 6);
@ -304,7 +299,6 @@ void setup()
currentLoopTime = micros();
mainLoopCount = 0;
ignitionCount = 0;
//Calculate the number of degrees between cylinders
switch (configPage1.nCylinders) {
@ -698,6 +692,8 @@ void loop()
MAPcurRev = 0;
MAPcount = 0;
currentStatus.rpmDOT = 0;
AFRnextCycle = 0;
ignitionCount = 0;
ignitionOn = false;
fuelOn = false;
if (fpPrimed == true) { digitalWrite(pinFuelPump, LOW); fuelPumpOn = false; } //Turn off the fuel pump, but only if the priming is complete
@ -748,26 +744,26 @@ void loop()
{
case 1:
BIT_SET(currentStatus.spark, BIT_SPARK_BOOSTCUT);
BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_BOOSTCUT);
BIT_CLEAR(currentStatus.status1, BIT_STATUS1_BOOSTCUT);
break;
case 2:
BIT_SET(currentStatus.squirt, BIT_SQUIRT_BOOSTCUT);
BIT_SET(currentStatus.status1, BIT_STATUS1_BOOSTCUT);
BIT_CLEAR(currentStatus.spark, BIT_SPARK_BOOSTCUT);
break;
case 3:
BIT_SET(currentStatus.spark, BIT_SPARK_BOOSTCUT);
BIT_SET(currentStatus.squirt, BIT_SQUIRT_BOOSTCUT);
BIT_SET(currentStatus.status1, BIT_STATUS1_BOOSTCUT);
break;
}
}
else
{
BIT_CLEAR(currentStatus.spark, BIT_SPARK_BOOSTCUT);
BIT_CLEAR(currentStatus.squirt, BIT_SQUIRT_BOOSTCUT);
BIT_CLEAR(currentStatus.status1, BIT_STATUS1_BOOSTCUT);
}
//And check whether the tooth log buffer is ready
if(toothHistoryIndex > TOOTH_LOG_SIZE) { BIT_SET(currentStatus.squirt, BIT_SQUIRT_TOOTHLOG1READY); }
if(toothHistoryIndex > TOOTH_LOG_SIZE) { BIT_SET(currentStatus.status1, BIT_STATUS1_TOOTHLOG1READY); }
}
@ -792,56 +788,45 @@ void loop()
if(eepromWritesPending == true) { writeAllConfig(); } //Check for any outstanding EEPROM writes.
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //ATmega2561 does not have Serial3
//if Can interface is enabled then check for serial3 requests.
if (configPage10.enable_canbus == 1) // megas only support can via secondary serial
//if Can interface is enabled then check for external data requests.
if (configPage10.enable_candata_in) //if external data input is enabled
{
if (configPage10.enable_candata_in)
if (configPage10.enable_canbus == 1) // megas only support can via secondary serial
{
if (BIT_CHECK(configPage10.caninput_sel,currentStatus.current_caninchannel)) //if current input channel bit is enabled
for (byte caninChan = 0; caninChan <16 ; caninChan++)
{
sendCancommand(2,0,currentStatus.current_caninchannel,0,((configPage10.caninput_param_group[currentStatus.current_caninchannel]&2047)+256)); //send an R command for data from paramgroup[currentStatus.current_caninchannel]
}
else
{
if (currentStatus.current_caninchannel < 15)
{
currentStatus.current_caninchannel++; //step to next input channel if under 15
}
else
{
currentStatus.current_caninchannel = 0; //reset input channel back to 1
}
currentStatus.current_caninchannel = caninChan;
//currentStatus.canin[14] = currentStatus.current_caninchannel;
currentStatus.canin[13] = ((configPage10.caninput_source_can_address[currentStatus.current_caninchannel]&2047)+0x100);
if (BIT_CHECK(configPage10.caninput_sel,currentStatus.current_caninchannel)) //if current input channel bit is enabled
{
sendCancommand(2,0,currentStatus.current_caninchannel,0,((configPage10.caninput_source_can_address[currentStatus.current_caninchannel]&2047)+0x100));
//send an R command for data from caninput_source_address[currentStatus.current_caninchannel]
}
}
}
}
#elif defined(CORE_STM32) || defined(CORE_TEENSY)
//if serial3io is enabled then check for serial3 requests.
if (configPage10.enable_candata_in)
if (configPage10.enable_candata_in)
{
for (byte caninChan = 0; caninChan <16 ; caninChan++)
{
currentStatus.current_caninchannel == caninChan;
if (BIT_CHECK(configPage10.caninput_sel,currentStatus.current_caninchannel)) //if current input channel is enabled
{
if (configPage10.enable_canbus == 1) //can via secondary serial
{
sendCancommand(2,0,currentStatus.current_caninchannel,0,((configPage10.caninput_param_group[currentStatus.current_caninchannel]&2047)+256)); //send an R command for data from paramgroup[currentStatus.current_caninchannel]
}
else if (configPage10.enable_canbus == 2) // can via internal can module
{
sendCancommand(3,configPage10.speeduino_tsCanId,currentStatus.current_caninchannel,0,configPage10.caninput_param_group[currentStatus.current_caninchannel]); //send via localcanbus the command for data from paramgroup[currentStatus.current_caninchannel]
}
}
else
{
if (currentStatus.current_caninchannel < 15)
{
currentStatus.current_caninchannel++; //step to next input channel if under 15
}
else
{
currentStatus.current_caninchannel = 0; //reset input channel back to 0
}
{
sendCancommand(2,0,currentStatus.current_caninchannel,0,((configPage10.caninput_source_can_address[currentStatus.current_caninchannel]&2047)+256)); //send an R command for data from paramgroup[currentStatus.current_caninchannel]
}
else if (configPage10.enable_canbus == 2) // can via internal can module
{
sendCancommand(3,configPage10.speeduino_tsCanId,currentStatus.current_caninchannel,0,configPage10.caninput_source_can_address[currentStatus.current_caninchannel]); //send via localcanbus the command for data from paramgroup[currentStatus.current_caninchannel]
}
}
}
}
#endif
vvtControl();
idleControl(); //Perform any idle related actions. Even at higher frequencies, running 4x per second is sufficient.
@ -888,17 +873,16 @@ void loop()
{
//Speed Density
currentStatus.VE = get3DTableValue(&fuelTable, currentStatus.MAP, currentStatus.RPM); //Perform lookup into fuel map for RPM vs MAP value
currentStatus.PW1 = PW_SD(req_fuel_uS, currentStatus.VE, currentStatus.MAP, currentStatus.corrections, inj_opentime_uS);
currentStatus.advance = get3DTableValue(&ignitionTable, currentStatus.MAP, currentStatus.RPM) - OFFSET_IGNITION; //As above, but for ignition advance
}
else
{
//Alpha-N
currentStatus.VE = get3DTableValue(&fuelTable, currentStatus.TPS, currentStatus.RPM); //Perform lookup into fuel map for RPM vs TPS value
currentStatus.PW1 = PW_AN(req_fuel_uS, currentStatus.VE, currentStatus.TPS, currentStatus.corrections, inj_opentime_uS); //Calculate pulsewidth using the Alpha-N algorithm (in uS)
currentStatus.advance = get3DTableValue(&ignitionTable, currentStatus.TPS, currentStatus.RPM) - OFFSET_IGNITION; //As above, but for ignition advance
}
currentStatus.PW1 = PW(req_fuel_uS, currentStatus.VE, currentStatus.MAP, currentStatus.corrections, inj_opentime_uS);
currentStatus.advance = correctionsIgn(currentStatus.advance);
int injector1StartAngle = 0;
@ -1200,7 +1184,7 @@ void loop()
int crankAngle = getCrankAngle(timePerDegree);
if (crankAngle > CRANK_ANGLE_MAX_INJ ) { crankAngle -= 360; }
if (fuelOn && currentStatus.PW1 > 0 && !BIT_CHECK(currentStatus.squirt, BIT_SQUIRT_BOOSTCUT))
if (fuelOn && currentStatus.PW1 > 0 && !BIT_CHECK(currentStatus.status1, BIT_STATUS1_BOOSTCUT))
{
if ( (injector1StartAngle <= crankAngle) && (fuelSchedule1.Status == RUNNING) ) { injector1StartAngle += CRANK_ANGLE_MAX_INJ; }
if (injector1StartAngle > crankAngle)
@ -1298,7 +1282,7 @@ void loop()
//Likewise for the ignition
//fixedCrankingOverride is used to extend the dwell during cranking so that the decoder can trigger the spark upon seeing a certain tooth. Currently only available on the basic distributor and 4g63 decoders.
if ( configPage2.ignCranklock && BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK)) { fixedCrankingOverride = currentStatus.dwell * 3; }
if ( configPage2.ignCranklock && BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK) && (decoderHasFixedCrankingTiming == true) ) { fixedCrankingOverride = currentStatus.dwell * 3; }
else { fixedCrankingOverride = 0; }
//Perform an initial check to see if the ignition is turned on (Ignition only turns on after a preset number of cranking revolutions and:
@ -1334,6 +1318,13 @@ void loop()
ign1EndFunction
);
}
/*
if(ignition1EndAngle > crankAngle && configPage2.StgCycles == 0)
{
unsigned long uSToEnd = degreesToUS( (ignition1EndAngle - crankAngle) );
refreshIgnitionSchedule1( uSToEnd + fixedCrankingOverride );
}
*/
tempCrankAngle = crankAngle - channel2IgnDegrees;
if( tempCrankAngle < 0) { tempCrankAngle += CRANK_ANGLE_MAX_IGN; }
@ -1421,3 +1412,51 @@ void loop()
} //Ignition schedules on
} //Has sync and RPM
} //loop()
/*
This function retuns a pulsewidth time (in us) given the following:
REQ_FUEL
VE: Lookup from the main fuel table. This can either have been MAP or TPS based, depending on the algorithm used
MAP: In KPa, read from the sensor (This is used when performing a multiply of the map only. It is applicable in both Speed density and Alpha-N)
GammaE: Sum of Enrichment factors (Cold start, acceleration). This is a multiplication factor (Eg to add 10%, this should be 110)
injDT: Injector dead time. The time the injector take to open minus the time it takes to close (Both in uS)
*/
static inline unsigned int PW(int REQ_FUEL, byte VE, long MAP, int corrections, int injOpen)
{
//Standard float version of the calculation
//return (REQ_FUEL * (float)(VE/100.0) * (float)(MAP/100.0) * (float)(TPS/100.0) * (float)(corrections/100.0) + injOpen);
//Note: The MAP and TPS portions are currently disabled, we use VE and corrections only
uint16_t iVE, iCorrections;
uint16_t iMAP = 100;
uint16_t iAFR = 147;
//100% float free version, does sacrifice a little bit of accuracy, but not much.
iVE = ((unsigned int)VE << 7) / 100;
if ( configPage1.multiplyMAP == true ) {
iMAP = ((unsigned int)MAP << 7) / currentStatus.baro; //Include multiply MAP (vs baro) if enabled
}
if ( (configPage1.includeAFR == true) && (configPage3.egoType == 2)) {
iAFR = ((unsigned int)currentStatus.O2 << 7) / currentStatus.afrTarget; //Include AFR (vs target) if enabled
}
iCorrections = (corrections << 7) / 100;
unsigned long intermediate = ((long)REQ_FUEL * (long)iVE) >> 7; //Need to use an intermediate value to avoid overflowing the long
if ( configPage1.multiplyMAP == true ) {
intermediate = (intermediate * (unsigned long)iMAP) >> 7;
}
if ( (configPage1.includeAFR == true) && (configPage3.egoType == 2) ) {
intermediate = (intermediate * (unsigned long)iAFR) >> 7; //EGO type must be set to wideband for this to be used
}
intermediate = (intermediate * (unsigned long)iCorrections) >> 7;
if (intermediate != 0)
{
//If intermeditate is not 0, we need to add the opening time (0 typically indicates that one of the full fuel cuts is active)
intermediate += injOpen; //Add the injector opening time
if ( intermediate > 65535)
{
intermediate = 65535; //Make sure this won't overflow when we convert to uInt. This means the maximum pulsewidth possible is 65.535mS
}
}
return (unsigned int)(intermediate);
}

View File

@ -510,16 +510,6 @@ void integerPID_ideal::SetOutputLimits(long Min, long Max)
outMin = Min;
outMax = Max;
}
/*
long outMax_resized = outMax * limitMultiplier;
long outMin_resized = outMin * limitMultiplier;
if(*myOutput > outMax_resized) { *myOutput = outMax_resized; }
else if(*myOutput < outMin_resized) { *myOutput = outMin_resized; }
if(ITerm > outMax_resized) ITerm = outMax_resized;
else if(ITerm < outMin_resized) ITerm = outMin_resized;
*/
}
/* Initialize()****************************************************************

View File

@ -94,32 +94,38 @@ Current layout of EEPROM data (Version 3) is as follows (All sizes are in bytes)
#define EEPROM_CONFIG8_MAP2 1339
#define EEPROM_CONFIG8_XBINS2 1403
#define EEPROM_CONFIG8_YBINS2 1411
#define EEPROM_CONFIG8_END 1419
#define EEPROM_CONFIG9_XSIZE1 1419
#define EEPROM_CONFIG9_YSIZE1 1420
#define EEPROM_CONFIG9_MAP1 1421
#define EEPROM_CONFIG9_XBINS1 1457
#define EEPROM_CONFIG9_YBINS1 1463
#define EEPROM_CONFIG9_XSIZE2 1469
#define EEPROM_CONFIG9_YSIZE2 1470
#define EEPROM_CONFIG9_MAP2 1471
#define EEPROM_CONFIG9_XBINS2 1507
#define EEPROM_CONFIG9_YBINS2 1513
#define EEPROM_CONFIG9_XSIZE3 1519
#define EEPROM_CONFIG9_YSIZE3 1520
#define EEPROM_CONFIG9_MAP3 1521
#define EEPROM_CONFIG9_XBINS3 1557
#define EEPROM_CONFIG9_YBINS3 1563
#define EEPROM_CONFIG9_XSIZE4 1569
#define EEPROM_CONFIG9_YSIZE4 1570
#define EEPROM_CONFIG9_MAP4 1571
#define EEPROM_CONFIG9_XBINS4 1607
#define EEPROM_CONFIG9_YBINS4 1613
#define EEPROM_CONFIG10_START 1628
#define EEPROM_CONFIG10_END 1756
#define EEPROM_CONFIG11_START 1756
#define EEPROM_CONFIG11_END 1948
#define EEPROM_CONFIG8_XSIZE3 1419
#define EEPROM_CONFIG8_YSIZE3 1420
#define EEPROM_CONFIG8_MAP3 1421
#define EEPROM_CONFIG8_XBINS3 1485
#define EEPROM_CONFIG8_YBINS3 1493
#define EEPROM_CONFIG8_END 1501
#define EEPROM_CONFIG9_XSIZE1 1501
#define EEPROM_CONFIG9_YSIZE1 1502
#define EEPROM_CONFIG9_MAP1 1503
#define EEPROM_CONFIG9_XBINS1 1539
#define EEPROM_CONFIG9_YBINS1 1545
#define EEPROM_CONFIG9_XSIZE2 1551
#define EEPROM_CONFIG9_YSIZE2 1552
#define EEPROM_CONFIG9_MAP2 1553
#define EEPROM_CONFIG9_XBINS2 1589
#define EEPROM_CONFIG9_YBINS2 1595
#define EEPROM_CONFIG9_XSIZE3 1601
#define EEPROM_CONFIG9_YSIZE3 1602
#define EEPROM_CONFIG9_MAP3 1603
#define EEPROM_CONFIG9_XBINS3 1639
#define EEPROM_CONFIG9_YBINS3 1645
#define EEPROM_CONFIG9_XSIZE4 1651
#define EEPROM_CONFIG9_YSIZE4 1652
#define EEPROM_CONFIG9_MAP4 1653
#define EEPROM_CONFIG9_XBINS4 1689
#define EEPROM_CONFIG9_YBINS4 1695
#define EEPROM_CONFIG10_START 1710
#define EEPROM_CONFIG10_END 1838
#define EEPROM_CONFIG11_START 1838
#define EEPROM_CONFIG11_END 2030
//Calibration data is stored at the end of the EEPROM (This is in case any further calibration tables are needed as they are large blocks)
#define EEPROM_LAST_BARO 2558

View File

@ -212,8 +212,11 @@ void writeConfig(byte tableNum)
if(EEPROM.read(EEPROM_CONFIG8_YSIZE1) != boostTable.ySize) { EEPROM.write(EEPROM_CONFIG8_YSIZE1,boostTable.ySize); writeCounter++; } //Write the boost Table MAP/TPS dimension size
if(EEPROM.read(EEPROM_CONFIG8_XSIZE2) != vvtTable.xSize) { EEPROM.write(EEPROM_CONFIG8_XSIZE2,vvtTable.xSize); writeCounter++; } //Write the vvt Table RPM dimension size
if(EEPROM.read(EEPROM_CONFIG8_YSIZE2) != vvtTable.ySize) { EEPROM.write(EEPROM_CONFIG8_YSIZE2,vvtTable.ySize); writeCounter++; } //Write the vvt Table MAP/TPS dimension size
if(EEPROM.read(EEPROM_CONFIG8_XSIZE3) != stagingTable.xSize) { EEPROM.write(EEPROM_CONFIG8_XSIZE3,stagingTable.xSize); writeCounter++; } //Write the staging Table RPM dimension size
if(EEPROM.read(EEPROM_CONFIG8_YSIZE3) != stagingTable.ySize) { EEPROM.write(EEPROM_CONFIG8_YSIZE3,stagingTable.ySize); writeCounter++; } //Write the staging Table MAP/TPS dimension size
y = EEPROM_CONFIG8_MAP2; //We do the 2 maps together in the same loop
y = EEPROM_CONFIG8_MAP2; //We do the 3 maps together in the same loop
z = EEPROM_CONFIG8_MAP3;
for(int x=EEPROM_CONFIG8_MAP1; x<EEPROM_CONFIG8_XBINS1; x++)
{
if( (writeCounter > EEPROM_MAX_WRITE_BLOCK) ) { break; } //This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
@ -221,10 +224,14 @@ void writeConfig(byte tableNum)
if(EEPROM.read(x) != (boostTable.values[7-(offset/8)][offset%8]) ) { EEPROM.write(x, boostTable.values[7-(offset/8)][offset%8]); writeCounter++; } //Write the 8x8 map
offset = y - EEPROM_CONFIG8_MAP2;
if(EEPROM.read(y) != (vvtTable.values[7-(offset/8)][offset%8]) ) { EEPROM.write(y, vvtTable.values[7-(offset/8)][offset%8]); writeCounter++; } //Write the 8x8 map
offset = z - EEPROM_CONFIG8_MAP3;
if(EEPROM.read(z) != (stagingTable.values[7-(offset/8)][offset%8]) ) { EEPROM.write(z, stagingTable.values[7-(offset/8)][offset%8]); writeCounter++; } //Write the 8x8 map
y++;
z++;
}
//RPM bins
y = EEPROM_CONFIG8_XBINS2;
z = EEPROM_CONFIG8_XBINS3;
for(int x=EEPROM_CONFIG8_XBINS1; x<EEPROM_CONFIG8_YBINS1; x++)
{
if( (writeCounter > EEPROM_MAX_WRITE_BLOCK) ) { break; } //This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
@ -232,10 +239,14 @@ void writeConfig(byte tableNum)
if(EEPROM.read(x) != byte(boostTable.axisX[offset]/TABLE_RPM_MULTIPLIER)) { EEPROM.write(x, byte(boostTable.axisX[offset]/TABLE_RPM_MULTIPLIER)); writeCounter++; } //RPM bins are divided by 100 and converted to a byte
offset = y - EEPROM_CONFIG8_XBINS2;
if(EEPROM.read(y) != byte(vvtTable.axisX[offset]/TABLE_RPM_MULTIPLIER)) { EEPROM.write(y, byte(vvtTable.axisX[offset]/TABLE_RPM_MULTIPLIER)); writeCounter++; } //RPM bins are divided by 100 and converted to a byte
offset = z - EEPROM_CONFIG8_XBINS3;
if(EEPROM.read(z) != byte(stagingTable.axisX[offset]/TABLE_RPM_MULTIPLIER)) { EEPROM.write(z, byte(stagingTable.axisX[offset]/TABLE_RPM_MULTIPLIER)); writeCounter++; } //RPM bins are divided by 100 and converted to a byte
y++;
z++;
}
//TPS/MAP bins
y=EEPROM_CONFIG8_YBINS2;
z=EEPROM_CONFIG8_YBINS3;
for(int x=EEPROM_CONFIG8_YBINS1; x<EEPROM_CONFIG8_XSIZE2; x++)
{
if( (writeCounter > EEPROM_MAX_WRITE_BLOCK) ) { break; } //This is a safety check to make sure we don't attempt to write too much to the EEPROM at a time.
@ -243,7 +254,10 @@ void writeConfig(byte tableNum)
if(EEPROM.read(x) != boostTable.axisY[offset]) { EEPROM.write(x, boostTable.axisY[offset]); writeCounter++; } //TABLE_LOAD_MULTIPLIER is NOT used for boost as it is TPS based (0-100)
offset = y - EEPROM_CONFIG8_YBINS2;
if(EEPROM.read(y) != vvtTable.axisY[offset]) { EEPROM.write(y, vvtTable.axisY[offset]); writeCounter++; } //TABLE_LOAD_MULTIPLIER is NOT used for VVT as it is TPS based (0-100)
offset = z - EEPROM_CONFIG8_YBINS3;
if(EEPROM.read(z) != byte(stagingTable.axisY[offset]/TABLE_LOAD_MULTIPLIER)) { EEPROM.write(z, byte(stagingTable.axisY[offset]/TABLE_LOAD_MULTIPLIER)); writeCounter++; } //RPM bins are divided by 100 and converted to a byte
y++;
z++;
}
if(writeCounter > EEPROM_MAX_WRITE_BLOCK) { eepromWritesPending = true; }
@ -468,41 +482,53 @@ void loadConfig()
//*********************************************************************************************************************************************************************************
// Boost and vvt tables load
int y = EEPROM_CONFIG8_MAP2;
int z = EEPROM_CONFIG8_MAP3;
for(int x=EEPROM_CONFIG8_MAP1; x<EEPROM_CONFIG8_XBINS1; x++)
{
offset = x - EEPROM_CONFIG8_MAP1;
boostTable.values[7-(offset/8)][offset%8] = EEPROM.read(x); //Read the 8x8 map
offset = y - EEPROM_CONFIG8_MAP2;
vvtTable.values[7-(offset/8)][offset%8] = EEPROM.read(y); //Read the 8x8 map
offset = z - EEPROM_CONFIG8_MAP3;
stagingTable.values[7-(offset/8)][offset%8] = EEPROM.read(z); //Read the 8x8 map
y++;
z++;
}
//RPM bins
y = EEPROM_CONFIG8_XBINS2;
z = EEPROM_CONFIG8_XBINS3;
for(int x=EEPROM_CONFIG8_XBINS1; x<EEPROM_CONFIG8_YBINS1; x++)
{
offset = x - EEPROM_CONFIG8_XBINS1;
boostTable.axisX[offset] = (EEPROM.read(x) * TABLE_RPM_MULTIPLIER); //RPM bins are divided by 100 when stored. Multiply them back now
offset = y - EEPROM_CONFIG8_XBINS2;
vvtTable.axisX[offset] = (EEPROM.read(y) * TABLE_RPM_MULTIPLIER); //RPM bins are divided by 100 when stored. Multiply them back now
offset = z - EEPROM_CONFIG8_XBINS3;
stagingTable.axisX[offset] = (EEPROM.read(z) * TABLE_RPM_MULTIPLIER); //RPM bins are divided by 100 when stored. Multiply them back now
y++;
z++;
}
//TPS/MAP bins
y = EEPROM_CONFIG8_YBINS2;
z = EEPROM_CONFIG8_YBINS3;
for(int x=EEPROM_CONFIG8_YBINS1; x<EEPROM_CONFIG8_XSIZE2; x++)
{
offset = x - EEPROM_CONFIG8_YBINS1;
boostTable.axisY[offset] = EEPROM.read(x); //TABLE_LOAD_MULTIPLIER is NOT used for boost as it is TPS based (0-100)
offset = y - EEPROM_CONFIG8_YBINS2;
vvtTable.axisY[offset] = EEPROM.read(y); //TABLE_LOAD_MULTIPLIER is NOT used for VVT as it is TPS based (0-100)
offset = z - EEPROM_CONFIG8_YBINS2;
stagingTable.axisY[offset] = EEPROM.read(z) * TABLE_LOAD_MULTIPLIER;
y++;
z++;
}
//*********************************************************************************************************************************************************************************
// Fuel trim tables load
y = EEPROM_CONFIG9_MAP2;
int z = EEPROM_CONFIG9_MAP3;
z = EEPROM_CONFIG9_MAP3;
int i = EEPROM_CONFIG9_MAP4;
for(int x=EEPROM_CONFIG9_MAP1; x<EEPROM_CONFIG9_XBINS1; x++)
{

View File

@ -8,8 +8,9 @@
void doUpdates()
{
#define CURRENT_DATA_VERSION 6
#define CURRENT_DATA_VERSION 7
uint8_t currentVersion = EEPROM.read(EEPROM_DATA_VERSION);
//May 2017 firmware introduced a -40 offset on the ignition table. Update that table to +40
if(currentVersion == 2)
{
@ -76,6 +77,21 @@ void doUpdates()
EEPROM.write(EEPROM_DATA_VERSION, 6);
loadConfig(); //Reload the config after changing everything in EEPROM
}
//November 2017 added the staging table that comes after boost and vvt in the EEPROM. This required multiple pieces of data being moved around
if(currentVersion == 6)
{
//Data after page 8 has to move back 82 bytes
for(int x=0; x < 529; x++)
{
int endMem = EEPROM_CONFIG11_END - x;
int startMem = endMem - 82; //
byte currentVal = EEPROM.read(startMem);
EEPROM.update(endMem, currentVal);
}
EEPROM.write(EEPROM_DATA_VERSION, 7);
loadConfig(); //Reload the config after changing everything in EEPROM
}
//Final check is always for 255 and 0 (Brand new arduino)
if( (currentVersion == 0) || (currentVersion == 255) )

View File

@ -8,9 +8,6 @@ These are some utility functions and variables used through the main code
uint16_t freeRam ();
void setPinMapping(byte boardID);
unsigned int PW();
unsigned int PW_SD();
unsigned int PW_AN();
//This is dumb, but it'll do for now to get things compiling
#if defined(CORE_STM32)

View File

@ -53,6 +53,7 @@ void setPinMapping(byte boardID)
switch (boardID)
{
case 0:
#ifndef SMALL_FLASH_MODE //No support for bluepill here anyway
//Pin mappings as per the v0.1 shield
pinInjector1 = 8; //Output pin injector 1 is on
pinInjector2 = 9; //Output pin injector 2 is on
@ -79,8 +80,10 @@ void setPinMapping(byte boardID)
pinFuelPump = 4; //Fuel pump output
pinTachOut = 49; //Tacho output pin
pinFlex = 19; // Flex sensor (Must be external interrupt enabled)
#endif
break;
case 1:
#ifndef SMALL_FLASH_MODE //No support for bluepill here anyway
//Pin mappings as per the v0.2 shield
pinInjector1 = 8; //Output pin injector 1 is on
pinInjector2 = 9; //Output pin injector 2 is on
@ -110,7 +113,9 @@ void setPinMapping(byte boardID)
pinFuelPump = 4; //Fuel pump output
pinFlex = 2; // Flex sensor (Must be external interrupt enabled)
break;
#endif
case 2:
#ifndef SMALL_FLASH_MODE //No support for bluepill here anyway
//Pin mappings as per the v0.3 shield
pinInjector1 = 8; //Output pin injector 1 is on
pinInjector2 = 9; //Output pin injector 2 is on
@ -155,6 +160,7 @@ void setPinMapping(byte boardID)
pinCoil3 = 30;
pinO2 = A22;
#endif
#endif
break;
case 3:
@ -313,6 +319,7 @@ void setPinMapping(byte boardID)
break;
case 10:
#ifndef SMALL_FLASH_MODE //No support for bluepill here anyway
//Pin mappings for user turtanas PCB
pinInjector1 = 4; //Output pin injector 1 is on
pinInjector2 = 5; //Output pin injector 2 is on
@ -344,9 +351,11 @@ void setPinMapping(byte boardID)
pinFan = 47; //Pin for the fan output
pinTachOut = 49; //Tacho output pin
pinFlex = 2; // Flex sensor (Must be external interrupt enabled)
#endif
break;
case 20:
#ifndef SMALL_FLASH_MODE //No support for bluepill here anyway
//Pin mappings as per the Plazomat In/Out shields Rev 0.1
pinInjector1 = 8; //Output pin injector 1 is on
pinInjector2 = 9; //Output pin injector 2 is on
@ -377,9 +386,11 @@ void setPinMapping(byte boardID)
pinFan = 47; //Pin for the fan output
pinFuelPump = 4; //Fuel pump output
pinTachOut = 49; //Tacho output pin
#endif
break;
case 30:
#ifndef SMALL_FLASH_MODE //No support for bluepill here anyway
//Pin mappings as per the dazv6 shield
pinInjector1 = 8; //Output pin injector 1 is on
pinInjector2 = 9; //Output pin injector 2 is on
@ -416,9 +427,51 @@ void setPinMapping(byte boardID)
pinSpareLOut4 = 51;
pinSpareLOut5 = 53;
pinFan = 47; //Pin for the fan output
#endif
break;
case 40:
//Pin mappings as per the NO2C shield
pinInjector1 = 8; //Output pin injector 1 is on
pinInjector2 = 9; //Output pin injector 2 is on
pinInjector3 = 11; //Output pin injector 3 is on - NOT USED
pinInjector4 = 12; //Output pin injector 4 is on - NOT USED
pinInjector5 = 13; //Placeholder only - NOT USED
pinCoil1 = 23; //Pin for coil 1
pinCoil2 = 22; //Pin for coil 2
pinCoil3 = 2; //Pin for coil 3 - ONLY WITH DB2
pinCoil4 = 3; //Pin for coil 4 - ONLY WITH DB2
pinCoil5 = 46; //Placeholder only - NOT USED
pinTrigger = 19; //The CAS pin
pinTrigger2 = 18; //The Cam Sensor pin
pinTPS = A3; //TPS input pin
pinMAP = A0; //MAP sensor pin
pinIAT = A5; //IAT sensor pin
pinCLT = A4; //CLT sensor pin
pinO2 = A2; //O2 sensor pin
pinBat = A1; //Battery reference voltage pin
pinBaro = A6; //Baro sensor pin - ONLY WITH DB
pinSpareTemp1 = A7; //spare Analog input 1 - ONLY WITH DB
pinDisplayReset = 48; // OLED reset pin - NOT USED
pinTachOut = 38; //Tacho output pin
pinIdle1 = 5; //Single wire idle control
pinIdle2 = 47; //2 wire idle control - NOT USED
pinBoost = 7; //Boost control
pinVVT_1 = 6; //Default VVT output
pinFuelPump = 4; //Fuel pump output
pinStepperDir = 25; //Direction pin for DRV8825 driver
pinStepperStep = 24; //Step pin for DRV8825 driver
pinStepperEnable = 27; //Enable pin for DRV8825 driver
pinLaunch = 10; //Can be overwritten below
pinFlex = 20; // Flex sensor (Must be external interrupt enabled) - ONLY WITH DB
pinFan = 30; //Pin for the fan output - ONLY WITH DB
pinSpareLOut1 = 32; //low current output spare1 - ONLY WITH DB
pinSpareLOut2 = 34; //low current output spare2 - ONLY WITH DB
pinSpareLOut3 = 36; //low current output spare3 - ONLY WITH DB
break;
default:
#ifndef SMALL_FLASH_MODE //No support for bluepill here anyway
//Pin mappings as per the v0.2 shield
pinInjector1 = 8; //Output pin injector 1 is on
pinInjector2 = 9; //Output pin injector 2 is on
@ -447,6 +500,7 @@ void setPinMapping(byte boardID)
pinFlex = 3; // Flex sensor (Must be external interrupt enabled)
pinBoost = 5;
pinIdle1 = 6;
#endif
break;
}
@ -834,66 +888,3 @@ void initialiseTriggers()
break;
}
}
/*
This function retuns a pulsewidth time (in us) using a either Alpha-N or Speed Density algorithms, given the following:
REQ_FUEL
VE: Lookup from the main MAP vs RPM fuel table
MAP: In KPa, read from the sensor
GammaE: Sum of Enrichment factors (Cold start, acceleration). This is a multiplication factor (Eg to add 10%, this should be 110)
injDT: Injector dead time. The time the injector take to open minus the time it takes to close (Both in uS)
TPS: Throttle position (0% to 100%)
This function is called by PW_SD and PW_AN for speed0density and pure Alpha-N calculations respectively.
*/
unsigned int PW(int REQ_FUEL, byte VE, long MAP, int corrections, int injOpen)
{
//Standard float version of the calculation
//return (REQ_FUEL * (float)(VE/100.0) * (float)(MAP/100.0) * (float)(TPS/100.0) * (float)(corrections/100.0) + injOpen);
//Note: The MAP and TPS portions are currently disabled, we use VE and corrections only
uint16_t iVE, iCorrections;
uint16_t iMAP = 100;
uint16_t iAFR = 147;
//100% float free version, does sacrifice a little bit of accuracy, but not much.
iVE = ((unsigned int)VE << 7) / 100;
if ( configPage1.multiplyMAP == true ) {
iMAP = ((unsigned int)MAP << 7) / currentStatus.baro; //Include multiply MAP (vs baro) if enabled
}
if ( (configPage1.includeAFR == true) && (configPage3.egoType == 2)) {
iAFR = ((unsigned int)currentStatus.O2 << 7) / currentStatus.afrTarget; //Include AFR (vs target) if enabled
}
iCorrections = (corrections << 7) / 100;
unsigned long intermediate = ((long)REQ_FUEL * (long)iVE) >> 7; //Need to use an intermediate value to avoid overflowing the long
if ( configPage1.multiplyMAP == true ) {
intermediate = (intermediate * (unsigned long)iMAP) >> 7;
}
if ( (configPage1.includeAFR == true) && (configPage3.egoType == 2) ) {
intermediate = (intermediate * (unsigned long)iAFR) >> 7; //EGO type must be set to wideband for this to be used
}
intermediate = (intermediate * (unsigned long)iCorrections) >> 7;
if (intermediate != 0)
{
//If intermeditate is not 0, we need to add the opening time (0 typically indicates that one of the full fuel cuts is active)
intermediate += injOpen; //Add the injector opening time
if ( intermediate > 65535)
{
intermediate = 65535; //Make sure this won't overflow when we convert to uInt. This means the maximum pulsewidth possible is 65.535mS
}
}
return (unsigned int)(intermediate);
}
//Convenience functions for Speed Density and Alpha-N
unsigned int PW_SD(int REQ_FUEL, byte VE, long MAP, int corrections, int injOpen)
{
return PW(REQ_FUEL, VE, MAP, corrections, injOpen);
//return PW(REQ_FUEL, VE, 100, corrections, injOpen);
}
unsigned int PW_AN(int REQ_FUEL, byte VE, byte TPS, int corrections, int injOpen)
{
return PW(REQ_FUEL, VE, currentStatus.MAP, corrections, injOpen);
}