auto-sync
This commit is contained in:
parent
2cbee7ada0
commit
a5dfa9cc2e
|
@ -309,7 +309,7 @@ void StartupFuelPumping::setPumpsCounter(
|
|||
}
|
||||
|
||||
void StartupFuelPumping::update(DECLARE_ENGINE_PARAMETER_F) {
|
||||
if (engine->rpmCalculator.rpm(PASS_ENGINE_PARAMETER_F) == 0) {
|
||||
if (engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F) == 0) {
|
||||
bool isTpsAbove50 = getTPS(PASS_ENGINE_PARAMETER_F) >= 50;
|
||||
|
||||
if (this->isTpsAbove50 != isTpsAbove50) {
|
||||
|
|
|
@ -193,7 +193,7 @@ floatms_t getBaseTableFuel(engine_configuration_s *engineConfiguration, int rpm,
|
|||
|
||||
float getBaroCorrection(DECLARE_ENGINE_PARAMETER_F) {
|
||||
if (hasBaroSensor(PASS_ENGINE_PARAMETER_F)) {
|
||||
return baroCorrMap.getValue(getBaroPressure(PASS_ENGINE_PARAMETER_F), getRpm());
|
||||
return baroCorrMap.getValue(getBaroPressure(PASS_ENGINE_PARAMETER_F), getRpmE(engine));
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ float getLEValue(Engine *engine, calc_stack_t *s, le_action_e action) {
|
|||
case LE_METHOD_INTAKE_AIR:
|
||||
return getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F);
|
||||
case LE_METHOD_RPM:
|
||||
return engine->rpmCalculator.rpm();
|
||||
return engine->rpmCalculator.getRpm();
|
||||
case LE_METHOD_TIME_SINCE_BOOT:
|
||||
return getTimeNowSeconds();
|
||||
case LE_METHOD_FAN_OFF_SETTING:
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
#include "interpolation.h"
|
||||
#include "efilib.h"
|
||||
|
||||
// 'random' value to be sure we are not treating any non-zero trash as TRUE
|
||||
#define MAGIC_TRUE_VALUE 153351512
|
||||
|
||||
/**
|
||||
* this helper class brings together 3D table with two 2D axis curves
|
||||
*/
|
||||
template<int RPM_BIN_SIZE, int LOAD_BIN_SIZE>
|
||||
class Map3D {
|
||||
public:
|
||||
|
@ -26,7 +26,7 @@ private:
|
|||
float *pointers[LOAD_BIN_SIZE];
|
||||
float *loadBins;
|
||||
float *rpmBins;
|
||||
int initialized;
|
||||
bool initialized;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
|
@ -73,14 +73,14 @@ void Map3D<RPM_BIN_SIZE, LOAD_BIN_SIZE>::init(float table[RPM_BIN_SIZE][LOAD_BIN
|
|||
for (int k = 0; k < LOAD_BIN_SIZE; k++) {
|
||||
pointers[k] = table[k];
|
||||
}
|
||||
initialized = MAGIC_TRUE_VALUE;
|
||||
initialized = true;
|
||||
this->loadBins = loadBins;
|
||||
this->rpmBins = rpmBins;
|
||||
}
|
||||
|
||||
template<int RPM_BIN_SIZE, int LOAD_BIN_SIZE>
|
||||
float Map3D<RPM_BIN_SIZE, LOAD_BIN_SIZE>::getValue(float x, float rpm) {
|
||||
efiAssert(initialized == MAGIC_TRUE_VALUE, "map not initialized", NAN);
|
||||
efiAssert(initialized, "map not initialized", NAN);
|
||||
if (cisnan(x)) {
|
||||
warning(OBD_PCM_Processor_Fault, "%s: x is NaN", name);
|
||||
return NAN;
|
||||
|
@ -99,7 +99,7 @@ Map3D<RPM_BIN_SIZE, LOAD_BIN_SIZE>::Map3D(const char *name) {
|
|||
|
||||
template<int RPM_BIN_SIZE, int LOAD_BIN_SIZE>
|
||||
void Map3D<RPM_BIN_SIZE, LOAD_BIN_SIZE>::setAll(float value) {
|
||||
efiAssertVoid(initialized == MAGIC_TRUE_VALUE, "map not initialized");
|
||||
efiAssertVoid(initialized, "map not initialized");
|
||||
for (int l = 0; l < LOAD_BIN_SIZE; l++) {
|
||||
for (int r = 0; r < RPM_BIN_SIZE; r++) {
|
||||
pointers[l][r] = value;
|
||||
|
|
|
@ -117,7 +117,7 @@ static msg_t csThread(void) {
|
|||
chRegSetThreadName("status");
|
||||
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
|
||||
while (true) {
|
||||
int rpm = getRpm();
|
||||
int rpm = getRpmE(engine);
|
||||
int is_cranking = isCrankingR(rpm);
|
||||
int is_running = rpm > 0 && !is_cranking;
|
||||
if (is_running) {
|
||||
|
|
|
@ -194,7 +194,7 @@ static msg_t ivThread(int param) {
|
|||
|
||||
efitimems_t now = currentTimeMillis();
|
||||
|
||||
percent_t newValue = idlePositionController.getIdle(getRpm(), now PASS_ENGINE_PARAMETER);
|
||||
percent_t newValue = idlePositionController.getIdle(getRpmE(engine), now PASS_ENGINE_PARAMETER);
|
||||
|
||||
if (currentIdleValve != newValue) {
|
||||
currentIdleValve = newValue;
|
||||
|
|
|
@ -485,7 +485,7 @@ void MainTriggerCallback::init(Engine *engine) {
|
|||
|
||||
static void showMainInfo(Engine *engine) {
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
int rpm = engine->rpmCalculator.rpm(PASS_ENGINE_PARAMETER_F);
|
||||
int rpm = engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F);
|
||||
float el = getEngineLoadT(PASS_ENGINE_PARAMETER_F);
|
||||
scheduleMsg(logger, "rpm %d engine_load %f", rpm, el);
|
||||
scheduleMsg(logger, "fuel %fms timing %f", getFuelMs(rpm PASS_ENGINE_PARAMETER), engine->engineState.timingAdvance);
|
||||
|
|
|
@ -116,7 +116,7 @@ float RpmCalculator::getRpmAcceleration() {
|
|||
*/
|
||||
// todo: migrate to float return result or add a float version? this would have with calculations
|
||||
// todo: add a version which does not check time & saves time? need to profile
|
||||
int RpmCalculator::rpm(DECLARE_ENGINE_PARAMETER_F) {
|
||||
int RpmCalculator::getRpm(DECLARE_ENGINE_PARAMETER_F) {
|
||||
#if !EFI_PROD_CODE
|
||||
if (mockRpm != MOCK_UNDEFINED)
|
||||
return mockRpm;
|
||||
|
@ -221,7 +221,7 @@ static char rpmBuffer[10];
|
|||
* digital sniffer.
|
||||
*/
|
||||
static void onTdcCallback(void) {
|
||||
itoa10(rpmBuffer, getRpm());
|
||||
itoa10(rpmBuffer, getRpmE(engine));
|
||||
addWaveChartEvent(TOP_DEAD_CENTER_MESSAGE, (char* ) rpmBuffer);
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ static void tdcMarkCallback(trigger_event_e ckpSignalType,
|
|||
if (isTriggerSynchronizationPoint
|
||||
&& engineConfiguration->isEngineChartEnabled) {
|
||||
int revIndex2 = engine->rpmCalculator.getRevolutionCounter() % 2;
|
||||
int rpm = getRpm();
|
||||
int rpm = getRpmE(engine);
|
||||
// todo: use event-based scheduling, not just time-based scheduling
|
||||
if (isValidRpm(rpm)) {
|
||||
scheduleByAngle(rpm, &tdcScheduler[revIndex2], tdcPosition(),
|
||||
|
@ -263,7 +263,7 @@ float getCrankshaftAngleNt(efitime_t timeNt DECLARE_ENGINE_PARAMETER_S) {
|
|||
* compiler is not smart enough to figure out that "A / ( B / C)" could be optimized into
|
||||
* "A * C / B" in order to replace a slower division with a faster multiplication.
|
||||
*/
|
||||
int rpm = engine->rpmCalculator.rpm(PASS_ENGINE_PARAMETER_F);
|
||||
int rpm = engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F);
|
||||
return rpm == 0 ? NAN : timeSinceZeroAngleNt / getOneDegreeTimeNt(rpm);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
* Please note that this is a relatively heavy method due to getTimeNowNt() usage
|
||||
*/
|
||||
bool isRunning(DECLARE_ENGINE_PARAMETER_F);
|
||||
int rpm(DECLARE_ENGINE_PARAMETER_F);
|
||||
int getRpm(DECLARE_ENGINE_PARAMETER_F);
|
||||
/**
|
||||
* This method is invoked once per engine cycle right after we calculate new RPM value
|
||||
*/
|
||||
|
@ -73,12 +73,10 @@ private:
|
|||
volatile uint32_t revolutionCounterSinceStart;
|
||||
};
|
||||
|
||||
#define getRpm() getRpmE(engine)
|
||||
|
||||
/**
|
||||
* @brief Current RPM
|
||||
*/
|
||||
#define getRpmE(engine) (engine)->rpmCalculator.rpm(PASS_ENGINE_PARAMETER_F)
|
||||
#define getRpmE(engine) (engine)->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F)
|
||||
|
||||
bool isCrankingE(Engine *engine);
|
||||
void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index DECLARE_ENGINE_PARAMETER_S);
|
||||
|
|
|
@ -227,7 +227,7 @@ static void reportWave(Logging *logging, int index) {
|
|||
appendPrintf(logging, "%s", DELIMETER);
|
||||
|
||||
uint32_t offsetUs = getWaveOffset(index);
|
||||
int rpm = getRpm();
|
||||
int rpm = getRpmE(engine);
|
||||
float oneDegreeUs = rpm == 0 ? NAN : getOneDegreeTimeUs(rpm);
|
||||
|
||||
appendPrintf(logging, "advance%d%s", index, DELIMETER);
|
||||
|
|
|
@ -214,7 +214,7 @@ static void canRead(void) {
|
|||
}
|
||||
|
||||
static void writeStateToCan(void) {
|
||||
engine_rpm = getRpm();
|
||||
engine_rpm = getRpmE(engine);
|
||||
engine_clt = 123; //getCoolantTemperature(engine);
|
||||
|
||||
canInfoNBCBroadcast(engineConfiguration->canNbcType);
|
||||
|
|
|
@ -19,7 +19,7 @@ void testSpeedDensity(void) {
|
|||
eth.initTriggerShapeAndRpmCalculator();
|
||||
|
||||
eth.fireTriggerEvents();
|
||||
assertEqualsM("RPM", 1500, eth.engine.rpmCalculator.rpm(PASS_ENGINE_PARAMETER_F));
|
||||
assertEqualsM("RPM", 1500, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
||||
|
||||
// 427 cubic inches, that's a LOT of engine
|
||||
eth.ec->specs.displacement = 6.99728;
|
||||
|
|
|
@ -300,10 +300,10 @@ static void testRpmCalculator(void) {
|
|||
|
||||
engine->updateSlowSensors(PASS_ENGINE_PARAMETER_F);
|
||||
timeNow = 0;
|
||||
assertEquals(0, eth.engine.rpmCalculator.rpm(PASS_ENGINE_PARAMETER_F));
|
||||
assertEquals(0, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
||||
|
||||
eth.fireTriggerEvents();
|
||||
assertEqualsM("RPM", 1500, eth.engine.rpmCalculator.rpm(PASS_ENGINE_PARAMETER_F));
|
||||
assertEqualsM("RPM", 1500, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
||||
assertEqualsM("index #1", 15, eth.engine.triggerCentral.triggerState.getCurrentIndex());
|
||||
|
||||
static MainTriggerCallback triggerCallbackInstance;
|
||||
|
|
Loading…
Reference in New Issue