mirror of https://github.com/rusefi/rusefi-1.git
auto-sync
This commit is contained in:
parent
5f60c6ccfd
commit
5b04050748
|
@ -225,8 +225,6 @@ static const char *getGpioPinName(int index) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static OutputPin fsioOutputs[LE_COMMAND_COUNT];
|
||||
|
||||
static void handleFsio(Engine *engine, int index) {
|
||||
if (boardConfiguration->fsioPins[index] == GPIO_UNASSIGNED)
|
||||
return;
|
||||
|
@ -240,9 +238,9 @@ static void handleFsio(Engine *engine, int index) {
|
|||
fsioPwm[index].setSimplePwmDutyCycle(fvalue);
|
||||
} else {
|
||||
int value = (int) fvalue;
|
||||
if (value != fsioOutputs[index].getLogicValue()) {
|
||||
if (value != enginePins.fsioOutputs[index].getLogicValue()) {
|
||||
// scheduleMsg(logger, "setting %s %s", getIo_pin_e(pin), boolToString(value));
|
||||
fsioOutputs[index].setValue(value);
|
||||
enginePins.fsioOutputs[index].setValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -460,9 +458,9 @@ void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S) {
|
|||
if (brainPin != GPIO_UNASSIGNED) {
|
||||
int frequency = boardConfiguration->fsioFrequency[i];
|
||||
if (frequency == 0) {
|
||||
outputPinRegisterExt2(getGpioPinName(i), &fsioOutputs[i], boardConfiguration->fsioPins[i], &defa);
|
||||
outputPinRegisterExt2(getGpioPinName(i), &enginePins.fsioOutputs[i], boardConfiguration->fsioPins[i], &defa);
|
||||
} else {
|
||||
startSimplePwmExt(&fsioPwm[i], "FSIOpwm", brainPin, &fsioOutputs[i], frequency, 0.5f, applyPinState);
|
||||
startSimplePwmExt(&fsioPwm[i], "FSIOpwm", brainPin, &enginePins.fsioOutputs[i], frequency, 0.5f, applyPinState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,9 +47,7 @@ static THD_WORKING_AREA(etbTreadStack, UTILITY_THREAD_STACK_SIZE);
|
|||
* @brief Pulse-Width Modulation state
|
||||
*/
|
||||
static SimplePwm etbPwmUp CCM_OPTIONAL;
|
||||
static OutputPin output1 CCM_OPTIONAL;
|
||||
static SimplePwm etbPwmDown CCM_OPTIONAL;
|
||||
static OutputPin output2 CCM_OPTIONAL;
|
||||
|
||||
static OutputPin outputDirectionOpen CCM_OPTIONAL;
|
||||
static OutputPin outputDirectionClose CCM_OPTIONAL;
|
||||
|
@ -63,6 +61,8 @@ static float currentEtbDuty;
|
|||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
extern engine_pins_s enginePins;
|
||||
|
||||
static bool wasEtbBraking = false;
|
||||
|
||||
static msg_t etbThread(void *arg) {
|
||||
|
@ -156,13 +156,13 @@ void initElectronicThrottle(void) {
|
|||
// this line used for PWM
|
||||
startSimplePwmExt(&etbPwmUp, "etb1",
|
||||
boardConfiguration->etbControlPin1,
|
||||
&output1,
|
||||
&enginePins.etbOutput1,
|
||||
ETB_FREQ,
|
||||
0.80,
|
||||
applyPinState);
|
||||
startSimplePwmExt(&etbPwmDown, "etb2",
|
||||
boardConfiguration->etbControlPin2,
|
||||
&output2,
|
||||
&enginePins.etbOutput2,
|
||||
ETB_FREQ,
|
||||
0.80,
|
||||
applyPinState);
|
||||
|
|
|
@ -220,7 +220,7 @@ static msg_t benchThread(int param) {
|
|||
|
||||
extern engine_configuration_s activeConfiguration;
|
||||
|
||||
void unregister(brain_pin_e currentPin, OutputPin *output) {
|
||||
static void unregister(brain_pin_e currentPin, OutputPin *output) {
|
||||
if (currentPin == GPIO_UNASSIGNED)
|
||||
return;
|
||||
scheduleMsg(logger, "unregistering %s", hwPortname(currentPin));
|
||||
|
@ -228,23 +228,25 @@ void unregister(brain_pin_e currentPin, OutputPin *output) {
|
|||
output->unregister();
|
||||
}
|
||||
|
||||
void unregisterOutput(brain_pin_e oldPin, brain_pin_e newPin, OutputPin *output) {
|
||||
if (oldPin != newPin) {
|
||||
unregister(oldPin, output);
|
||||
}
|
||||
}
|
||||
|
||||
void stopIgnitionPins(void) {
|
||||
for (int i = 0; i < IGNITION_PIN_COUNT; i++) {
|
||||
NamedOutputPin *output = &enginePins.coils[i];
|
||||
brain_pin_e currentPin = activeConfiguration.bc.ignitionPins[i];
|
||||
if (engineConfiguration->bc.ignitionPins[i] != currentPin) {
|
||||
unregister(currentPin, output);
|
||||
}
|
||||
unregisterOutput(activeConfiguration.bc.ignitionPins[i],
|
||||
engineConfiguration->bc.ignitionPins[i], output);
|
||||
}
|
||||
}
|
||||
|
||||
void stopInjectionPins(void) {
|
||||
for (int i = 0; i < INJECTION_PIN_COUNT; i++) {
|
||||
NamedOutputPin *output = &enginePins.injectors[i];
|
||||
brain_pin_e currentPin = activeConfiguration.bc.injectionPins[i];
|
||||
if (engineConfiguration->bc.injectionPins[i] != currentPin) {
|
||||
unregister(currentPin, output);
|
||||
}
|
||||
unregisterOutput(activeConfiguration.bc.injectionPins[i],
|
||||
engineConfiguration->bc.injectionPins[i], output);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ void assertCylinderId(int cylinderId, const char *msg);
|
|||
|
||||
void stopInjectionPins(void);
|
||||
void startInjectionPins(void);
|
||||
void unregister(brain_pin_e currentPin, OutputPin *output);
|
||||
void unregisterOutput(brain_pin_e oldPin, brain_pin_e newPin, OutputPin *output);
|
||||
|
||||
void stopIgnitionPins(void);
|
||||
void startIgnitionPins(void);
|
||||
|
|
|
@ -69,6 +69,12 @@ public:
|
|||
OutputPin alternatorPin;
|
||||
OutputPin checkEnginePin;
|
||||
NamedOutputPin tachOut;
|
||||
OutputPin etbOutput1;
|
||||
OutputPin etbOutput2;
|
||||
OutputPin fsioOutputs[LE_COMMAND_COUNT];
|
||||
OutputPin triggerDecoderErrorPin;
|
||||
OutputPin hipCs;
|
||||
OutputPin sdCsPin;
|
||||
|
||||
|
||||
InjectorOutputPin injectors[INJECTION_PIN_COUNT];
|
||||
|
|
|
@ -46,10 +46,10 @@
|
|||
#include "sensor_chart.h"
|
||||
#endif
|
||||
|
||||
static OutputPin triggerDecoderErrorPin;
|
||||
|
||||
EXTERN_ENGINE
|
||||
;
|
||||
extern engine_pins_s enginePins;
|
||||
|
||||
static cyclic_buffer<int> errorDetection;
|
||||
static bool isInitializingTrigger = false; // #286 miata NA config - sync error on startup
|
||||
|
@ -258,7 +258,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
|||
|| currentCycle.eventCount[1] != TRIGGER_SHAPE(expectedEventCount[1])
|
||||
|| currentCycle.eventCount[2] != TRIGGER_SHAPE(expectedEventCount[2]);
|
||||
|
||||
triggerDecoderErrorPin.setValue(isDecodingError);
|
||||
enginePins.triggerDecoderErrorPin.setValue(isDecodingError);
|
||||
if (isDecodingError) {
|
||||
lastDecodingErrorTime = getTimeNowNt();
|
||||
someSortOfTriggerError = true;
|
||||
|
@ -659,7 +659,7 @@ void initTriggerDecoderLogger(Logging *sharedLogger) {
|
|||
|
||||
void initTriggerDecoder(void) {
|
||||
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
|
||||
outputPinRegisterExt2("trg_err", &triggerDecoderErrorPin, boardConfiguration->triggerErrorPin,
|
||||
outputPinRegisterExt2("trg_err", &enginePins.triggerDecoderErrorPin, boardConfiguration->triggerErrorPin,
|
||||
&boardConfiguration->triggerErrorPinMode);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -40,9 +40,9 @@
|
|||
#if EFI_HIP_9011 || defined(__DOXYGEN__)
|
||||
|
||||
static NamedOutputPin intHold(HIP_NAME);
|
||||
static OutputPin hipCs;
|
||||
|
||||
extern uint32_t lastExecutionCount;
|
||||
extern engine_pins_s enginePins;
|
||||
|
||||
uint32_t hipLastExecutionCount;
|
||||
|
||||
|
@ -388,11 +388,11 @@ static msg_t hipThread(void *arg) {
|
|||
chRegSetThreadName("hip9011 init");
|
||||
|
||||
// some time to let the hardware start
|
||||
hipCs.setValue(true);
|
||||
enginePins.hipCs.setValue(true);
|
||||
chThdSleepMilliseconds(100);
|
||||
hipCs.setValue(false);
|
||||
enginePins.hipCs.setValue(false);
|
||||
chThdSleepMilliseconds(100);
|
||||
hipCs.setValue(true);
|
||||
enginePins.hipCs.setValue(true);
|
||||
|
||||
while (true) {
|
||||
chThdSleepMilliseconds(100);
|
||||
|
@ -424,7 +424,7 @@ void initHip9011(Logging *sharedLogger) {
|
|||
|
||||
outputPinRegisterExt2("hip int/hold", &intHold, boardConfiguration->hip9011IntHoldPin,
|
||||
&boardConfiguration->hip9011IntHoldPinMode);
|
||||
outputPinRegisterExt2("hip CS", &hipCs, boardConfiguration->hip9011CsPin,
|
||||
outputPinRegisterExt2("hip CS", &enginePins.hipCs, boardConfiguration->hip9011CsPin,
|
||||
&boardConfiguration->hip9011CsPinMode);
|
||||
|
||||
scheduleMsg(logger, "Starting HIP9011/TPIC8101 driver");
|
||||
|
|
|
@ -59,7 +59,7 @@ static Mutex spiMtx;
|
|||
int maxNesting = 0;
|
||||
|
||||
#if HAL_USE_SPI || defined(__DOXYGEN__)
|
||||
static bool isSpiInitialized[5] = { false, false, false, false, false };
|
||||
extern bool isSpiInitialized[5];
|
||||
|
||||
// todo: use larger value if LSE is available, make this a boardConfiguration option
|
||||
int lseTimeout = 0;
|
||||
|
@ -238,12 +238,7 @@ void applyNewHardwareSettings(void) {
|
|||
stopSpi(SPI_DEVICE_3);
|
||||
|
||||
|
||||
{
|
||||
brain_pin_e currentPin = activeConfiguration.bc.fuelPumpPin;
|
||||
if (engineConfiguration->bc.fuelPumpPin != currentPin) {
|
||||
unregister(currentPin, &enginePins.fuelPumpRelay);
|
||||
}
|
||||
}
|
||||
|
||||
unregisterPin(engineConfiguration->bc.HD44780_rs, activeConfiguration.bc.HD44780_rs);
|
||||
unregisterPin(engineConfiguration->bc.HD44780_e, activeConfiguration.bc.HD44780_e);
|
||||
unregisterPin(engineConfiguration->bc.HD44780_db4, activeConfiguration.bc.HD44780_db4);
|
||||
|
@ -254,48 +249,36 @@ void applyNewHardwareSettings(void) {
|
|||
unregisterPin(engineConfiguration->bc.clutchUpPin, activeConfiguration.bc.clutchUpPin);
|
||||
|
||||
|
||||
{
|
||||
brain_pin_e currentPin = activeConfiguration.bc.fanPin;
|
||||
if (engineConfiguration->bc.fanPin != currentPin) {
|
||||
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) {
|
||||
unregister(currentPin, &enginePins.idleSolenoidPin);
|
||||
}
|
||||
}
|
||||
{
|
||||
brain_pin_e currentPin = activeConfiguration.bc.alternatorControlPin;
|
||||
if (engineConfiguration->bc.alternatorControlPin != currentPin) {
|
||||
unregister(currentPin, &enginePins.alternatorPin);
|
||||
}
|
||||
}
|
||||
{
|
||||
brain_pin_e currentPin = activeConfiguration.bc.mainRelayPin;
|
||||
if (engineConfiguration->bc.mainRelayPin != currentPin) {
|
||||
unregister(currentPin, &enginePins.mainRelay);
|
||||
}
|
||||
}
|
||||
unregisterOutput(activeConfiguration.bc.fuelPumpPin, engineConfiguration->bc.fuelPumpPin,
|
||||
&enginePins.fuelPumpRelay);
|
||||
unregisterOutput(activeConfiguration.bc.fanPin, engineConfiguration->bc.fanPin, &enginePins.fanRelay);
|
||||
unregisterOutput(activeConfiguration.bc.hip9011CsPin,
|
||||
engineConfiguration->bc.hip9011CsPin, &enginePins.hipCs);
|
||||
unregisterOutput(activeConfiguration.bc.triggerErrorPin,
|
||||
engineConfiguration->bc.triggerErrorPin, &enginePins.triggerDecoderErrorPin);
|
||||
unregisterOutput(activeConfiguration.bc.sdCardCsPin, engineConfiguration->bc.sdCardCsPin,
|
||||
&enginePins.sdCsPin);
|
||||
unregisterOutput(activeConfiguration.bc.etbDirectionPin1,
|
||||
engineConfiguration->bc.etbDirectionPin1, &enginePins.etbOutput1);
|
||||
unregisterOutput(activeConfiguration.bc.etbDirectionPin2,
|
||||
engineConfiguration->bc.etbDirectionPin2, &enginePins.etbOutput2);
|
||||
unregisterOutput(activeConfiguration.bc.malfunctionIndicatorPin,
|
||||
engineConfiguration->bc.malfunctionIndicatorPin, &enginePins.checkEnginePin);
|
||||
unregisterOutput(activeConfiguration.dizzySparkOutputPin,
|
||||
engineConfiguration->dizzySparkOutputPin, &enginePins.dizzyOutput);
|
||||
unregisterOutput(activeConfiguration.bc.tachOutputPin,
|
||||
engineConfiguration->bc.tachOutputPin, &enginePins.tachOut);
|
||||
unregisterOutput(activeConfiguration.bc.idle.solenoidPin,
|
||||
engineConfiguration->bc.idle.solenoidPin, &enginePins.idleSolenoidPin);
|
||||
|
||||
for (int i = 0;i < LE_COMMAND_COUNT;i++)
|
||||
unregisterOutput(activeConfiguration.bc.fsioPins[i],
|
||||
engineConfiguration->bc.fsioPins[i], &enginePins.fsioOutputs[i]);
|
||||
|
||||
unregisterOutput(activeConfiguration.bc.alternatorControlPin,
|
||||
engineConfiguration->bc.alternatorControlPin, &enginePins.alternatorPin);
|
||||
unregisterOutput(activeConfiguration.bc.mainRelayPin,
|
||||
engineConfiguration->bc.mainRelayPin, &enginePins.mainRelay);
|
||||
|
||||
startInjectionPins();
|
||||
startIgnitionPins();
|
||||
|
|
|
@ -25,7 +25,6 @@ extern board_configuration_s *boardConfiguration;
|
|||
|
||||
static LoggingWithStorage logger("io_pins");
|
||||
|
||||
static OutputPin sdCsPin;
|
||||
|
||||
extern engine_pins_s enginePins;
|
||||
|
||||
|
@ -119,7 +118,7 @@ void initOutputPins(void) {
|
|||
// outputPinRegister("spi CS3", SPI_CS_3, SPI_CS3_PORT, SPI_CS3_PIN);
|
||||
// outputPinRegister("spi CS4", SPI_CS_4, SPI_CS4_PORT, SPI_CS4_PIN);
|
||||
#if HAL_USE_SPI || defined(__DOXYGEN__)
|
||||
outputPinRegisterExt2("spi CS5", &sdCsPin, boardConfiguration->sdCardCsPin, &DEFAULT_OUTPUT);
|
||||
outputPinRegisterExt2("spi CS5", &enginePins.sdCsPin, boardConfiguration->sdCardCsPin, &DEFAULT_OUTPUT);
|
||||
#endif
|
||||
|
||||
// todo: should we move this code closer to the fuel pump logic?
|
||||
|
|
|
@ -204,7 +204,7 @@ void HardFaultVector(void) {
|
|||
}
|
||||
|
||||
#if HAL_USE_SPI || defined(__DOXYGEN__)
|
||||
static bool isSpiInitialized[5] = { false, false, false, false, false };
|
||||
bool isSpiInitialized[5] = { false, false, false, false, false };
|
||||
|
||||
static int getSpiAf(SPIDriver *driver) {
|
||||
#if STM32_SPI_USE_SPI1
|
||||
|
|
|
@ -293,5 +293,5 @@ int getRusEfiVersion(void) {
|
|||
return 123; // this is here to make the compiler happy about the unused array
|
||||
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
||||
return 3211; // this is here to make the compiler happy about the unused array
|
||||
return 20160911;
|
||||
return 20160914;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue