auto-sync
This commit is contained in:
parent
44f6a1dc65
commit
0975ec58e6
|
@ -58,8 +58,9 @@ void Engine::init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool stopPin(io_pin_e pin) {
|
static bool stopPin(io_pin_e pin) {
|
||||||
if (outputs[(int)pin].getLogicValue()) {
|
OutputPin *output = &outputs[(int)pin];
|
||||||
setOutputPinValue(pin, 0);
|
if (output->getLogicValue()) {
|
||||||
|
doSetOutputPinValue2(output, false);
|
||||||
scheduleMsg(&logger, "turning off %s", getPinName(pin));
|
scheduleMsg(&logger, "turning off %s", getPinName(pin));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,23 @@
|
||||||
|
|
||||||
#define NAMED_PIN_COUNT 24
|
#define NAMED_PIN_COUNT 24
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
INJECTOR_1,
|
||||||
|
INJECTOR_2,
|
||||||
|
INJECTOR_3,
|
||||||
|
INJECTOR_4,
|
||||||
|
INJECTOR_5,
|
||||||
|
INJECTOR_6,
|
||||||
|
INJECTOR_7,
|
||||||
|
INJECTOR_8,
|
||||||
|
INJECTOR_9_,
|
||||||
|
INJECTOR_10,
|
||||||
|
INJECTOR_11,
|
||||||
|
INJECTOR_12,
|
||||||
|
|
||||||
|
INJECTOR_NONE,
|
||||||
|
} injector_channel_e;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logical pins. See brain_pin_e for physical pins.
|
* Logical pins. See brain_pin_e for physical pins.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -65,7 +65,7 @@ void turnPinHigh(io_pin_e pin) {
|
||||||
#if EFI_GPIO
|
#if EFI_GPIO
|
||||||
// turn the output level ACTIVE
|
// turn the output level ACTIVE
|
||||||
// todo: this XOR should go inside the setOutputPinValue method
|
// todo: this XOR should go inside the setOutputPinValue method
|
||||||
doSetOutputPinValue(pin, true);
|
doSetOutputPinValue2((&outputs[pin]), true);
|
||||||
// sleep for the needed duration
|
// sleep for the needed duration
|
||||||
#endif
|
#endif
|
||||||
#if EFI_WAVE_CHART
|
#if EFI_WAVE_CHART
|
||||||
|
@ -84,7 +84,7 @@ void turnPinHigh(io_pin_e pin) {
|
||||||
void turnPinLow(io_pin_e pin) {
|
void turnPinLow(io_pin_e pin) {
|
||||||
#if EFI_GPIO
|
#if EFI_GPIO
|
||||||
// turn off the output
|
// turn off the output
|
||||||
doSetOutputPinValue(pin, false);
|
doSetOutputPinValue2((&outputs[pin]), false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_DEFAILED_LOGGING
|
#if EFI_DEFAILED_LOGGING
|
||||||
|
|
|
@ -107,7 +107,7 @@ void initializeIgnitionActions(angle_t advance, angle_t dwellAngle, IgnitionEven
|
||||||
|
|
||||||
IgnitionEvent *event = list->add();
|
IgnitionEvent *event = list->add();
|
||||||
|
|
||||||
if (!isPinAssigned(pin)) {
|
if (!isPinAssigned(&outputs[(pin)])) {
|
||||||
// todo: extact method for this index math
|
// todo: extact method for this index math
|
||||||
warning(OBD_PCM_Processor_Fault, "no_pin_cl #%d", (int) pin - (int) SPARKOUT_1_OUTPUT + 1);
|
warning(OBD_PCM_Processor_Fault, "no_pin_cl #%d", (int) pin - (int) SPARKOUT_1_OUTPUT + 1);
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ void initializeIgnitionActions(angle_t advance, angle_t dwellAngle, IgnitionEven
|
||||||
}
|
}
|
||||||
|
|
||||||
void FuelSchedule::registerInjectionEvent(io_pin_e pin, float angle, bool_t isSimultanious DECLARE_ENGINE_PARAMETER_S) {
|
void FuelSchedule::registerInjectionEvent(io_pin_e pin, float angle, bool_t isSimultanious DECLARE_ENGINE_PARAMETER_S) {
|
||||||
if (!isSimultanious && !isPinAssigned(pin)) {
|
if (!isSimultanious && !isPinAssigned(&outputs[(pin)])) {
|
||||||
// todo: extact method for this index math
|
// todo: extact method for this index math
|
||||||
warning(OBD_PCM_Processor_Fault, "no_pin_inj #%d", (int) pin - (int) INJECTOR_1_OUTPUT + 1);
|
warning(OBD_PCM_Processor_Fault, "no_pin_inj #%d", (int) pin - (int) INJECTOR_1_OUTPUT + 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,13 +75,4 @@ void OutputPin::setDefaultPinState(pin_output_mode_e *outputMode) {
|
||||||
setValue(false); // initial state
|
setValue(false); // initial state
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Sets the value according to current electrical settings
|
|
||||||
*
|
|
||||||
* This method costs about 85 ticks
|
|
||||||
*/
|
|
||||||
void setOutputPinValue(io_pin_e pin, int logicValue) {
|
|
||||||
doSetOutputPinValue(pin, logicValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* EFI_GPIO */
|
#endif /* EFI_GPIO */
|
||||||
|
|
|
@ -81,26 +81,18 @@ typedef struct {
|
||||||
}
|
}
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
||||||
#define turnOutputPinOn(pin) setOutputPinValue((pin), true)
|
|
||||||
#define turnOutputPinOff(pin) setOutputPinValue((pin), false)
|
|
||||||
|
|
||||||
#define getElectricalValue(logicalValue, mode) \
|
#define getElectricalValue(logicalValue, mode) \
|
||||||
(logicalValue ? getElectricalValue1(mode) : getElectricalValue0(mode))
|
(logicalValue ? getElectricalValue1(mode) : getElectricalValue0(mode))
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
void setOutputPinValue(io_pin_e pin, int logicValue);
|
|
||||||
const char *getPinName(io_pin_e io_pin);
|
|
||||||
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
#define isPinAssigned(pin) (outputs[(pin)].port != GPIO_NULL)
|
#define isPinAssigned(output) ((output)->port != GPIO_NULL)
|
||||||
#else
|
#else
|
||||||
#define isPinAssigned(pin) (true)
|
#define isPinAssigned(output) (true)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define doSetOutputPinValue(pin, logicValue) doSetOutputPinValue2((&outputs[pin]), logicValue)
|
||||||
|
|
||||||
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
#define doSetOutputPinValue2(output, logicValue) { \
|
#define doSetOutputPinValue2(output, logicValue) { \
|
||||||
if (output->port != GPIO_NULL) { \
|
if (output->port != GPIO_NULL) { \
|
||||||
|
@ -119,11 +111,8 @@ const char *getPinName(io_pin_e io_pin);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define doSetOutputPinValue(pin, logicValue) doSetOutputPinValue2((&outputs[pin]), logicValue)
|
|
||||||
void outputPinRegisterExt2(const char *msg, OutputPin *output, brain_pin_e brainPin, pin_output_mode_e *outputMode);
|
void outputPinRegisterExt2(const char *msg, OutputPin *output, brain_pin_e brainPin, pin_output_mode_e *outputMode);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
const char *getPinName(io_pin_e io_pin);
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#endif /* EFIGPIO_H_ */
|
#endif /* EFIGPIO_H_ */
|
||||||
|
|
|
@ -191,7 +191,8 @@ static io_pin_e TO_BE_TURNED_OFF_ON_ERROR[] = { SPARKOUT_1_OUTPUT, SPARKOUT_2_OU
|
||||||
void turnAllPinsOff(void) {
|
void turnAllPinsOff(void) {
|
||||||
int l = sizeof(TO_BE_TURNED_OFF_ON_ERROR) / sizeof(io_pin_e);
|
int l = sizeof(TO_BE_TURNED_OFF_ON_ERROR) / sizeof(io_pin_e);
|
||||||
for (int i = 0; i < l; i++) {
|
for (int i = 0; i < l; i++) {
|
||||||
turnOutputPinOff(TO_BE_TURNED_OFF_ON_ERROR[l]);
|
OutputPin *output = &outputs[TO_BE_TURNED_OFF_ON_ERROR[l]];
|
||||||
|
output->setValue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue