auto-sync
This commit is contained in:
parent
6dc88483eb
commit
6bde5d1966
|
@ -21,7 +21,7 @@
|
||||||
void setDodgeNeonEngineConfiguration(engine_configuration_s *engineConfiguration,
|
void setDodgeNeonEngineConfiguration(engine_configuration_s *engineConfiguration,
|
||||||
board_configuration_s *boardConfiguration) {
|
board_configuration_s *boardConfiguration) {
|
||||||
|
|
||||||
engineConfiguration->triggerConfig.triggerType = TT_DODGE_NEON;
|
engineConfiguration->triggerConfig.triggerType = TT_DODGE_NEON_1995;
|
||||||
|
|
||||||
engineConfiguration->algorithm = LM_TPS;
|
engineConfiguration->algorithm = LM_TPS;
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
#include "engine_state.h"
|
#include "engine_state.h"
|
||||||
|
#include "efiGpio.h"
|
||||||
|
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
static Logging logger;
|
static Logging logger;
|
||||||
|
@ -35,8 +36,34 @@ void Engine::init() {
|
||||||
initLogging(&logger, "engine");
|
initLogging(&logger, "engine");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool stopPin(io_pin_e pin) {
|
||||||
|
if (getOutputPinValue(pin)) {
|
||||||
|
setOutputPinValue(pin, 0);
|
||||||
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
|
scheduleMsg(&logger, "turning off %s", getPinName(pin));
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Engine::stopPins() {
|
||||||
|
bool result = false;
|
||||||
|
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
|
||||||
|
io_pin_e pin = (io_pin_e) ((int) INJECTOR_1_OUTPUT + i);
|
||||||
|
result |= stopPin(pin);
|
||||||
|
pin = (io_pin_e) ((int) SPARKOUT_1_OUTPUT + i);
|
||||||
|
result |= stopPin(pin);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void Engine::watchdog() {
|
void Engine::watchdog() {
|
||||||
if (!isSpinning) {
|
if (!isSpinning) {
|
||||||
|
if (stopPins()) {
|
||||||
|
firmwareError("Some pins were turned off by 2nd pass watchdog");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint64_t nowUs = getTimeNowUs();
|
uint64_t nowUs = getTimeNowUs();
|
||||||
|
@ -47,15 +74,10 @@ void Engine::watchdog() {
|
||||||
if (nowUs - lastTriggerEventTimeUs < 250000) {
|
if (nowUs - lastTriggerEventTimeUs < 250000) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
isSpinning = true;
|
isSpinning = false;
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
scheduleMsg(&logger, "engine has STOPPED");
|
scheduleMsg(&logger, "engine has STOPPED");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
|
stopPins();
|
||||||
// io_pin_e pin = (io_pin_e) ((int) INJECTOR_1_OUTPUT + i);
|
|
||||||
|
|
||||||
//pin = (io_pin_e) ((int) SPARKOUT_1_OUTPUT + i);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ private:
|
||||||
* 'spinning' means the engine is not stopped
|
* 'spinning' means the engine is not stopped
|
||||||
*/
|
*/
|
||||||
bool isSpinning;
|
bool isSpinning;
|
||||||
|
bool stopPins();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* ENGINE_H_ */
|
#endif /* ENGINE_H_ */
|
||||||
|
|
|
@ -89,7 +89,9 @@ typedef enum {
|
||||||
|
|
||||||
SUBARU_2003_WRX = 22,
|
SUBARU_2003_WRX = 22,
|
||||||
|
|
||||||
ET_UNUSED = 23,
|
DODGE_NEON_2003 = 23,
|
||||||
|
|
||||||
|
ET_UNUSED = 24,
|
||||||
|
|
||||||
Force_4b_engine_type = ENUM_SIZE_HACK,
|
Force_4b_engine_type = ENUM_SIZE_HACK,
|
||||||
} engine_type_e;
|
} engine_type_e;
|
||||||
|
@ -97,7 +99,7 @@ typedef enum {
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TT_TOOTHED_WHEEL = 0,
|
TT_TOOTHED_WHEEL = 0,
|
||||||
TT_FORD_ASPIRE = 1,
|
TT_FORD_ASPIRE = 1,
|
||||||
TT_DODGE_NEON = 2,
|
TT_DODGE_NEON_1995 = 2,
|
||||||
TT_MAZDA_MIATA_NA = 3,
|
TT_MAZDA_MIATA_NA = 3,
|
||||||
TT_MAZDA_MIATA_NB = 4,
|
TT_MAZDA_MIATA_NB = 4,
|
||||||
TT_GM_7X = 5,
|
TT_GM_7X = 5,
|
||||||
|
@ -114,6 +116,8 @@ typedef enum {
|
||||||
|
|
||||||
TT_HONDA_ACCORD_CD_DIP = 13,
|
TT_HONDA_ACCORD_CD_DIP = 13,
|
||||||
|
|
||||||
|
TT_DODGE_NEON_2003 = 14,
|
||||||
|
|
||||||
Force_4b_trigger_type = ENUM_SIZE_HACK,
|
Force_4b_trigger_type = ENUM_SIZE_HACK,
|
||||||
} trigger_type_e;
|
} trigger_type_e;
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,10 @@ void setPinValue(OutputPin * outputPin, int electricalValue, int logicValue) {
|
||||||
* @brief Sets the value according to current electrical settings
|
* @brief Sets the value according to current electrical settings
|
||||||
*/
|
*/
|
||||||
void setOutputPinValue(io_pin_e pin, int logicValue) {
|
void setOutputPinValue(io_pin_e pin, int logicValue) {
|
||||||
|
#if EFI_PROD_CODE
|
||||||
if (outputs[pin].port == GPIO_NULL)
|
if (outputs[pin].port == GPIO_NULL)
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
efiAssertVoid(pinDefaultState[pin]!=NULL, "pin mode not initialized");
|
efiAssertVoid(pinDefaultState[pin]!=NULL, "pin mode not initialized");
|
||||||
pin_output_mode_e mode = *pinDefaultState[pin];
|
pin_output_mode_e mode = *pinDefaultState[pin];
|
||||||
setPinValue(&outputs[pin], getElectricalValue(logicValue, mode), logicValue);
|
setPinValue(&outputs[pin], getElectricalValue(logicValue, mode), logicValue);
|
||||||
|
|
|
@ -208,7 +208,7 @@ void initializeTriggerShape(Logging *logger, engine_configuration_s const *engin
|
||||||
initializeMazdaMiataNbShape(triggerShape);
|
initializeMazdaMiataNbShape(triggerShape);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case TT_DODGE_NEON:
|
case TT_DODGE_NEON_1995:
|
||||||
configureNeonTriggerShape(triggerShape);
|
configureNeonTriggerShape(triggerShape);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ uint32_t efiStrlen(const char *param) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool startsWith(const char *line, const char *prefix) {
|
bool startsWith(const char *line, const char *prefix) {
|
||||||
int len = efiStrlen(prefix);
|
uint32_t len = efiStrlen(prefix);
|
||||||
if(efiStrlen(line) < len) {
|
if(efiStrlen(line) < len) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
static ActuatorEventList eventList;
|
static ActuatorEventList eventList;
|
||||||
static ActuatorEventList result;
|
static ActuatorEventList result;
|
||||||
|
|
||||||
int pinDefaultState[IO_PIN_COUNT];
|
|
||||||
|
|
||||||
extern int outputSignalCount;
|
extern int outputSignalCount;
|
||||||
|
|
||||||
void testEventRegistry(void) {
|
void testEventRegistry(void) {
|
||||||
|
|
Loading…
Reference in New Issue