ETB target is using integer values #945
refactoring - ADC mocking is a mess
This commit is contained in:
parent
5a43153541
commit
7d65f1931e
|
@ -69,6 +69,7 @@ MockAdcState::MockAdcState() {
|
||||||
|
|
||||||
#if EFI_ENABLE_MOCK_ADC
|
#if EFI_ENABLE_MOCK_ADC
|
||||||
void MockAdcState::setMockVoltage(int hwChannel, float voltage DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void MockAdcState::setMockVoltage(int hwChannel, float voltage DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
|
efiAssertVoid(OBD_PCM_Processor_Fault, hwChannel >= 0 && hwChannel < MOCK_ADC_SIZE, "hwChannel out of bounds");
|
||||||
scheduleMsg(&engineLogger, "fake voltage: channel %d value %.2f", hwChannel, voltage);
|
scheduleMsg(&engineLogger, "fake voltage: channel %d value %.2f", hwChannel, voltage);
|
||||||
|
|
||||||
fakeAdcValues[hwChannel] = voltsToAdc(voltage);
|
fakeAdcValues[hwChannel] = voltsToAdc(voltage);
|
||||||
|
@ -245,6 +246,7 @@ SensorsState::SensorsState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int MockAdcState::getMockAdcValue(int hwChannel) const {
|
int MockAdcState::getMockAdcValue(int hwChannel) const {
|
||||||
|
efiAssertVoid(OBD_PCM_Processor_Fault, hwChannel >= 0 && hwChannel < MOCK_ADC_SIZE, "hwChannel out of bounds");
|
||||||
return fakeAdcValues[hwChannel];
|
return fakeAdcValues[hwChannel];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include "cyclic_buffer.h"
|
#include "cyclic_buffer.h"
|
||||||
#include "thermistor_generated.h"
|
#include "thermistor_generated.h"
|
||||||
|
|
||||||
#define MOCK_ADC_SIZE 16
|
#define MOCK_ADC_SIZE 26
|
||||||
|
|
||||||
class MockAdcState {
|
class MockAdcState {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -67,6 +67,7 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType, configuration_callb
|
||||||
engine->engineConfigurationPtr->iat.adcChannel = TEST_IAT_CHANNEL;
|
engine->engineConfigurationPtr->iat.adcChannel = TEST_IAT_CHANNEL;
|
||||||
// magic voltage to get nice CLT
|
// magic voltage to get nice CLT
|
||||||
testCltValue = 1.492964;
|
testCltValue = 1.492964;
|
||||||
|
//todosetMockCltVoltage(1.492964 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
// magic voltage to get nice IAT
|
// magic voltage to get nice IAT
|
||||||
testIatValue = 4.03646;
|
testIatValue = 4.03646;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue