Merge remote-tracking branch 'origin/master' into master

This commit is contained in:
rusefillc 2020-12-06 15:54:23 -05:00
commit 8a1d3e9dd3
6 changed files with 11 additions and 30 deletions

View File

@ -69,9 +69,7 @@ public:
// If there's somebody already here - a consumer tried to double-register a sensor
if (m_sensor) {
// This sensor has already been registered. Don't re-register it.
#if ! EFI_UNIT_TEST
firmwareError(CUSTOM_OBD_26, "Duplicate registration for %s sensor", sensor->getSensorName());
#endif
firmwareError(CUSTOM_OBD_26, "Duplicate registration for sensor \"%s\"", sensor->getSensorName());
return false;
} else {
// Put the sensor in the registry

View File

@ -48,9 +48,7 @@ static void initFluidPressure(LinearFunc& func, FunctionalSensor& sensor, const
AdcSubscription::SubscribeSensor(sensor, channel, bandwidth);
if (!sensor.Register()) {
firmwareError(CUSTOM_INVALID_TPS_SETTING, "Duplicate registration for sensor \"%s\"", sensor.getSensorName());
}
sensor.Register();
}
void initOilPressure(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
@ -64,9 +62,7 @@ void initOilPressure(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
: SensorType::FuelPressureLow
);
if (!injectorPressure.Register()) {
firmwareError(OBD_PCM_Processor_Fault, "Duplicate sensor registration");
}
injectorPressure.Register();
}
void reconfigureOilPressure(DECLARE_CONFIG_PARAMETER_SIGNATURE) {

View File

@ -39,7 +39,5 @@ void initLambda(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
#endif
if (!lambdaSensor.Register()) {
warning(OBD_PCM_Processor_Fault, "Duplicate lambda sensor registration, ignoring");
}
lambdaSensor.Register();
}

View File

@ -60,12 +60,9 @@ static void configureTempSensor(FunctionalSensor &sensor,
configTherm(sensor, p, config, isLinear);
AdcSubscription::SubscribeSensor(sensor, channel, 2);
// Register & subscribe
if (!sensor.Register()) {
// uhh?
}
AdcSubscription::SubscribeSensor(sensor, channel, 2);
sensor.Register();
}
void initThermistors(DECLARE_CONFIG_PARAMETER_SIGNATURE) {

View File

@ -80,12 +80,7 @@ static bool initTpsFunc(LinearFunc& func, FunctionalSensor& sensor, adc_channel_
AdcSubscription::SubscribeSensor(sensor, channel, 200);
if (!sensor.Register()) {
firmwareError(CUSTOM_INVALID_TPS_SETTING, "Duplicate registration for sensor \"%s\"", sensor.getSensorName());
return false;
}
return true;
return sensor.Register();
}
static void initTpsFuncAndRedund(RedundantSensor& redund, LinearFunc& func, FunctionalSensor& sensor, adc_channel_e channel, float closed, float open, float min, float max) {
@ -93,9 +88,7 @@ static void initTpsFuncAndRedund(RedundantSensor& redund, LinearFunc& func, Func
redund.configure(5.0f, !hasSecond);
if (!redund.Register()) {
firmwareError(CUSTOM_INVALID_TPS_SETTING, "Duplicate registration for sensor \"%s\"", redund.getSensorName());
}
redund.Register();
}
void initTps(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
@ -122,9 +115,7 @@ void initTps(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
driverIntent.setProxiedSensor(SensorType::Tps1);
}
if (!driverIntent.Register()) {
firmwareError(CUSTOM_INVALID_TPS_SETTING, "Duplicate registration for driver acc intent sensor");
}
driverIntent.Register();
}
void reconfigureTps(DECLARE_CONFIG_PARAMETER_SIGNATURE) {

View File

@ -1,5 +1,6 @@
#include "mock/mock_sensor.h"
#include "stored_value_sensor.h"
#include "unit_test_framework.h"
#include <gtest/gtest.h>
@ -49,7 +50,7 @@ TEST_F(SensorBasic, DoubleRegister) {
// And then do it again!
MockSensor dut2(SensorType::Tps1);
EXPECT_FALSE(dut2.Register());
EXPECT_FATAL_ERROR(dut2.Register());
// Make sure that we get the first DUT back - not the second
auto shouldBeDut = Sensor::getSensorOfType(SensorType::Tps1);