This commit is contained in:
rusefi 2019-02-28 21:09:31 -05:00
parent ec6bde7c26
commit cf8ddde1ce
5 changed files with 14 additions and 13 deletions

View File

@ -557,9 +557,7 @@ typedef enum {
* Frankenso analog #12 PC4 ADC14
*/
typedef enum
//__attribute__ ((__packed__))
{
typedef enum __attribute__ ((__packed__)) {
EFI_ADC_0 = 0, // PA0
EFI_ADC_1 = 1, // PA1
EFI_ADC_2 = 2, // PA2
@ -580,6 +578,11 @@ typedef enum
// todo: bad choice of value since now we have ADC_CHANNEL_SENSOR and could end up with 17 and 18 also
EFI_ADC_NONE = 16,
EFI_ADC_ERROR = 17,
#if EFI_UNIT_TEST
TEST_MAF_CHANNEL = 113,
TEST_CLT_CHANNEL = 114,
TEST_IAT_CHANNEL = 115,
#endif
} adc_channel_e;
typedef enum {

View File

@ -11,7 +11,7 @@ float testMafValue = 0;
float testCltValue = 0;
float testIatValue = 0;
float getVoltageDivided(const char *msg, int channel) {
float getVoltageDivided(const char *msg, adc_channel_e channel) {
switch(channel) {
case TEST_MAF_CHANNEL:
return testMafValue;

View File

@ -8,13 +8,11 @@
#ifndef BOARDS_H_
#define BOARDS_H_
#include "rusefi_enums.h"
#define ADC_CHANNEL_VREF 0
#define TEST_MAF_CHANNEL 10000013
#define TEST_CLT_CHANNEL 10000014
#define TEST_IAT_CHANNEL 10000015
float getVoltageDivided(const char *msg, int);
float getVoltageDivided(const char *msg, adc_channel_e);
float getVoltage(const char *msg, int channel);
int getAdcValue(const char *msg, int channel);

View File

@ -62,9 +62,9 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType) : engine (&persiste
resetConfigurationExt(NULL, engineType PASS_ENGINE_PARAMETER_SUFFIX);
prepareShapes(PASS_ENGINE_PARAMETER_SIGNATURE);
engine->engineConfigurationPtr->mafAdcChannel = (adc_channel_e)TEST_MAF_CHANNEL;
engine->engineConfigurationPtr->clt.adcChannel = (adc_channel_e)TEST_CLT_CHANNEL;
engine->engineConfigurationPtr->iat.adcChannel = (adc_channel_e)TEST_IAT_CHANNEL;
engine->engineConfigurationPtr->mafAdcChannel = TEST_MAF_CHANNEL;
engine->engineConfigurationPtr->clt.adcChannel = TEST_CLT_CHANNEL;
engine->engineConfigurationPtr->iat.adcChannel = TEST_IAT_CHANNEL;
testCltValue = 1.492964;
testIatValue = 4.03646;

View File

@ -15,7 +15,7 @@
#include "advance_map.h"
TEST(misc, structSize) {
// ASSERT_EQ(1, sizeof(adc_channel_e)) << "small enum size";
ASSERT_EQ(1, sizeof(adc_channel_e)) << "small enum size";
ASSERT_EQ(1, sizeof(pin_input_mode_e)) << "small enum size";
ASSERT_EQ(1, sizeof(pin_output_mode_e)) << "small enum size";
// ASSERT_EQ(1, sizeof(brain_pin_e)) << "small enum size";