Fix VSS init/deinit
This commit is contained in:
parent
58098da13d
commit
1c08f2ea8a
|
@ -238,7 +238,7 @@ void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
if (engineConfiguration->hasFrequencyReportingMapSensor) {
|
if (engineConfiguration->hasFrequencyReportingMapSensor) {
|
||||||
digital_input_s* digitalMapInput = initWaveAnalyzerDriver("map freq", boardConfiguration->frequencyReportingMapInputPin);
|
digital_input_s* digitalMapInput = addWaveAnalyzerDriver("map freq", boardConfiguration->frequencyReportingMapInputPin);
|
||||||
startInputDriver(digitalMapInput, true);
|
startInputDriver(digitalMapInput, true);
|
||||||
|
|
||||||
digitalMapInput->widthListeners.registerCallback((VoidInt) digitalMapWidthCallback, NULL);
|
digitalMapInput->widthListeners.registerCallback((VoidInt) digitalMapWidthCallback, NULL);
|
||||||
|
|
|
@ -123,7 +123,7 @@ static void initWave(const char *name, int index) {
|
||||||
WaveReader *reader = &readers[index];
|
WaveReader *reader = &readers[index];
|
||||||
reader->name = name;
|
reader->name = name;
|
||||||
|
|
||||||
reader->hw = initWaveAnalyzerDriver("wave input", brainPin);
|
reader->hw = addWaveAnalyzerDriver("wave input", brainPin);
|
||||||
|
|
||||||
|
|
||||||
reader->hw->widthListeners.registerCallback((VoidInt) waAnaWidthCallback, (void*) reader);
|
reader->hw->widthListeners.registerCallback((VoidInt) waAnaWidthCallback, (void*) reader);
|
||||||
|
|
|
@ -183,7 +183,10 @@ void turnOnCapturePin(const char *msg, brain_pin_e brainPin) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
digital_input_s * initWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin) {
|
/**
|
||||||
|
* takes next digital_input_s from the registeredIcus pool
|
||||||
|
*/
|
||||||
|
digital_input_s * addWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin) {
|
||||||
ICUDriver *driver = getInputCaptureDriver(msg, brainPin);
|
ICUDriver *driver = getInputCaptureDriver(msg, brainPin);
|
||||||
|
|
||||||
digital_input_s *hw = registeredIcus.add();
|
digital_input_s *hw = registeredIcus.add();
|
||||||
|
@ -196,7 +199,10 @@ digital_input_s * initWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin)
|
||||||
return hw;
|
return hw;
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin) {
|
/**
|
||||||
|
* turns pin off and returns digital_input_s back into registeredIcus pool
|
||||||
|
*/
|
||||||
|
void removeWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin) {
|
||||||
if (brainPin == GPIO_UNASSIGNED) {
|
if (brainPin == GPIO_UNASSIGNED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,13 @@ typedef struct {
|
||||||
} digital_input_s;
|
} digital_input_s;
|
||||||
|
|
||||||
void turnOnCapturePin(const char *msg, brain_pin_e brainPin);
|
void turnOnCapturePin(const char *msg, brain_pin_e brainPin);
|
||||||
digital_input_s *initWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin);
|
|
||||||
|
digital_input_s *addWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin);
|
||||||
void startInputDriver(digital_input_s *hw, bool isActiveHigh);
|
void startInputDriver(digital_input_s *hw, bool isActiveHigh);
|
||||||
|
void removeWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin);
|
||||||
|
|
||||||
ICUDriver * getInputCaptureDriver(const char *msg, brain_pin_e hwPin);
|
ICUDriver * getInputCaptureDriver(const char *msg, brain_pin_e hwPin);
|
||||||
icuchannel_t getInputCaptureChannel(brain_pin_e hwPin);
|
icuchannel_t getInputCaptureChannel(brain_pin_e hwPin);
|
||||||
void stopWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -67,22 +67,21 @@ bool hasVehicleSpeedSensor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopVSSPins(void) {
|
void stopVSSPins(void) {
|
||||||
stopWaveAnalyzerDriver("VSS", activeConfiguration.bc.vehicleSpeedSensorInputPin);
|
removeWaveAnalyzerDriver("VSS", activeConfiguration.bc.vehicleSpeedSensorInputPin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void startVSSPins(void) {
|
void startVSSPins(void) {
|
||||||
// todo
|
if (!hasVehicleSpeedSensor())
|
||||||
|
return;
|
||||||
|
digital_input_s* vehicleSpeedInput = addWaveAnalyzerDriver("VSS", boardConfiguration->vehicleSpeedSensorInputPin);
|
||||||
|
startInputDriver(vehicleSpeedInput, true);
|
||||||
|
vehicleSpeedInput->widthListeners.registerCallback((VoidInt) vsAnaWidthCallback, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initVehicleSpeed(Logging *l) {
|
void initVehicleSpeed(Logging *l) {
|
||||||
logger = l;
|
logger = l;
|
||||||
addConsoleAction("speedinfo", speedInfo);
|
addConsoleAction("speedinfo", speedInfo);
|
||||||
if (!hasVehicleSpeedSensor())
|
startVSSPins();
|
||||||
return;
|
|
||||||
digital_input_s* vehicleSpeedInput = initWaveAnalyzerDriver("VSS", boardConfiguration->vehicleSpeedSensorInputPin);
|
|
||||||
startInputDriver(vehicleSpeedInput, true);
|
|
||||||
|
|
||||||
vehicleSpeedInput->widthListeners.registerCallback((VoidInt) vsAnaWidthCallback, NULL);
|
|
||||||
}
|
}
|
||||||
#else /* EFI_VEHICLE_SPEED */
|
#else /* EFI_VEHICLE_SPEED */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue