Initial code for cranking staging

This commit is contained in:
Josh Stewart 2014-08-25 22:03:57 +10:00
parent a2f86014d3
commit 9022f6e8ff
15 changed files with 28167 additions and 24 deletions

View File

@ -149,12 +149,12 @@ struct config2 {
byte IdleAdv;
byte IdleAdvTPS;
byte IdleAdvRPM;
byte IdleAdvCLT;
byte IdleAdvCLT; //The temperature below which the idle is advanced
byte IdleDelayTime;
byte StgCycles;
byte StgCycles; //The number of initial cycles before the ignition should fire when first cranking
byte dwellCont; //Fixed duty dwell control
byte dwellCrank;
byte dwellRun;
byte dwellCrank; //Dwell time whilst cranking
byte dwellRun; //Dwell time whilst running
byte triggerTeeth; //The full count of teeth on the trigger wheel if there were no gaps
byte triggerMissingTeeth; //The size of the tooth gap (ie number of missing teeth)
byte crankRPM; //RPM below which the engine is considered to be cranking

View File

@ -0,0 +1,26 @@
G04 MADE WITH FRITZING*
G04 WWW.FRITZING.ORG*
G04 DOUBLE SIDED*
G04 HOLES PLATED*
G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%ASAXBY*%
%FSLAX23Y23*%
%MOIN*%
%OFA0B0*%
%SFA1.0B1.0*%
%ADD10R,0.984252X0.984252*%
%ADD11C,0.008000*%
%ADD10C,0.008*%
%LNCONTOUR*%
G90*
G70*
G54D10*
G54D11*
X4Y980D02*
X980Y980D01*
X980Y4D01*
X4Y4D01*
X4Y980D01*
D02*
G04 End of contour*
M02*

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,37 @@
; NON-PLATED HOLES START AT T1
; THROUGH (PLATED) HOLES START AT T100
M48
INCH
T100C0.015748
T101C0.039370
T102C0.035000
%
T100
X001944Y001398
X000444Y009148
X002444Y002648
X004944Y001148
X006194Y008148
X000694Y007148
X008194Y007398
X002694Y001148
X005444Y003148
X004944Y004148
X002944Y006898
X001444Y002648
T101
X006694Y003148
X003694Y005148
X006694Y006148
X003694Y003148
X006694Y004148
X003694Y006148
X003694Y004148
X006694Y005148
T102
X004194Y001398
X008194Y008148
X008194Y001398
X004194Y008148
T00
M30

View File

@ -0,0 +1,139 @@
G04 MADE WITH FRITZING*
G04 WWW.FRITZING.ORG*
G04 DOUBLE SIDED*
G04 HOLES PLATED*
G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%ASAXBY*%
%FSLAX23Y23*%
%MOIN*%
%OFA0B0*%
%SFA1.0B1.0*%
%ADD10C,0.085000*%
%ADD11C,0.049370*%
%ADD12C,0.089370*%
%ADD13R,0.065118X0.069055*%
%ADD14R,0.069055X0.065118*%
%ADD15R,0.089370X0.089370*%
%ADD16C,0.026000*%
%LNMASK0*%
G90*
G70*
G54D10*
X819Y815D03*
X419Y815D03*
G54D11*
X819Y740D03*
X619Y815D03*
X544Y315D03*
X194Y140D03*
X269Y115D03*
X69Y715D03*
G54D10*
X819Y140D03*
X419Y140D03*
G54D12*
X369Y615D03*
X669Y615D03*
X369Y515D03*
X669Y515D03*
X369Y415D03*
X669Y415D03*
X369Y315D03*
X669Y315D03*
G54D11*
X494Y115D03*
X244Y265D03*
X144Y265D03*
X44Y915D03*
X294Y690D03*
X494Y415D03*
G54D13*
X869Y240D03*
X789Y240D03*
X869Y440D03*
X789Y440D03*
G54D14*
X244Y465D03*
X244Y546D03*
G54D13*
X119Y640D03*
X200Y640D03*
X144Y365D03*
X225Y365D03*
X114Y865D03*
X194Y865D03*
X194Y765D03*
X114Y765D03*
X569Y915D03*
X650Y915D03*
G54D14*
X544Y615D03*
X544Y534D03*
X119Y465D03*
X119Y546D03*
G54D13*
X344Y915D03*
X425Y915D03*
X869Y340D03*
X789Y340D03*
G54D14*
X569Y140D03*
X569Y221D03*
G54D13*
X794Y640D03*
X875Y640D03*
G54D14*
X669Y215D03*
X669Y134D03*
G54D15*
X369Y615D03*
G54D16*
X330Y240D02*
X308Y240D01*
D02*
X330Y215D02*
X308Y215D01*
D02*
X330Y190D02*
X308Y190D01*
D02*
X330Y165D02*
X308Y165D01*
D02*
X330Y140D02*
X308Y140D01*
D02*
X330Y115D02*
X308Y115D01*
D02*
X330Y90D02*
X308Y90D01*
D02*
X330Y65D02*
X308Y65D01*
D02*
X118Y64D02*
X96Y64D01*
D02*
X118Y89D02*
X96Y89D01*
D02*
X118Y114D02*
X96Y114D01*
D02*
X118Y139D02*
X96Y139D01*
D02*
X118Y164D02*
X96Y164D01*
D02*
X118Y189D02*
X96Y189D01*
D02*
X118Y214D02*
X96Y214D01*
D02*
X118Y239D02*
X96Y239D01*
G04 End of Mask0*
M02*

View File

@ -0,0 +1,68 @@
G04 MADE WITH FRITZING*
G04 WWW.FRITZING.ORG*
G04 DOUBLE SIDED*
G04 HOLES PLATED*
G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%ASAXBY*%
%FSLAX23Y23*%
%MOIN*%
%OFA0B0*%
%SFA1.0B1.0*%
%ADD10C,0.085000*%
%ADD11C,0.049370*%
%ADD12C,0.089370*%
%ADD13R,0.069055X0.065118*%
%ADD14R,0.034000X0.097000*%
%ADD15R,0.065118X0.069055*%
%ADD16R,0.089370X0.089370*%
%LNMASK1*%
G90*
G70*
G54D10*
X819Y815D03*
X419Y815D03*
G54D11*
X819Y740D03*
X619Y815D03*
X544Y315D03*
X194Y140D03*
X269Y115D03*
X69Y715D03*
G54D10*
X819Y140D03*
X419Y140D03*
G54D12*
X369Y615D03*
X669Y615D03*
X369Y515D03*
X669Y515D03*
X369Y415D03*
X669Y415D03*
X369Y315D03*
X669Y315D03*
G54D11*
X494Y115D03*
X244Y265D03*
X144Y265D03*
X44Y915D03*
X294Y690D03*
X494Y415D03*
G54D13*
X194Y365D03*
X194Y446D03*
G54D14*
X94Y584D03*
X144Y584D03*
X194Y584D03*
X244Y584D03*
X244Y790D03*
X194Y790D03*
X144Y790D03*
X94Y790D03*
G54D15*
X219Y65D03*
X139Y65D03*
G54D16*
X369Y615D03*
G04 End of Mask1*
M02*

View File

@ -0,0 +1,104 @@
G04 MADE WITH FRITZING*
G04 WWW.FRITZING.ORG*
G04 DOUBLE SIDED*
G04 HOLES PLATED*
G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%ASAXBY*%
%FSLAX23Y23*%
%MOIN*%
%OFA0B0*%
%SFA1.0B1.0*%
%ADD10R,0.055118X0.059055*%
%ADD11R,0.059055X0.055118*%
%ADD12C,0.016000*%
%LNPASTEMASK0*%
G90*
G70*
G54D10*
X869Y240D03*
X789Y240D03*
X869Y440D03*
X789Y440D03*
G54D11*
X244Y465D03*
X244Y546D03*
G54D10*
X119Y640D03*
X200Y640D03*
X144Y365D03*
X225Y365D03*
X114Y865D03*
X194Y865D03*
X194Y765D03*
X114Y765D03*
X569Y915D03*
X650Y915D03*
G54D11*
X544Y615D03*
X544Y534D03*
X119Y465D03*
X119Y546D03*
G54D10*
X344Y915D03*
X425Y915D03*
X869Y340D03*
X789Y340D03*
G54D11*
X569Y140D03*
X569Y221D03*
G54D10*
X794Y640D03*
X875Y640D03*
G54D11*
X669Y215D03*
X669Y134D03*
G54D12*
X330Y240D02*
X308Y240D01*
D02*
X330Y215D02*
X308Y215D01*
D02*
X330Y190D02*
X308Y190D01*
D02*
X330Y165D02*
X308Y165D01*
D02*
X330Y140D02*
X308Y140D01*
D02*
X330Y115D02*
X308Y115D01*
D02*
X330Y90D02*
X308Y90D01*
D02*
X330Y65D02*
X308Y65D01*
D02*
X118Y64D02*
X96Y64D01*
D02*
X118Y89D02*
X96Y89D01*
D02*
X118Y114D02*
X96Y114D01*
D02*
X118Y139D02*
X96Y139D01*
D02*
X118Y164D02*
X96Y164D01*
D02*
X118Y189D02*
X96Y189D01*
D02*
X118Y214D02*
X96Y214D01*
D02*
X118Y239D02*
X96Y239D01*
G04 End of PasteMask0*
M02*

View File

@ -0,0 +1,33 @@
G04 MADE WITH FRITZING*
G04 WWW.FRITZING.ORG*
G04 DOUBLE SIDED*
G04 HOLES PLATED*
G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%ASAXBY*%
%FSLAX23Y23*%
%MOIN*%
%OFA0B0*%
%SFA1.0B1.0*%
%ADD10R,0.059055X0.055118*%
%ADD11R,0.024000X0.087000*%
%ADD12R,0.055118X0.059055*%
%LNPASTEMASK1*%
G90*
G70*
G54D10*
X194Y365D03*
X194Y446D03*
G54D11*
X94Y584D03*
X144Y584D03*
X194Y584D03*
X244Y584D03*
X244Y790D03*
X194Y790D03*
X144Y790D03*
X94Y790D03*
G54D12*
X219Y65D03*
X139Y65D03*
G04 End of PasteMask1*
M02*

View File

@ -0,0 +1,100 @@
*Pick And Place List
*Company=
*Author=
*eMail=
*
*Project=VR Conditioner
*Date=22:04:13
*CreatedBy=Fritzing 0.9.0b.06.11.da4e
*
*
*Coordinates in mm, always center of component
*Origin 0/0=Lower left corner of PCB
*Rotation in degree (0-360, math. pos.)
*
*No;Value;Package;X;Y;Rotation;Side;Name
1;4.7k;THT;15.7339;-3.55111;180;Bottom;R12
2;;;15.4178;-3.2322;0;Bottom;Copper Fill48
3;;;7.5692;-6.8644;0;Bottom;Copper Fill43
4;;;4.93889;-3.55111;0;Bottom;Via10
5;;;21.1775;-10.1578;90;Bottom;TXT2
6;1k;0805 [SMD];3.91387;-21.9661;180;Bottom;R9
7;;;10.9728;-13.6462;0;Bottom;Copper Fill11
8;;;4.1656;-17.8626;0;Bottom;Copper Fill7
9;;;3.4036;-14.0272;0;Bottom;Copper Fill12
10;;;14.7066;-16.745;0;Bottom;Copper Fill9
11;1nF;0805 [SMD, multilayer];3.03388;-12.8311;90;Bottom;C5
12;;;7.47888;-17.5211;0;Bottom;Via5
13;;;12.5589;-10.5361;0;Bottom;Via6
14;;;2.4384;-3.664;0;Bottom;Copper Fill46
15;;;18.9484;-4.807;0;Bottom;Copper Fill23
16;;;12.7254;-6.6358;0;Bottom;Copper Fill25
17;;;2.0828;-11.4364;0;Bottom;Copper Fill15
18;;;12.6746;-17.5832;0;Bottom;Copper Fill35
19;;;15.7338;-20.6961;0;Bottom;Via8
20;;;1.76388;-18.1561;0;Bottom;Via13
21;0.1µF;0805 [SMD, multilayer];21.0588;-6.0911;0;Bottom;C1
22;;;22.606;-20.9106;0;Bottom;Copper Fill2
23;;;20.8138;-18.7911;0;Bottom;Via7
24;;;7.7216;-20.0216;0;Bottom;Copper Fill6
25;;;4.7498;-16.9736;0;Bottom;Copper Fill37
26;1nF;0805 [SMD, multilayer];9.77387;-23.2361;180;Bottom;C4
27;;;2.7432;-10.014;0;Bottom;Copper Fill42
28;;;6.20888;-6.72612;0;Bottom;Via2
29;220;0805 [SMD];4.5489;-1.6461;180;Top;R2
30;1k;0805 [SMD];4.6939;-9.2661;180;Bottom;R11
31;;so08;4.30388;-17.4449;0;Top;IC2
32;;;21.4122;-13.9764;0;Bottom;Copper Fill13
33;;QSOP16;5.42149;-4.17341;0;Bottom;MAX9926
34;;;10.8712;-6.5596;0;Bottom;Copper Fill44
35;1µF;0805 [SMD, multilayer];21.0588;-11.1711;0;Bottom;C3
36;;;20.5232;-15.0686;0;Bottom;Copper Fill38
37;;;22.776;-7.12894;90;Bottom;TXT1
38;0.01µF;0805 [SMD, multilayer];21.0588;-8.6311;0;Bottom;C2
39;;;5.3594;-22.3838;0;Bottom;Copper Fill32
40;;;6.3754;-12.7318;0;Bottom;Copper Fill16
41;;;8.128;-21.952;0;Bottom;Copper Fill3
42;;;6.84389;-2.91611;0;Bottom;Via12
43;;;18.2118;-7.093;0;Bottom;Copper Fill45
44;;;2.1336;-20.7328;0;Bottom;Copper Fill5
45;220;0805 [SMD];4.93888;-10.2911;-90;Top;R1
46;10k;0805 [SMD];15.4889;-23.2361;180;Bottom;R7
47;;;3.66888;-6.72612;0;Bottom;Via3
48;;;18.0848;-21.063;0;Bottom;Copper Fill34
49;;;1.12888;-23.2361;0;Bottom;Via4
50;220;0805 [SMD];4.0589;-16.2511;180;Bottom;R13
51;;;21.9624;-9.59015;90;Bottom;TXT3
52;;DIP (Dual Inline) [THT];13.1939;-11.8061;0;Bottom;IC1
53;;;11.684;-8.49;0;Bottom;Copper Fill20
54;;;4.318;-1.9368;0;Bottom;Copper Fill29
55;;;14.859;-2.9274;0;Bottom;Copper Fill28
56;;;12.8778;-11.538;0;Bottom;Copper Fill40
57;;;21.971;-3.5624;0;Bottom;Copper Fill26
58;;;15.9512;-6.331;0;Bottom;Copper Fill24
59;;;2.54;-23.4506;0;Bottom;Copper Fill1
60;;;6.985;-20.047;0;Bottom;Copper Fill33
61;;;14.1224;-9.8362;0;Bottom;Copper Fill17
62;;;3.4798;-12.554;0;Bottom;Copper Fill41
63;1k;0805 [SMD];21.2039;-16.2511;180;Bottom;R5
64;;;2.4384;-21.3932;0;Bottom;Copper Fill30
65;;;12.2936;-4.299;0;Bottom;Copper Fill27
66;10k;0805 [SMD];14.4639;-4.5761;90;Bottom;R4
67;;;15.9258;-9.2774;0;Bottom;Copper Fill19
68;;;13.8289;-7.99612;0;Bottom;Via9
69;;;23.2664;-23.2728;0;Bottom;Copper Fill31
70;4.7k;THT;15.7339;-20.6961;180;Bottom;R10
71;;;15.5956;-20.301;0;Bottom;Copper Fill4
72;;;6.6548;-3.791;0;Bottom;Copper Fill47
73;;;8.6106;-18.1928;0;Bottom;Copper Fill8
74;;;15.494;-13.1128;0;Bottom;Copper Fill14
75;;;12.5589;-2.91612;0;Bottom;Via1
76;;;18.9484;-18.0912;0;Bottom;Copper Fill36
77;1k;0805 [SMD];13.8289;-14.5911;-90;Bottom;R3
78;10k;0805 [SMD];17.0038;-4.4311;-90;Bottom;R6
79;;;7.112;-12.554;0;Bottom;Copper Fill39
80;;;18.4658;-15.9576;0;Bottom;Copper Fill10
81;1k;0805 [SMD];6.20888;-12.8311;90;Bottom;R14
82;;;18.542;-9.633;0;Bottom;Copper Fill18
83;;;7.7216;-7.6772;0;Bottom;Copper Fill22
84;1k;0805 [SMD];3.91388;-19.4261;0;Bottom;R8
85;;;3.2258;-5.95;0;Bottom;Copper Fill21

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -52,6 +52,8 @@ volatile unsigned long toothLastToothTime = 0; //The time (micros()) that the la
volatile unsigned long toothLastMinusOneToothTime = 0; //The time (micros()) that the tooth before the last tooth was registered
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 byte startRevolutions = 0; //A counter for how many revolutions have been completed since sync was achieved.
volatile bool ignitionOn = true; //The current state of the ignition system
struct table3D fuelTable; //8x8 fuel map
struct table3D ignitionTable; //8x8 ignition map
@ -278,6 +280,9 @@ void loop()
BIT_SET(currentStatus.engine, BIT_ENGINE_CRANK);
BIT_CLEAR(currentStatus.engine, BIT_ENGINE_RUN);
currentStatus.runSecs = 0; //We're cranking (hopefully), so reset the engine run time to prompt ASE.
//Check whether enough cranking revolutions have been performed to turn the ignition on
if(startRevolutions > configPage2.StgCycles)
{ignitionOn = true;}
}
}
@ -359,27 +364,31 @@ void loop()
);
}
//Likewise for the ignition
int dwell = (configPage2.dwellRun * 100); //Dwell is stored as ms * 10. ie Dwell of 4.3ms would be 43 in configPage2. This number therefore needs to be multiplied by 100 to get dwell in uS
if ( ignition1StartAngle > crankAngle)
{
if (currentStatus.RPM < ((unsigned int)(configPage2.HardRevLim) * 100) ) //Check for hard cut rev limit (If we're above the hardcut limit, we simply don't set a spark schedule)
{
setIgnitionSchedule1(beginCoil1Charge,
(ignition1StartAngle - crankAngle) * timePerDegree,
dwell,
endCoil1Charge
);
//Perform an initial check to see if the ignition is turned on
if(ignitionOn)
{
int dwell = (configPage2.dwellRun * 100); //Dwell is stored as ms * 10. ie Dwell of 4.3ms would be 43 in configPage2. This number therefore needs to be multiplied by 100 to get dwell in uS
if ( ignition1StartAngle > crankAngle)
{
if (currentStatus.RPM < ((unsigned int)(configPage2.HardRevLim) * 100) ) //Check for hard cut rev limit (If we're above the hardcut limit, we simply don't set a spark schedule)
{
setIgnitionSchedule1(beginCoil1Charge,
(ignition1StartAngle - crankAngle) * timePerDegree,
dwell,
endCoil1Charge
);
}
}
}
if ( ignition2StartAngle > crankAngle)
{
if (currentStatus.RPM < ((unsigned int)(configPage2.HardRevLim) * 100) ) //Check for hard cut rev limit (If we're above the hardcut limit, we simply don't set a spark schedule)
{
setIgnitionSchedule2(beginCoil2Charge,
(ignition2StartAngle - crankAngle) * timePerDegree,
dwell,
endCoil2Charge
);
if ( ignition2StartAngle > crankAngle)
{
if (currentStatus.RPM < ((unsigned int)(configPage2.HardRevLim) * 100) ) //Check for hard cut rev limit (If we're above the hardcut limit, we simply don't set a spark schedule)
{
setIgnitionSchedule2(beginCoil2Charge,
(ignition2StartAngle - crankAngle) * timePerDegree,
dwell,
endCoil2Charge
);
}
}
}
@ -432,6 +441,7 @@ void trigger()
toothOneMinusOneTime = toothOneTime;
toothOneTime = curTime;
currentStatus.hasSync = true;
startRevolutions++; //Counter
}
toothLastMinusOneToothTime = toothLastToothTime;