mirror of https://github.com/rusefi/rusefi.git
Compare commits
7 Commits
c0e7eb4a2c
...
08378967c4
Author | SHA1 | Date |
---|---|---|
Matthew Kennedy | 08378967c4 | |
Matthew Kennedy | 3127a1dcd2 | |
GitHub gen-default-tune Action | 61dc1116b9 | |
Matthew Kennedy | e4db668aa7 | |
Matthew Kennedy | 046ad7436f | |
GitHub set-date Action | 0f522f1947 | |
rusEFI LLC | 7cdb78d6fa |
|
@ -70,10 +70,9 @@ public:
|
|||
*/
|
||||
angle_t sparkAngle = NAN;
|
||||
floatms_t sparkDwell = 0;
|
||||
/**
|
||||
* this timestamp allows us to measure actual dwell time
|
||||
*/
|
||||
uint32_t actualStartOfDwellNt = 0;
|
||||
|
||||
// this timer allows us to measure actual dwell time
|
||||
Timer actualDwellTimer;
|
||||
|
||||
float dwellAngle = 0;
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#pragma once
|
||||
#define VCS_DATE 20240425
|
||||
#define VCS_DATE 20240426
|
||||
|
|
|
@ -208,11 +208,12 @@ void fireSparkAndPrepareNextSchedule(IgnitionEvent *event) {
|
|||
#if !EFI_UNIT_TEST
|
||||
if (engineConfiguration->debugMode == DBG_DWELL_METRIC) {
|
||||
#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
|
||||
*/
|
||||
float ratio = NT2US(actualDwellDurationNt) / 1000.0 / event->sparkDwell;
|
||||
float ratio = actualDwellMs / event->sparkDwell;
|
||||
|
||||
// todo: smarted solution for index to field mapping
|
||||
switch (event->cylinderIndex) {
|
||||
|
@ -317,10 +318,10 @@ static bool startDwellByTurningSparkPinHigh(IgnitionEvent *event, IgnitionOutput
|
|||
}
|
||||
|
||||
void turnSparkPinHighStartCharging(IgnitionEvent *event) {
|
||||
event->actualStartOfDwellNt = getTimeNowLowerNt();
|
||||
|
||||
efitick_t nowNt = getTimeNowNt();
|
||||
|
||||
event->actualDwellTimer.reset(nowNt);
|
||||
|
||||
bool skippedDwellDueToTriggerNoised = false;
|
||||
for (int i = 0; i< MAX_OUTPUTS_FOR_IGNITION;i++) {
|
||||
IgnitionOutputPin *output = event->outputs[i];
|
||||
|
|
|
@ -51,10 +51,15 @@ float InstantRpmCalculator::calculateInstantRpm(
|
|||
TriggerWaveform const & triggerShape, TriggerFormDetails *triggerFormDetails,
|
||||
uint32_t current_index, efitick_t nowNt) {
|
||||
|
||||
// It's OK to truncate from 64b to 32b, ARM with single precision FPU uses an expensive
|
||||
// software function to convert 64b int -> float, while 32b int -> float is very cheap hardware conversion
|
||||
// The difference is guaranteed to be short (it's 90 degrees of engine rotation!), so it won't overflow.
|
||||
uint32_t nowNt32 = nowNt;
|
||||
|
||||
assertIsInBoundsWithResult(current_index, timeOfLastEvent, "calc timeOfLastEvent", 0);
|
||||
|
||||
// Record the time of this event so we can calculate RPM from it later
|
||||
timeOfLastEvent[current_index] = nowNt;
|
||||
timeOfLastEvent[current_index] = nowNt32;
|
||||
|
||||
// Determine where we currently are in the revolution
|
||||
angle_t currentAngle = triggerFormDetails->eventAngles[current_index];
|
||||
|
@ -67,17 +72,14 @@ float InstantRpmCalculator::calculateInstantRpm(
|
|||
|
||||
// now let's get precise angle for that event
|
||||
angle_t prevIndexAngle = triggerFormDetails->eventAngles[prevIndex];
|
||||
efitick_t time90ago = timeOfLastEvent[prevIndex];
|
||||
auto time90ago = timeOfLastEvent[prevIndex];
|
||||
|
||||
// No previous timestamp, instant RPM isn't ready yet
|
||||
if (time90ago == 0) {
|
||||
return prevInstantRpmValue;
|
||||
}
|
||||
|
||||
// It's OK to truncate from 64b to 32b, ARM with single precision FPU uses an expensive
|
||||
// software function to convert 64b int -> float, while 32b int -> float is very cheap hardware conversion
|
||||
// The difference is guaranteed to be short (it's 90 degrees of engine rotation!), so it won't overflow.
|
||||
uint32_t time = nowNt - time90ago;
|
||||
uint32_t time = nowNt32 - time90ago;
|
||||
angle_t angleDiff = currentAngle - prevIndexAngle;
|
||||
|
||||
// Wrap the angle in to the correct range (ie, could be -630 when we want +90)
|
||||
|
@ -113,7 +115,8 @@ void InstantRpmCalculator::setLastEventTimeForInstantRpm(efitick_t nowNt) {
|
|||
return;
|
||||
}
|
||||
|
||||
spinningEvents[spinningEventIndex] = nowNt;
|
||||
uint32_t nowNt32 = nowNt;
|
||||
spinningEvents[spinningEventIndex] = nowNt32;
|
||||
|
||||
// If we are using only rising edges, we never write in to the odd-index slots that
|
||||
// would be used by falling edges
|
||||
|
|
|
@ -307,6 +307,7 @@ void initSmartGpio() {
|
|||
|
||||
void tle8888startup() {
|
||||
#if EFI_PROD_CODE && (BOARD_TLE8888_COUNT > 0)
|
||||
// TODO: use a timer instead
|
||||
static efitick_t tle8888CrankingResetTime = 0;
|
||||
|
||||
if (engineConfiguration->useTLE8888_cranking_hack && engine->rpmCalculator.isCranking()) {
|
||||
|
|
|
@ -208,7 +208,7 @@
|
|||
<constant name="acrPin">"NONE"</constant>
|
||||
<constant digits="1" name="driveWheelRevPerKm" units="revs/km">1000.0</constant>
|
||||
<constant digits="2" name="canSleepPeriodMs" units="ms">50.0</constant>
|
||||
<constant digits="0" name="byFirmwareVersion" units="index">2.0240425E7</constant>
|
||||
<constant digits="0" name="byFirmwareVersion" units="index">2.0240426E7</constant>
|
||||
<constant name="tps1_1AdcChannel">"Disabled"</constant>
|
||||
<constant name="vbattAdcChannel">"Disabled"</constant>
|
||||
<constant name="fuelLevelSensor">"Disabled"</constant>
|
||||
|
|
Loading…
Reference in New Issue