typedef struct
{
FullPulse_t SparkOff; // Position of spark pulse trailing edge - the spark
FullPulse_t SparkOn; // Position of spark pulse leading edge - coil charging
uint16_t PulsePeriod; // The time(us) between engine timing pulses
uint16_t InjDuration0; // Pulse duration in us
uint16_t InjDuration1; // Pulse duration in us
FullPulse_t InjAdvance; // Position of injector
uint8_t MapIdx_; // The index of the map entry being used ( lower left )
uint8_t fy; // The fraction throttle from base map entry
uint8_t fx; // The fraction RPM from base map entry
} TimingInfo_t;
typedef struct
{
uint16_t TimeWait; // Time in us after the pulse
uint8_t Pulse; // The pulse number - 0..47 for My16M
} FullPulse_t;
=1129601138C020FED02C00BC00B0000230735F722
=1 12 9601_13 8C02_0F ED02 C00B C00B 0000_23 0 7 35 F7 22
RPM: 3337
PulsePeriod: 749
Injduration: 3008
InjAdvance: Pulse=35 TimeWait=0 => 525
SparkOn: Pulse=15 TimeWait=652
SparkOff: Pulse=19 TimeWait=406
Map: (7.96 , 0.21) or (7 and 247 , 0 and 53)
I have yet to figure out the FullPulse_t struct.
If InjAdv 525 is reported as pulse 35 + 0 us, the following formula seem to work:
(Pulse + (TimeWait / PulsePeriod)) * (720 / PulsesPer)
=
(35 + (0 / 749)) * (720 / 48)
=
525
But that don't work out for SparkOff. Besides, SparkOn is lower than SparkOff so is there some other reference than TDC for them? Should I substract Pulse from the 0x16 for my TDC?
(22 - Pulse + (TimeWait / PulsePeriod)) * (720 / PulsesPer)
This is the last puzzle to solve before my LogWorks plugin is ready to fly. Well, it already flies but it lacks SpkAdv.