auto-sync

This commit is contained in:
rusEfi 2014-11-15 08:03:49 -06:00
parent 671c895070
commit 18aaa5110e
7 changed files with 25 additions and 11 deletions

View File

@ -95,6 +95,8 @@ case O2_HEATER:
return "O2_HEATER"; return "O2_HEATER";
case LED_RUNNING: case LED_RUNNING:
return "LED_RUNNING"; return "LED_RUNNING";
case LED_TRIGGER_ERROR:
return "LED_TRIGGER_ERROR";
case TRIGGER_EMULATOR_3RD: case TRIGGER_EMULATOR_3RD:
return "TRIGGER_EMULATOR_3RD"; return "TRIGGER_EMULATOR_3RD";
case INJECTOR_10_OUTPUT: case INJECTOR_10_OUTPUT:

View File

@ -322,6 +322,8 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_
*/ */
boardConfiguration->triggerSimulatorFrequency = 1200; boardConfiguration->triggerSimulatorFrequency = 1200;
boardConfiguration->triggerErrorPin = GPIO_UNASSIGNED;
boardConfiguration->max31855spiDevice = SPI_NONE; boardConfiguration->max31855spiDevice = SPI_NONE;
for (int i = 0; i < MAX31855_CS_COUNT; i++) { for (int i = 0; i < MAX31855_CS_COUNT; i++) {
boardConfiguration->max31855_cs[i] = GPIO_UNASSIGNED; boardConfiguration->max31855_cs[i] = GPIO_UNASSIGNED;

View File

@ -223,7 +223,13 @@ typedef struct {
brain_pin_e joystickPins[JOYSTICK_PIN_COUNT]; brain_pin_e joystickPins[JOYSTICK_PIN_COUNT];
int unusedbs[54]; /**
* This pin is used for debugging - snap a logic analyzer on it and see if it's ever high
*/
brain_pin_e triggerErrorPin;
pin_output_mode_e triggerErrorPinMode;
int unusedbs[52];
le_formula_t le_formulas[LE_COMMAND_COUNT]; le_formula_t le_formulas[LE_COMMAND_COUNT];

View File

@ -27,6 +27,8 @@ typedef enum {
LED_DEBUG, LED_DEBUG,
LED_EMULATOR, LED_EMULATOR,
LED_TRIGGER_ERROR,
/** /**
* see board_configuration_s->idleValvePin * see board_configuration_s->idleValvePin
*/ */

View File

@ -29,6 +29,7 @@
#include "trigger_mitsubishi.h" #include "trigger_mitsubishi.h"
#include "trigger_structure.h" #include "trigger_structure.h"
#include "efiGpio.h"
// todo: better name for this constant // todo: better name for this constant
#define HELPER_PERIOD 100000 #define HELPER_PERIOD 100000
@ -126,7 +127,7 @@ void TriggerState::decodeTriggerEvent(trigger_shape_s const*triggerShape, trigge
return; return;
} }
int64_t currentDuration = getCurrentGapDuration(nowNt); currentDuration = getCurrentGapDuration(nowNt);
isFirstEvent = false; isFirstEvent = false;
efiAssertVoid(currentDuration >= 0, "decode: negative duration?"); efiAssertVoid(currentDuration >= 0, "decode: negative duration?");
@ -150,6 +151,7 @@ void TriggerState::decodeTriggerEvent(trigger_shape_s const*triggerShape, trigge
|| eventCount[1] != triggerShape->expectedEventCount[1] || eventCount[1] != triggerShape->expectedEventCount[1]
|| eventCount[2] != triggerShape->expectedEventCount[2]; || eventCount[2] != triggerShape->expectedEventCount[2];
setOutputPinValue(LED_TRIGGER_ERROR, isDecodingError);
if (isDecodingError) { if (isDecodingError) {
totalTriggerErrorCounter++; totalTriggerErrorCounter++;
} }

View File

@ -36,6 +36,10 @@ public:
bool shaft_is_synchronized; bool shaft_is_synchronized;
uint64_t toothed_previous_duration; uint64_t toothed_previous_duration;
/**
* this could be a local variable, but it's better for debugging to have it as a field
*/
int64_t currentDuration;
uint64_t toothed_previous_time; uint64_t toothed_previous_time;
/** /**

View File

@ -141,8 +141,7 @@ void initOutputPins(void) {
// outputPinRegister("ext led 2", LED_EXT_2, EXTRA_LED_2_PORT, EXTRA_LED_2_PIN); // outputPinRegister("ext led 2", LED_EXT_2, EXTRA_LED_2_PORT, EXTRA_LED_2_PIN);
// outputPinRegister("ext led 3", LED_EXT_3, EXTRA_LED_2_PORT, EXTRA_LED_3_PIN); // outputPinRegister("ext led 3", LED_EXT_3, EXTRA_LED_2_PORT, EXTRA_LED_3_PIN);
// outputPinRegister("alive1", LED_DEBUG, GPIOD, 6); // outputPinRegister("alive1", LED_DEBUG, GPIOD, 6);
outputPinRegister("MalfunctionIndicator", LED_CHECK_ENGINE, getHwPort(boardConfiguration->malfunctionIndicatorPin), outputPinRegisterExt2("MalfunctionIndicator", LED_CHECK_ENGINE, boardConfiguration->malfunctionIndicatorPin, &DEFAULT_OUTPUT);
getHwPin(boardConfiguration->malfunctionIndicatorPin));
// todo: are these needed here? todo: make configurable // todo: are these needed here? todo: make configurable
// outputPinRegister("spi CS1", SPI_CS_1, SPI_CS1_PORT, SPI_CS1_PIN); // outputPinRegister("spi CS1", SPI_CS_1, SPI_CS1_PORT, SPI_CS1_PIN);
@ -152,14 +151,11 @@ void initOutputPins(void) {
outputPinRegister("spi CS5", SPI_CS_SD_MODULE, SPI_SD_MODULE_PORT, SPI_SD_MODULE_PIN); outputPinRegister("spi CS5", SPI_CS_SD_MODULE, SPI_SD_MODULE_PORT, SPI_SD_MODULE_PIN);
// todo: should we move this code closer to the fuel pump logic? // todo: should we move this code closer to the fuel pump logic?
outputPinRegister("fuel pump relay", FUEL_PUMP_RELAY, getHwPort(boardConfiguration->fuelPumpPin), outputPinRegisterExt2("fuel pump relay", FUEL_PUMP_RELAY, boardConfiguration->fuelPumpPin, &DEFAULT_OUTPUT);
getHwPin(boardConfiguration->fuelPumpPin));
outputPinRegister("fan relay", FAN_RELAY, getHwPort(boardConfiguration->fanPin), outputPinRegisterExt2("fan relay", FAN_RELAY, boardConfiguration->fanPin, &DEFAULT_OUTPUT);
getHwPin(boardConfiguration->fanPin)); outputPinRegisterExt2("o2 heater", O2_HEATER, boardConfiguration->o2heaterPin, &DEFAULT_OUTPUT);
outputPinRegisterExt2("trg_err", LED_TRIGGER_ERROR, boardConfiguration->triggerErrorPin, &boardConfiguration->triggerErrorPinMode);
outputPinRegister("o2 heater", O2_HEATER, getHwPort(boardConfiguration->o2heaterPin),
getHwPin(boardConfiguration->o2heaterPin));
initialLedsBlink(); initialLedsBlink();