auto-sync

This commit is contained in:
rusEfi 2016-09-14 01:01:57 -04:00
parent e747b729d2
commit 600a450838
9 changed files with 35 additions and 14 deletions

View File

@ -519,12 +519,11 @@ static THD_WORKING_AREA(lcdThreadStack, UTILITY_THREAD_STACK_SIZE);
static THD_WORKING_AREA(blinkingStack, 128);
static OutputPin communicationPin;
OutputPin checkEnginePin;
OutputPin warningPin;
OutputPin runningPin;
extern engine_pins_s enginePins;
static OutputPin *leds[] = { &warningPin, &runningPin, &enginePins.errorLedPin, &communicationPin, &checkEnginePin };
static OutputPin *leds[] = { &warningPin, &runningPin, &enginePins.errorLedPin, &communicationPin, &enginePins.checkEnginePin };
extern pin_output_mode_e DEFAULT_OUTPUT;

View File

@ -156,10 +156,8 @@ void fanBench(void) {
pinbench("0", "3000", "100", "1", &enginePins.fanRelay, boardConfiguration->fanPin);
}
extern OutputPin checkEnginePin;
void milBench(void) {
pinbench("0", "3000", "100", "1", &checkEnginePin, boardConfiguration->malfunctionIndicatorPin);
pinbench("0", "3000", "100", "1", &enginePins.checkEnginePin, boardConfiguration->malfunctionIndicatorPin);
}
void fuelPumpBenchExt(const char *durationMs) {

View File

@ -38,15 +38,15 @@
#define MFI_BLINK_SEPARATOR 400
#define MFI_CHECKENGINE_LIGHT 10000
static THD_WORKING_AREA(mfiThreadStack, UTILITY_THREAD_STACK_SIZE); // declare thread
extern engine_pins_s enginePins;
extern OutputPin checkEnginePin;
static THD_WORKING_AREA(mfiThreadStack, UTILITY_THREAD_STACK_SIZE); // declare thread
static void blink_digits(int digit, int duration) {
for (int iter = 0; iter < digit; iter++) {
checkEnginePin.setValue(0);
enginePins.checkEnginePin.setValue(0);
chThdSleepMilliseconds(duration);
checkEnginePin.setValue(1);
enginePins.checkEnginePin.setValue(1);
chThdSleepMilliseconds(MFI_BLINK_SEPARATOR);
}
}

View File

@ -32,6 +32,7 @@ InjectorOutputPin::InjectorOutputPin() : NamedOutputPin() {
engine_pins_s::engine_pins_s() {
dizzyOutput.name = DIZZY_NAME;
tachOut.name = TACH_NAME;
}
void InjectorOutputPin::reset() {

View File

@ -67,6 +67,8 @@ public:
OutputPin errorLedPin;
OutputPin idleSolenoidPin;
OutputPin alternatorPin;
OutputPin checkEnginePin;
NamedOutputPin tachOut;
InjectorOutputPin injectors[INJECTION_PIN_COUNT];

View File

@ -15,11 +15,11 @@
EXTERN_ENGINE;
static NamedOutputPin tachOut(TACH_NAME);
static scheduling_s tachTurnSignalOff;
extern engine_pins_s enginePins;
static void turnTachPinLow(void) {
turnPinLow(&tachOut);
turnPinLow(&enginePins.tachOut);
}
static void tachSignalCallback(trigger_event_e ckpSignalType,
@ -27,7 +27,7 @@ static void tachSignalCallback(trigger_event_e ckpSignalType,
if (index != engineConfiguration->tachPulseTriggerIndex) {
return;
}
turnPinHigh(&tachOut);
turnPinHigh(&enginePins.tachOut);
scheduleTask("tach off", &tachTurnSignalOff, (int)MS2US(engineConfiguration->tachPulseDuractionMs), (schfunc_t) &turnTachPinLow, NULL);
}
@ -36,7 +36,7 @@ void initTachometer(void) {
return;
}
outputPinRegisterExt2("analog tach output", &tachOut, boardConfiguration->tachOutputPin, &boardConfiguration->tachOutputPinMode);
outputPinRegisterExt2("analog tach output", &enginePins.tachOut, boardConfiguration->tachOutputPin, &boardConfiguration->tachOutputPinMode);
addTriggerEventListener(tachSignalCallback, "tach", engine);

View File

@ -257,6 +257,24 @@ void applyNewHardwareSettings(void) {
unregister(currentPin, &enginePins.fanRelay);
}
}
{
brain_pin_e currentPin = activeConfiguration.bc.malfunctionIndicatorPin;
if (engineConfiguration->bc.malfunctionIndicatorPin != currentPin) {
unregister(currentPin, &enginePins.checkEnginePin);
}
}
{
brain_pin_e currentPin = activeConfiguration.dizzySparkOutputPin;
if (engineConfiguration->dizzySparkOutputPin != currentPin) {
unregister(currentPin, &enginePins.dizzyOutput);
}
}
{
brain_pin_e currentPin = activeConfiguration.bc.tachOutputPin;
if (engineConfiguration->bc.tachOutputPin != currentPin) {
unregister(currentPin, &enginePins.tachOut);
}
}
{
brain_pin_e currentPin = activeConfiguration.bc.idle.solenoidPin;
if (engineConfiguration->bc.idle.solenoidPin != currentPin) {

View File

@ -111,7 +111,7 @@ void initOutputPins(void) {
// 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("alive1", LED_DEBUG, GPIOD, 6);
outputPinRegisterExt2("MalfunctionIndicator", &checkEnginePin, boardConfiguration->malfunctionIndicatorPin, &DEFAULT_OUTPUT);
outputPinRegisterExt2("MalfunctionIndicator", &enginePins.checkEnginePin, boardConfiguration->malfunctionIndicatorPin, &DEFAULT_OUTPUT);
// todo: are these needed here? todo: make configurable
// outputPinRegister("spi CS1", SPI_CS_1, SPI_CS1_PORT, SPI_CS1_PIN);

View File

@ -225,6 +225,9 @@ void mySetPadMode(const char *msg, ioportid_t port, ioportmask_t pin, iomode_t m
}
void unmarkPin(brain_pin_e brainPin) {
if (brainPin == GPIO_UNASSIGNED) {
return;
}
ioportid_t port = getHwPort(brainPin);
ioportmask_t pin = getHwPin(brainPin);