mirror of https://github.com/rusefi/rusefi-1.git
unit tests progress
This commit is contained in:
parent
e3f5ce0aee
commit
c59d8164c6
|
@ -305,7 +305,7 @@ OutputPin::OutputPin() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OutputPin::isInitialized() {
|
bool OutputPin::isInitialized() {
|
||||||
#if EFI_GPIO_HARDWARE
|
#if EFI_GPIO_HARDWARE && EFI_PROD_CODE
|
||||||
#if (BOARD_EXT_GPIOCHIPS > 0)
|
#if (BOARD_EXT_GPIOCHIPS > 0)
|
||||||
if (ext)
|
if (ext)
|
||||||
return true;
|
return true;
|
||||||
|
@ -362,7 +362,7 @@ void OutputPin::setDefaultPinState(const pin_output_mode_e *outputMode) {
|
||||||
setValue(false); // initial state
|
setValue(false); // initial state
|
||||||
}
|
}
|
||||||
|
|
||||||
void initOutputPins(void) {
|
void initOutputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
#if EFI_GPIO_HARDWARE
|
#if EFI_GPIO_HARDWARE
|
||||||
/**
|
/**
|
||||||
* want to make sure it's all zeros so that we can compare in initOutputPinExt() method
|
* want to make sure it's all zeros so that we can compare in initOutputPinExt() method
|
||||||
|
@ -420,7 +420,7 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputPin::initPin(const char *msg, brain_pin_e brainPin, const pin_output_mode_e *outputMode) {
|
void OutputPin::initPin(const char *msg, brain_pin_e brainPin, const pin_output_mode_e *outputMode) {
|
||||||
#if EFI_GPIO_HARDWARE
|
#if EFI_GPIO_HARDWARE && EFI_PROD_CODE
|
||||||
if (brainPin == GPIO_UNASSIGNED)
|
if (brainPin == GPIO_UNASSIGNED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -480,14 +480,16 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin, const pin_output_
|
||||||
#if EFI_GPIO_HARDWARE
|
#if EFI_GPIO_HARDWARE
|
||||||
|
|
||||||
// questionable trick: we avoid using 'getHwPort' and 'getHwPin' in case of errors in order to increase the changes of turning the LED
|
// questionable trick: we avoid using 'getHwPort' and 'getHwPin' in case of errors in order to increase the changes of turning the LED
|
||||||
// by reducing stack requirment
|
// by reducing stack requirement
|
||||||
ioportid_t errorLedPort;
|
ioportid_t errorLedPort;
|
||||||
ioportmask_t errorLedPin;
|
ioportmask_t errorLedPin;
|
||||||
|
|
||||||
void initPrimaryPins(void) {
|
void initPrimaryPins(void) {
|
||||||
|
#if EFI_PROD_CODE
|
||||||
enginePins.errorLedPin.initPin("led: ERROR status", LED_ERROR_BRAIN_PIN);
|
enginePins.errorLedPin.initPin("led: ERROR status", LED_ERROR_BRAIN_PIN);
|
||||||
errorLedPort = getHwPort("primary", LED_ERROR_BRAIN_PIN);
|
errorLedPort = getHwPort("primary", LED_ERROR_BRAIN_PIN);
|
||||||
errorLedPin = getHwPin("primary", LED_ERROR_BRAIN_PIN);
|
errorLedPin = getHwPin("primary", LED_ERROR_BRAIN_PIN);
|
||||||
|
#endif /* EFI_PROD_CODE */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -503,10 +505,4 @@ void turnAllPinsOff(void) {
|
||||||
enginePins.coils[i].setValue(false);
|
enginePins.coils[i].setValue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* EFI_GPIO_HARDWARE */
|
|
||||||
const char *hwPortname(brain_pin_e brainPin) {
|
|
||||||
(void)brainPin;
|
|
||||||
return "N/A";
|
|
||||||
}
|
|
||||||
#endif /* EFI_GPIO_HARDWARE */
|
#endif /* EFI_GPIO_HARDWARE */
|
||||||
|
|
|
@ -11,9 +11,10 @@
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "io_pins.h"
|
#include "io_pins.h"
|
||||||
|
#include "engine_configuration.h"
|
||||||
|
|
||||||
void initPrimaryPins(void);
|
void initPrimaryPins(void);
|
||||||
void initOutputPins(void);
|
void initOutputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
#if EFI_GPIO_HARDWARE
|
#if EFI_GPIO_HARDWARE
|
||||||
void turnAllPinsOff(void);
|
void turnAllPinsOff(void);
|
||||||
|
|
|
@ -763,7 +763,7 @@ void TriggerState::runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SU
|
||||||
// empty base implementation
|
// empty base implementation
|
||||||
}
|
}
|
||||||
|
|
||||||
void initTriggerDecoder(void) {
|
void initTriggerDecoder(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
#if EFI_GPIO_HARDWARE
|
#if EFI_GPIO_HARDWARE
|
||||||
enginePins.triggerDecoderErrorPin.initPin("trg_err", CONFIGB(triggerErrorPin),
|
enginePins.triggerDecoderErrorPin.initPin("trg_err", CONFIGB(triggerErrorPin),
|
||||||
&CONFIGB(triggerErrorPinMode));
|
&CONFIGB(triggerErrorPinMode));
|
||||||
|
|
|
@ -165,7 +165,7 @@ uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape, tr
|
||||||
|
|
||||||
class Engine;
|
class Engine;
|
||||||
|
|
||||||
void initTriggerDecoder(void);
|
void initTriggerDecoder(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
void initTriggerDecoderLogger(Logging *sharedLogger);
|
void initTriggerDecoderLogger(Logging *sharedLogger);
|
||||||
|
|
||||||
bool isTriggerDecoderError(void);
|
bool isTriggerDecoderError(void);
|
||||||
|
|
|
@ -448,7 +448,7 @@ void initHardware(Logging *l) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_SHAFT_POSITION_INPUT
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
initTriggerDecoder();
|
initTriggerDecoder(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAL_USE_ADC
|
#if HAL_USE_ADC
|
||||||
|
@ -466,7 +466,7 @@ void initHardware(Logging *l) {
|
||||||
initSmartGpio(PASS_ENGINE_PARAMETER_SIGNATURE);
|
initSmartGpio(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
// output pins potentially depend on 'initSmartGpio'
|
// output pins potentially depend on 'initSmartGpio'
|
||||||
initOutputPins();
|
initOutputPins(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
#if EFI_MC33816
|
#if EFI_MC33816
|
||||||
initMc33816();
|
initMc33816();
|
||||||
|
|
|
@ -267,5 +267,9 @@ const char *getPinFunction(brain_input_pin_e brainPin) {
|
||||||
|
|
||||||
return getBrainUsedPin(index);
|
return getBrainUsedPin(index);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
#endif
|
const char *hwPortname(brain_pin_e brainPin) {
|
||||||
|
(void)brainPin;
|
||||||
|
return "N/A";
|
||||||
|
}
|
||||||
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
|
@ -55,7 +55,6 @@ static int getTriggerZeroEventIndex(engine_type_e engineType) {
|
||||||
|
|
||||||
static void testDodgeNeonDecoder(void) {
|
static void testDodgeNeonDecoder(void) {
|
||||||
printf("*************************************************** testDodgeNeonDecoder95\r\n");
|
printf("*************************************************** testDodgeNeonDecoder95\r\n");
|
||||||
initTriggerDecoder();
|
|
||||||
|
|
||||||
ASSERT_EQ( 8, getTriggerZeroEventIndex(DODGE_NEON_1995)) << "DODGE_NEON_1995: trigger zero index";
|
ASSERT_EQ( 8, getTriggerZeroEventIndex(DODGE_NEON_1995)) << "DODGE_NEON_1995: trigger zero index";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue