auto-sync

This commit is contained in:
rusEfi 2014-09-27 18:02:54 -05:00
parent 6dc88483eb
commit 6bde5d1966
8 changed files with 41 additions and 15 deletions

View File

@ -21,7 +21,7 @@
void setDodgeNeonEngineConfiguration(engine_configuration_s *engineConfiguration,
board_configuration_s *boardConfiguration) {
engineConfiguration->triggerConfig.triggerType = TT_DODGE_NEON;
engineConfiguration->triggerConfig.triggerType = TT_DODGE_NEON_1995;
engineConfiguration->algorithm = LM_TPS;

View File

@ -12,6 +12,7 @@
#include "main.h"
#include "engine.h"
#include "engine_state.h"
#include "efiGpio.h"
#if EFI_PROD_CODE || EFI_SIMULATOR
static Logging logger;
@ -35,8 +36,34 @@ void Engine::init() {
initLogging(&logger, "engine");
#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() {
if (!isSpinning) {
if (stopPins()) {
firmwareError("Some pins were turned off by 2nd pass watchdog");
}
return;
}
uint64_t nowUs = getTimeNowUs();
@ -47,15 +74,10 @@ void Engine::watchdog() {
if (nowUs - lastTriggerEventTimeUs < 250000) {
return;
}
isSpinning = true;
isSpinning = false;
#if EFI_PROD_CODE || EFI_SIMULATOR
scheduleMsg(&logger, "engine has STOPPED");
#endif
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
// io_pin_e pin = (io_pin_e) ((int) INJECTOR_1_OUTPUT + i);
//pin = (io_pin_e) ((int) SPARKOUT_1_OUTPUT + i);
}
stopPins();
}

View File

@ -45,7 +45,7 @@ private:
* 'spinning' means the engine is not stopped
*/
bool isSpinning;
bool stopPins();
};
#endif /* ENGINE_H_ */

View File

@ -89,7 +89,9 @@ typedef enum {
SUBARU_2003_WRX = 22,
ET_UNUSED = 23,
DODGE_NEON_2003 = 23,
ET_UNUSED = 24,
Force_4b_engine_type = ENUM_SIZE_HACK,
} engine_type_e;
@ -97,7 +99,7 @@ typedef enum {
typedef enum {
TT_TOOTHED_WHEEL = 0,
TT_FORD_ASPIRE = 1,
TT_DODGE_NEON = 2,
TT_DODGE_NEON_1995 = 2,
TT_MAZDA_MIATA_NA = 3,
TT_MAZDA_MIATA_NB = 4,
TT_GM_7X = 5,
@ -114,6 +116,8 @@ typedef enum {
TT_HONDA_ACCORD_CD_DIP = 13,
TT_DODGE_NEON_2003 = 14,
Force_4b_trigger_type = ENUM_SIZE_HACK,
} trigger_type_e;

View File

@ -59,8 +59,10 @@ void setPinValue(OutputPin * outputPin, int electricalValue, int logicValue) {
* @brief Sets the value according to current electrical settings
*/
void setOutputPinValue(io_pin_e pin, int logicValue) {
#if EFI_PROD_CODE
if (outputs[pin].port == GPIO_NULL)
return;
#endif
efiAssertVoid(pinDefaultState[pin]!=NULL, "pin mode not initialized");
pin_output_mode_e mode = *pinDefaultState[pin];
setPinValue(&outputs[pin], getElectricalValue(logicValue, mode), logicValue);

View File

@ -208,7 +208,7 @@ void initializeTriggerShape(Logging *logger, engine_configuration_s const *engin
initializeMazdaMiataNbShape(triggerShape);
return;
case TT_DODGE_NEON:
case TT_DODGE_NEON_1995:
configureNeonTriggerShape(triggerShape);
return;

View File

@ -54,7 +54,7 @@ uint32_t efiStrlen(const char *param) {
}
bool startsWith(const char *line, const char *prefix) {
int len = efiStrlen(prefix);
uint32_t len = efiStrlen(prefix);
if(efiStrlen(line) < len) {
return false;
}

View File

@ -13,8 +13,6 @@
static ActuatorEventList eventList;
static ActuatorEventList result;
int pinDefaultState[IO_PIN_COUNT];
extern int outputSignalCount;
void testEventRegistry(void) {