mirror of https://github.com/rusefi/rusefi.git
use timer instead of home spun time math
This commit is contained in:
parent
0f522f1947
commit
046ad7436f
|
@ -70,10 +70,9 @@ public:
|
||||||
*/
|
*/
|
||||||
angle_t sparkAngle = NAN;
|
angle_t sparkAngle = NAN;
|
||||||
floatms_t sparkDwell = 0;
|
floatms_t sparkDwell = 0;
|
||||||
/**
|
|
||||||
* this timestamp allows us to measure actual dwell time
|
// this timer allows us to measure actual dwell time
|
||||||
*/
|
Timer actualDwellTimer;
|
||||||
uint32_t actualStartOfDwellNt = 0;
|
|
||||||
|
|
||||||
float dwellAngle = 0;
|
float dwellAngle = 0;
|
||||||
|
|
||||||
|
|
|
@ -208,11 +208,12 @@ void fireSparkAndPrepareNextSchedule(IgnitionEvent *event) {
|
||||||
#if !EFI_UNIT_TEST
|
#if !EFI_UNIT_TEST
|
||||||
if (engineConfiguration->debugMode == DBG_DWELL_METRIC) {
|
if (engineConfiguration->debugMode == DBG_DWELL_METRIC) {
|
||||||
#if EFI_TUNER_STUDIO
|
#if EFI_TUNER_STUDIO
|
||||||
uint32_t actualDwellDurationNt = getTimeNowLowerNt() - event->actualStartOfDwellNt;
|
float actualDwellMs = event->actualDwellTimer.getElapsedSeconds(nowNt) * 1e3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ratio of desired dwell duration to actual dwell duration gives us some idea of how good is input trigger jitter
|
* ratio of desired dwell duration to actual dwell duration gives us some idea of how good is input trigger jitter
|
||||||
*/
|
*/
|
||||||
float ratio = NT2US(actualDwellDurationNt) / 1000.0 / event->sparkDwell;
|
float ratio = actualDwellMs / event->sparkDwell;
|
||||||
|
|
||||||
// todo: smarted solution for index to field mapping
|
// todo: smarted solution for index to field mapping
|
||||||
switch (event->cylinderIndex) {
|
switch (event->cylinderIndex) {
|
||||||
|
|
Loading…
Reference in New Issue