mirror of https://github.com/rusefi/rusefi-1.git
Begin "vehicleSpeed" refactoring. Module switched to "FunctionalPointerSensor" class. #3106 #3107 #3108. (#3132)
* Add new sensor type "VehicleSpeed" * Add "Vehicle speed" sensor to name list * Add Vehicle speed sensor initialization with function pointer sensor. * Add init_vehicle_speed_sensor.cpp to Makefile * Replace dependencies from "getVehicleSpeed" to OOP-like "Sensor::get()" * Add warning and TODO to "mock vehicle speed" call * Replace get & mock "VehicleSpeed" methods in tests * Remove #warning directive (cause error by current settings) * Remove stray tab * Remove explicitly type casting. * Add "InitVehicleSpeedSensor" function declaration to init.h * Add "VehicleSpeedSensor" initialization call into "InitNewSensors" Co-authored-by: alxrMironov <330OMcorporative>
This commit is contained in:
parent
5bf52023e7
commit
7ebebd6922
|
@ -689,7 +689,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
||||||
tsOutputChannels->isCylinderCleanupActivated = engine->isCylinderCleanupMode;
|
tsOutputChannels->isCylinderCleanupActivated = engine->isCylinderCleanupMode;
|
||||||
|
|
||||||
#if EFI_VEHICLE_SPEED
|
#if EFI_VEHICLE_SPEED
|
||||||
float vehicleSpeed = getVehicleSpeed();
|
float vehicleSpeed = Sensor::get(SensorType::VehicleSpeed).value_or(0);
|
||||||
tsOutputChannels->vehicleSpeedKph = vehicleSpeed;
|
tsOutputChannels->vehicleSpeedKph = vehicleSpeed;
|
||||||
tsOutputChannels->speedToRpmRatio = vehicleSpeed / rpm;
|
tsOutputChannels->speedToRpmRatio = vehicleSpeed / rpm;
|
||||||
|
|
||||||
|
|
|
@ -478,7 +478,8 @@ float IdleController::getClosedLoop(IIdleController::Phase phase, float tpsPos,
|
||||||
float crankingTaper = getCrankingTaperFraction();
|
float crankingTaper = getCrankingTaperFraction();
|
||||||
|
|
||||||
// Determine what operation phase we're in - idling or not
|
// Determine what operation phase we're in - idling or not
|
||||||
auto phase = determinePhase(rpm, targetRpm, tps, getVehicleSpeed(PASS_ENGINE_PARAMETER_SIGNATURE), crankingTaper);
|
float vehicleSpeed = Sensor::get(SensorType::VehicleSpeed).value_or(0);
|
||||||
|
auto phase = determinePhase(rpm, targetRpm, tps, vehicleSpeed, crankingTaper);
|
||||||
m_lastPhase = phase;
|
m_lastPhase = phase;
|
||||||
|
|
||||||
engine->engineState.isAutomaticIdle = tps.Valid && engineConfiguration->idleMode == IM_AUTO;
|
engine->engineState.isAutomaticIdle = tps.Valid && engineConfiguration->idleMode == IM_AUTO;
|
||||||
|
|
|
@ -18,7 +18,7 @@ void DynoView::update(vssSrc src) {
|
||||||
efitimeus_t timeNow, deltaTime = 0.0;
|
efitimeus_t timeNow, deltaTime = 0.0;
|
||||||
float speed,deltaSpeed = 0.0;
|
float speed,deltaSpeed = 0.0;
|
||||||
timeNow = getTimeNowUs();
|
timeNow = getTimeNowUs();
|
||||||
speed = getVehicleSpeed(PASS_ENGINE_PARAMETER_SIGNATURE);
|
speed = Sensor::get(SensorType::VehicleSpeed).value_or(0);
|
||||||
if (src == ICU) {
|
if (src == ICU) {
|
||||||
speed = efiRound(speed,1.0);
|
speed = efiRound(speed,1.0);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -55,7 +55,7 @@ bool LaunchControlBase::isInsideSwitchCondition() const {
|
||||||
* then we have to return true, and trust that we would disable by other condition!
|
* then we have to return true, and trust that we would disable by other condition!
|
||||||
*/
|
*/
|
||||||
bool LaunchControlBase::isInsideSpeedCondition() const {
|
bool LaunchControlBase::isInsideSpeedCondition() const {
|
||||||
int speed = getVehicleSpeed(PASS_ENGINE_PARAMETER_SIGNATURE);
|
int speed = Sensor::get(SensorType::VehicleSpeed).value_or(0);
|
||||||
|
|
||||||
return (CONFIG(launchSpeedTreshold) > speed) || (!(CONFIG(launchActivationMode) == ALWAYS_ACTIVE_LAUNCH));
|
return (CONFIG(launchSpeedTreshold) > speed) || (!(CONFIG(launchActivationMode) == ALWAYS_ACTIVE_LAUNCH));
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,7 +173,7 @@ void canMazdaRX8(CanCycle cycle) {
|
||||||
{
|
{
|
||||||
CanTxMessage msg(CAN_MAZDA_RX_RPM_SPEED);
|
CanTxMessage msg(CAN_MAZDA_RX_RPM_SPEED);
|
||||||
|
|
||||||
float kph = getVehicleSpeed();
|
float kph = Sensor::get(SensorType::VehicleSpeed).value_or(0);
|
||||||
|
|
||||||
msg.setShortValue(SWAP_UINT16(GET_RPM() * 4), 0);
|
msg.setShortValue(SWAP_UINT16(GET_RPM() * 4), 0);
|
||||||
msg.setShortValue(0xFFFF, 2);
|
msg.setShortValue(0xFFFF, 2);
|
||||||
|
@ -497,7 +497,8 @@ void canDashboardBMWE90(CanCycle cycle)
|
||||||
}
|
}
|
||||||
|
|
||||||
{ //E90_SPEED
|
{ //E90_SPEED
|
||||||
float mph = getVehicleSpeed() * 0.6213712;
|
auto vehicleSpeed = Sensor::get(SensorType::VehicleSpeed).value_or(0);
|
||||||
|
float mph = vehicleSpeed * 0.6213712;
|
||||||
mph_ctr = ((TIME_I2MS(chVTGetSystemTime()) - mph_timer) / 50);
|
mph_ctr = ((TIME_I2MS(chVTGetSystemTime()) - mph_timer) / 50);
|
||||||
mph_a = (mph_ctr * mph / 2);
|
mph_a = (mph_ctr * mph / 2);
|
||||||
mph_2a = mph_a + mph_last;
|
mph_2a = mph_a + mph_last;
|
||||||
|
@ -753,7 +754,8 @@ void canDashboardHaltech(CanCycle cycle) {
|
||||||
{
|
{
|
||||||
CanTxMessage msg(0x36C, 8);
|
CanTxMessage msg(0x36C, 8);
|
||||||
/* Wheel Speed Front Left */
|
/* Wheel Speed Front Left */
|
||||||
tmp = (getVehicleSpeed() * 10 );
|
auto vehicleSpeed = Sensor::get(SensorType::VehicleSpeed).value_or(0);
|
||||||
|
tmp = (vehicleSpeed * 10 );
|
||||||
msg[0] = (tmp >> 8);
|
msg[0] = (tmp >> 8);
|
||||||
msg[1] = (tmp & 0x00ff);
|
msg[1] = (tmp & 0x00ff);
|
||||||
/* Wheel Speed Front Right */
|
/* Wheel Speed Front Right */
|
||||||
|
@ -815,7 +817,8 @@ void canDashboardHaltech(CanCycle cycle) {
|
||||||
{
|
{
|
||||||
CanTxMessage msg(0x370, 8);
|
CanTxMessage msg(0x370, 8);
|
||||||
/* Vehicle Speed */
|
/* Vehicle Speed */
|
||||||
tmp = (getVehicleSpeed() * 10 );
|
auto vehicleSpeed = Sensor::get(SensorType::VehicleSpeed).value_or(0);
|
||||||
|
tmp = (vehicleSpeed * 10 );
|
||||||
msg[0] = (tmp >> 8);
|
msg[0] = (tmp >> 8);
|
||||||
msg[1] = (tmp & 0x00ff);
|
msg[1] = (tmp & 0x00ff);
|
||||||
/* unused */
|
/* unused */
|
||||||
|
|
|
@ -63,7 +63,7 @@ static void populateFrame(Speeds& msg) {
|
||||||
msg.injDuty = getInjectorDutyCycle(rpm);
|
msg.injDuty = getInjectorDutyCycle(rpm);
|
||||||
msg.coilDuty = getCoilDutyCycle(rpm);
|
msg.coilDuty = getCoilDutyCycle(rpm);
|
||||||
|
|
||||||
msg.vssKph = getVehicleSpeed();
|
msg.vssKph = Sensor::get(SensorType::VehicleSpeed).value_or(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PedalAndTps {
|
struct PedalAndTps {
|
||||||
|
|
|
@ -136,7 +136,7 @@ static void handleGetDataRequest(const CANRxFrame& rx) {
|
||||||
obdSendValue(_1_MODE, pid, 2, GET_RPM() * ODB_RPM_MULT); // rotation/min. (A*256+B)/4
|
obdSendValue(_1_MODE, pid, 2, GET_RPM() * ODB_RPM_MULT); // rotation/min. (A*256+B)/4
|
||||||
break;
|
break;
|
||||||
case PID_SPEED:
|
case PID_SPEED:
|
||||||
obdSendValue(_1_MODE, pid, 1, getVehicleSpeed());
|
obdSendValue(_1_MODE, pid, 1, Sensor::get(SensorType::VehicleSpeed).value_or(0));
|
||||||
break;
|
break;
|
||||||
case PID_TIMING_ADVANCE: {
|
case PID_TIMING_ADVANCE: {
|
||||||
float timing = engine->engineState.timingAdvance;
|
float timing = engine->engineState.timingAdvance;
|
||||||
|
|
|
@ -49,6 +49,8 @@ static const char* const s_sensorNames[] = {
|
||||||
"Aux 2",
|
"Aux 2",
|
||||||
"Aux 3",
|
"Aux 3",
|
||||||
"Aux 4",
|
"Aux 4",
|
||||||
|
|
||||||
|
"Vehicle speed",
|
||||||
};
|
};
|
||||||
|
|
||||||
// This struct represents one sensor in the registry.
|
// This struct represents one sensor in the registry.
|
||||||
|
|
|
@ -73,6 +73,8 @@ enum class SensorType : unsigned char {
|
||||||
Aux3 = 32,
|
Aux3 = 32,
|
||||||
Aux4 = 33,
|
Aux4 = 33,
|
||||||
|
|
||||||
|
VehicleSpeed = 34,
|
||||||
|
|
||||||
// Leave me at the end!
|
// Leave me at the end!
|
||||||
PlaceholderLast = 34,
|
PlaceholderLast = 35,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1052,6 +1052,7 @@ const command_f_s commandsF[] = {
|
||||||
{"fsio_curve_2_value", setFsioCurve2Value},
|
{"fsio_curve_2_value", setFsioCurve2Value},
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
#if EFI_VEHICLE_SPEED
|
#if EFI_VEHICLE_SPEED
|
||||||
|
//todo: This function become deprecated soon
|
||||||
{"mock_vehicle_speed", setMockVehicleSpeed},
|
{"mock_vehicle_speed", setMockVehicleSpeed},
|
||||||
#endif /* EFI_VEHICLE_SPEED */
|
#endif /* EFI_VEHICLE_SPEED */
|
||||||
#if EFI_IDLE_CONTROL
|
#if EFI_IDLE_CONTROL
|
||||||
|
|
|
@ -29,6 +29,7 @@ void initFlexSensor(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||||
void initFuelLevel(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
void initFuelLevel(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||||
void initBaro(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
void initBaro(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||||
void initAuxSensors(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
void initAuxSensors(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||||
|
void initVehicleSpeedSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
// Sensor reconfiguration
|
// Sensor reconfiguration
|
||||||
void reconfigureVbatt(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
void reconfigureVbatt(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||||
|
|
|
@ -12,3 +12,4 @@ INIT_SRC_CPP = $(PROJECT_DIR)/init/sensor/init_sensors.cpp \
|
||||||
$(PROJECT_DIR)/init/sensor/init_baro.cpp \
|
$(PROJECT_DIR)/init/sensor/init_baro.cpp \
|
||||||
$(PROJECT_DIR)/init/sensor/init_fuel_level.cpp \
|
$(PROJECT_DIR)/init/sensor/init_fuel_level.cpp \
|
||||||
$(PROJECT_DIR)/init/sensor/init_aux.cpp \
|
$(PROJECT_DIR)/init/sensor/init_aux.cpp \
|
||||||
|
$(PROJECT_DIR)/init/sensor/init_vehicle_speed_sensor.cpp \
|
||||||
|
|
|
@ -23,6 +23,7 @@ void initNewSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
initFlexSensor(PASS_CONFIG_PARAMETER_SIGNATURE);
|
initFlexSensor(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
initBaro(PASS_CONFIG_PARAMETER_SIGNATURE);
|
initBaro(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
initAuxSensors(PASS_CONFIG_PARAMETER_SIGNATURE);
|
initAuxSensors(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
|
initVehicleSpeedSensor(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
#if !EFI_UNIT_TEST
|
#if !EFI_UNIT_TEST
|
||||||
initFuelLevel(PASS_CONFIG_PARAMETER_SIGNATURE);
|
initFuelLevel(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
#include "pch.h"
|
||||||
|
|
||||||
|
#include "init.h"
|
||||||
|
#include "vehicle_speed.h"
|
||||||
|
#include "function_pointer_sensor.h"
|
||||||
|
|
||||||
|
struct GetVehicleSpeedWrapper {
|
||||||
|
DECLARE_ENGINE_PTR;
|
||||||
|
|
||||||
|
float getVehicleSpeed() {
|
||||||
|
return ::getVehicleSpeed(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static GetVehicleSpeedWrapper vehicleSpeedWrapper;
|
||||||
|
|
||||||
|
static FunctionPointerSensor vehicleSpeedSensor(SensorType::VehicleSpeed,
|
||||||
|
[]() {
|
||||||
|
return vehicleSpeedWrapper.getVehicleSpeed();
|
||||||
|
});
|
||||||
|
|
||||||
|
void initVehicleSpeedSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
|
INJECT_ENGINE_REFERENCE(&vehicleSpeedWrapper);
|
||||||
|
|
||||||
|
vehicleSpeedSensor.Register();
|
||||||
|
}
|
|
@ -27,11 +27,11 @@ TEST(DynoView, VSS_T1) {
|
||||||
engineConfiguration->vehicleWeight = 900;
|
engineConfiguration->vehicleWeight = 900;
|
||||||
eth.moveTimeForwardMs(50);
|
eth.moveTimeForwardMs(50);
|
||||||
|
|
||||||
setMockVehicleSpeed(18.0 PASS_ENGINE_PARAMETER_SUFFIX);
|
Sensor::setMockValue(SensorType::VehicleSpeed, 18.0);
|
||||||
dut.update(ICU);
|
dut.update(ICU);
|
||||||
|
|
||||||
eth.moveTimeForwardAndInvokeEventsSec(20);
|
eth.moveTimeForwardAndInvokeEventsSec(20);
|
||||||
setMockVehicleSpeed(126.0 PASS_ENGINE_PARAMETER_SUFFIX);
|
Sensor::setMockValue(SensorType::VehicleSpeed, 126.0);
|
||||||
dut.update(ICU);
|
dut.update(ICU);
|
||||||
|
|
||||||
ASSERT_EQ(1.5, dut.getAcceleration());
|
ASSERT_EQ(1.5, dut.getAcceleration());
|
||||||
|
@ -47,7 +47,7 @@ TEST(DynoView, algo) {
|
||||||
engineConfiguration->vehicleWeight = 900;
|
engineConfiguration->vehicleWeight = 900;
|
||||||
|
|
||||||
//to capture vss
|
//to capture vss
|
||||||
setMockVehicleSpeed(35*3.6 PASS_ENGINE_PARAMETER_SUFFIX);
|
Sensor::setMockValue(SensorType::VehicleSpeed, 35*3.6);
|
||||||
dut.update(ICU);
|
dut.update(ICU);
|
||||||
|
|
||||||
dut.setAcceleration(1.5);
|
dut.setAcceleration(1.5);
|
||||||
|
@ -73,12 +73,12 @@ TEST(DynoView, VSS_fast) {
|
||||||
engine->rpmCalculator.mockRpm = 2200;
|
engine->rpmCalculator.mockRpm = 2200;
|
||||||
eth.moveTimeForwardMs(50);
|
eth.moveTimeForwardMs(50);
|
||||||
|
|
||||||
setMockVehicleSpeed(50.0 PASS_ENGINE_PARAMETER_SUFFIX);
|
Sensor::setMockValue(SensorType::VehicleSpeed, 50.0);
|
||||||
dut.update(CAN);
|
dut.update(CAN);
|
||||||
|
|
||||||
//delay 50ms
|
//delay 50ms
|
||||||
eth.moveTimeForwardMs(50);
|
eth.moveTimeForwardMs(50);
|
||||||
setMockVehicleSpeed(50.252 PASS_ENGINE_PARAMETER_SUFFIX);
|
Sensor::setMockValue(SensorType::VehicleSpeed, 50.252);
|
||||||
dut.update(CAN);
|
dut.update(CAN);
|
||||||
|
|
||||||
ASSERT_EQ(1259, dut.getEngineForce());
|
ASSERT_EQ(1259, dut.getEngineForce());
|
||||||
|
@ -97,12 +97,12 @@ TEST(DynoView, VSS_Torque) {
|
||||||
engine->rpmCalculator.mockRpm = 2200;
|
engine->rpmCalculator.mockRpm = 2200;
|
||||||
eth.moveTimeForwardMs(50);
|
eth.moveTimeForwardMs(50);
|
||||||
|
|
||||||
setMockVehicleSpeed(80.0 PASS_ENGINE_PARAMETER_SUFFIX);
|
Sensor::setMockValue(SensorType::VehicleSpeed, 80.0);
|
||||||
dut.update(CAN);
|
dut.update(CAN);
|
||||||
|
|
||||||
//delay 50ms
|
//delay 50ms
|
||||||
eth.moveTimeForwardMs(50);
|
eth.moveTimeForwardMs(50);
|
||||||
setMockVehicleSpeed(80.504 PASS_ENGINE_PARAMETER_SUFFIX);
|
Sensor::setMockValue(SensorType::VehicleSpeed, 80.504);
|
||||||
dut.update(CAN);
|
dut.update(CAN);
|
||||||
|
|
||||||
ASSERT_EQ(242, dut.getEngineTorque());
|
ASSERT_EQ(242, dut.getEngineTorque());
|
||||||
|
|
|
@ -425,7 +425,7 @@ TEST(idle_v2, IntegrationManual) {
|
||||||
float expectedClt = 37;
|
float expectedClt = 37;
|
||||||
Sensor::setMockValue(SensorType::DriverThrottleIntent, expectedTps.Value);
|
Sensor::setMockValue(SensorType::DriverThrottleIntent, expectedTps.Value);
|
||||||
Sensor::setMockValue(SensorType::Clt, expectedClt);
|
Sensor::setMockValue(SensorType::Clt, expectedClt);
|
||||||
setMockVehicleSpeed(15 PASS_ENGINE_PARAMETER_SUFFIX);
|
Sensor::setMockValue(SensorType::VehicleSpeed, 15.0);
|
||||||
ENGINE(rpmCalculator.mockRpm) = 950;
|
ENGINE(rpmCalculator.mockRpm) = 950;
|
||||||
|
|
||||||
// Target of 1000 rpm
|
// Target of 1000 rpm
|
||||||
|
@ -460,7 +460,7 @@ TEST(idle_v2, IntegrationAutomatic) {
|
||||||
float expectedClt = 37;
|
float expectedClt = 37;
|
||||||
Sensor::setMockValue(SensorType::DriverThrottleIntent, expectedTps.Value);
|
Sensor::setMockValue(SensorType::DriverThrottleIntent, expectedTps.Value);
|
||||||
Sensor::setMockValue(SensorType::Clt, expectedClt);
|
Sensor::setMockValue(SensorType::Clt, expectedClt);
|
||||||
setMockVehicleSpeed(15 PASS_ENGINE_PARAMETER_SUFFIX);
|
Sensor::setMockValue(SensorType::VehicleSpeed, 15.0);
|
||||||
ENGINE(rpmCalculator.mockRpm) = 950;
|
ENGINE(rpmCalculator.mockRpm) = 950;
|
||||||
|
|
||||||
// Target of 1000 rpm
|
// Target of 1000 rpm
|
||||||
|
@ -498,7 +498,7 @@ TEST(idle_v2, IntegrationClamping) {
|
||||||
float expectedClt = 37;
|
float expectedClt = 37;
|
||||||
Sensor::setMockValue(SensorType::DriverThrottleIntent, expectedTps.Value);
|
Sensor::setMockValue(SensorType::DriverThrottleIntent, expectedTps.Value);
|
||||||
Sensor::setMockValue(SensorType::Clt, expectedClt);
|
Sensor::setMockValue(SensorType::Clt, expectedClt);
|
||||||
setMockVehicleSpeed(15 PASS_ENGINE_PARAMETER_SUFFIX);
|
Sensor::setMockValue(SensorType::VehicleSpeed, 15.0);
|
||||||
ENGINE(rpmCalculator.mockRpm) = 950;
|
ENGINE(rpmCalculator.mockRpm) = 950;
|
||||||
|
|
||||||
// Target of 1000 rpm
|
// Target of 1000 rpm
|
||||||
|
|
|
@ -35,10 +35,10 @@ TEST(LaunchControl, VSSCondition) {
|
||||||
engineConfiguration->launchActivationMode = ALWAYS_ACTIVE_LAUNCH;
|
engineConfiguration->launchActivationMode = ALWAYS_ACTIVE_LAUNCH;
|
||||||
engineConfiguration->launchSpeedTreshold = 30;
|
engineConfiguration->launchSpeedTreshold = 30;
|
||||||
engineConfiguration->launchDisableBySpeed = 1;
|
engineConfiguration->launchDisableBySpeed = 1;
|
||||||
setMockVehicleSpeed(10 PASS_ENGINE_PARAMETER_SUFFIX);
|
Sensor::setMockValue(SensorType::VehicleSpeed, 10.0);
|
||||||
EXPECT_TRUE(dut.isInsideSpeedCondition());
|
EXPECT_TRUE(dut.isInsideSpeedCondition());
|
||||||
|
|
||||||
setMockVehicleSpeed(40 PASS_ENGINE_PARAMETER_SUFFIX);
|
Sensor::setMockValue(SensorType::VehicleSpeed, 40.0);
|
||||||
EXPECT_FALSE(dut.isInsideSpeedCondition());
|
EXPECT_FALSE(dut.isInsideSpeedCondition());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ TEST(LaunchControl, CombinedCondition) {
|
||||||
//valid TPS
|
//valid TPS
|
||||||
Sensor::setMockValue(SensorType::DriverThrottleIntent, 20.0f);
|
Sensor::setMockValue(SensorType::DriverThrottleIntent, 20.0f);
|
||||||
|
|
||||||
setMockVehicleSpeed(10 PASS_ENGINE_PARAMETER_SUFFIX);
|
Sensor::setMockValue(SensorType::VehicleSpeed, 10.0);
|
||||||
engine->rpmCalculator.mockRpm = 1200;
|
engine->rpmCalculator.mockRpm = 1200;
|
||||||
|
|
||||||
EXPECT_FALSE(dut.isLaunchConditionMet(1200));
|
EXPECT_FALSE(dut.isLaunchConditionMet(1200));
|
||||||
|
@ -122,7 +122,7 @@ TEST(LaunchControl, CombinedCondition) {
|
||||||
engine->rpmCalculator.mockRpm = 3200;
|
engine->rpmCalculator.mockRpm = 3200;
|
||||||
EXPECT_TRUE(dut.isLaunchConditionMet(3200));
|
EXPECT_TRUE(dut.isLaunchConditionMet(3200));
|
||||||
|
|
||||||
setMockVehicleSpeed(40 PASS_ENGINE_PARAMETER_SUFFIX);
|
Sensor::setMockValue(SensorType::VehicleSpeed, 40.0);
|
||||||
EXPECT_FALSE(dut.isLaunchConditionMet(3200));
|
EXPECT_FALSE(dut.isLaunchConditionMet(3200));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ TEST(LaunchControl, CompleteRun) {
|
||||||
//valid TPS
|
//valid TPS
|
||||||
Sensor::setMockValue(SensorType::DriverThrottleIntent, 20.0f);
|
Sensor::setMockValue(SensorType::DriverThrottleIntent, 20.0f);
|
||||||
|
|
||||||
setMockVehicleSpeed(10 PASS_ENGINE_PARAMETER_SUFFIX);
|
Sensor::setMockValue(SensorType::VehicleSpeed, 10.0);
|
||||||
engine->rpmCalculator.mockRpm = 1200;
|
engine->rpmCalculator.mockRpm = 1200;
|
||||||
|
|
||||||
//update condition check
|
//update condition check
|
||||||
|
@ -184,7 +184,7 @@ TEST(LaunchControl, CompleteRun) {
|
||||||
EXPECT_TRUE(spark);
|
EXPECT_TRUE(spark);
|
||||||
EXPECT_FALSE(fuel);
|
EXPECT_FALSE(fuel);
|
||||||
|
|
||||||
setMockVehicleSpeed(40 PASS_ENGINE_PARAMETER_SUFFIX);
|
Sensor::setMockValue(SensorType::VehicleSpeed, 40.0);
|
||||||
updateLaunchConditions(PASS_ENGINE_PARAMETER_SIGNATURE);
|
updateLaunchConditions(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
spark = false;
|
spark = false;
|
||||||
fuel = false;
|
fuel = false;
|
||||||
|
|
Loading…
Reference in New Issue