auto-sync
This commit is contained in:
parent
e747b729d2
commit
600a450838
|
@ -519,12 +519,11 @@ static THD_WORKING_AREA(lcdThreadStack, UTILITY_THREAD_STACK_SIZE);
|
||||||
static THD_WORKING_AREA(blinkingStack, 128);
|
static THD_WORKING_AREA(blinkingStack, 128);
|
||||||
|
|
||||||
static OutputPin communicationPin;
|
static OutputPin communicationPin;
|
||||||
OutputPin checkEnginePin;
|
|
||||||
OutputPin warningPin;
|
OutputPin warningPin;
|
||||||
OutputPin runningPin;
|
OutputPin runningPin;
|
||||||
extern engine_pins_s enginePins;
|
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;
|
extern pin_output_mode_e DEFAULT_OUTPUT;
|
||||||
|
|
||||||
|
|
|
@ -156,10 +156,8 @@ void fanBench(void) {
|
||||||
pinbench("0", "3000", "100", "1", &enginePins.fanRelay, boardConfiguration->fanPin);
|
pinbench("0", "3000", "100", "1", &enginePins.fanRelay, boardConfiguration->fanPin);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern OutputPin checkEnginePin;
|
|
||||||
|
|
||||||
void milBench(void) {
|
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) {
|
void fuelPumpBenchExt(const char *durationMs) {
|
||||||
|
|
|
@ -38,15 +38,15 @@
|
||||||
#define MFI_BLINK_SEPARATOR 400
|
#define MFI_BLINK_SEPARATOR 400
|
||||||
#define MFI_CHECKENGINE_LIGHT 10000
|
#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) {
|
static void blink_digits(int digit, int duration) {
|
||||||
for (int iter = 0; iter < digit; iter++) {
|
for (int iter = 0; iter < digit; iter++) {
|
||||||
checkEnginePin.setValue(0);
|
enginePins.checkEnginePin.setValue(0);
|
||||||
chThdSleepMilliseconds(duration);
|
chThdSleepMilliseconds(duration);
|
||||||
checkEnginePin.setValue(1);
|
enginePins.checkEnginePin.setValue(1);
|
||||||
chThdSleepMilliseconds(MFI_BLINK_SEPARATOR);
|
chThdSleepMilliseconds(MFI_BLINK_SEPARATOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ InjectorOutputPin::InjectorOutputPin() : NamedOutputPin() {
|
||||||
|
|
||||||
engine_pins_s::engine_pins_s() {
|
engine_pins_s::engine_pins_s() {
|
||||||
dizzyOutput.name = DIZZY_NAME;
|
dizzyOutput.name = DIZZY_NAME;
|
||||||
|
tachOut.name = TACH_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InjectorOutputPin::reset() {
|
void InjectorOutputPin::reset() {
|
||||||
|
|
|
@ -67,6 +67,8 @@ public:
|
||||||
OutputPin errorLedPin;
|
OutputPin errorLedPin;
|
||||||
OutputPin idleSolenoidPin;
|
OutputPin idleSolenoidPin;
|
||||||
OutputPin alternatorPin;
|
OutputPin alternatorPin;
|
||||||
|
OutputPin checkEnginePin;
|
||||||
|
NamedOutputPin tachOut;
|
||||||
|
|
||||||
|
|
||||||
InjectorOutputPin injectors[INJECTION_PIN_COUNT];
|
InjectorOutputPin injectors[INJECTION_PIN_COUNT];
|
||||||
|
|
|
@ -15,11 +15,11 @@
|
||||||
|
|
||||||
EXTERN_ENGINE;
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
static NamedOutputPin tachOut(TACH_NAME);
|
|
||||||
static scheduling_s tachTurnSignalOff;
|
static scheduling_s tachTurnSignalOff;
|
||||||
|
extern engine_pins_s enginePins;
|
||||||
|
|
||||||
static void turnTachPinLow(void) {
|
static void turnTachPinLow(void) {
|
||||||
turnPinLow(&tachOut);
|
turnPinLow(&enginePins.tachOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tachSignalCallback(trigger_event_e ckpSignalType,
|
static void tachSignalCallback(trigger_event_e ckpSignalType,
|
||||||
|
@ -27,7 +27,7 @@ static void tachSignalCallback(trigger_event_e ckpSignalType,
|
||||||
if (index != engineConfiguration->tachPulseTriggerIndex) {
|
if (index != engineConfiguration->tachPulseTriggerIndex) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
turnPinHigh(&tachOut);
|
turnPinHigh(&enginePins.tachOut);
|
||||||
scheduleTask("tach off", &tachTurnSignalOff, (int)MS2US(engineConfiguration->tachPulseDuractionMs), (schfunc_t) &turnTachPinLow, NULL);
|
scheduleTask("tach off", &tachTurnSignalOff, (int)MS2US(engineConfiguration->tachPulseDuractionMs), (schfunc_t) &turnTachPinLow, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ void initTachometer(void) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
outputPinRegisterExt2("analog tach output", &tachOut, boardConfiguration->tachOutputPin, &boardConfiguration->tachOutputPinMode);
|
outputPinRegisterExt2("analog tach output", &enginePins.tachOut, boardConfiguration->tachOutputPin, &boardConfiguration->tachOutputPinMode);
|
||||||
|
|
||||||
addTriggerEventListener(tachSignalCallback, "tach", engine);
|
addTriggerEventListener(tachSignalCallback, "tach", engine);
|
||||||
|
|
||||||
|
|
|
@ -257,6 +257,24 @@ void applyNewHardwareSettings(void) {
|
||||||
unregister(currentPin, &enginePins.fanRelay);
|
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;
|
brain_pin_e currentPin = activeConfiguration.bc.idle.solenoidPin;
|
||||||
if (engineConfiguration->bc.idle.solenoidPin != currentPin) {
|
if (engineConfiguration->bc.idle.solenoidPin != currentPin) {
|
||||||
|
|
|
@ -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 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);
|
||||||
outputPinRegisterExt2("MalfunctionIndicator", &checkEnginePin, boardConfiguration->malfunctionIndicatorPin, &DEFAULT_OUTPUT);
|
outputPinRegisterExt2("MalfunctionIndicator", &enginePins.checkEnginePin, boardConfiguration->malfunctionIndicatorPin, &DEFAULT_OUTPUT);
|
||||||
|
|
||||||
// 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);
|
||||||
|
|
|
@ -225,6 +225,9 @@ void mySetPadMode(const char *msg, ioportid_t port, ioportmask_t pin, iomode_t m
|
||||||
}
|
}
|
||||||
|
|
||||||
void unmarkPin(brain_pin_e brainPin) {
|
void unmarkPin(brain_pin_e brainPin) {
|
||||||
|
if (brainPin == GPIO_UNASSIGNED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
ioportid_t port = getHwPort(brainPin);
|
ioportid_t port = getHwPort(brainPin);
|
||||||
ioportmask_t pin = getHwPin(brainPin);
|
ioportmask_t pin = getHwPin(brainPin);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue