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 (engineConfiguration->hasFrequencyReportingMapSensor) {
|
||||
digital_input_s* digitalMapInput = initWaveAnalyzerDriver("map freq", boardConfiguration->frequencyReportingMapInputPin);
|
||||
digital_input_s* digitalMapInput = addWaveAnalyzerDriver("map freq", boardConfiguration->frequencyReportingMapInputPin);
|
||||
startInputDriver(digitalMapInput, true);
|
||||
|
||||
digitalMapInput->widthListeners.registerCallback((VoidInt) digitalMapWidthCallback, NULL);
|
||||
|
|
|
@ -123,7 +123,7 @@ static void initWave(const char *name, int index) {
|
|||
WaveReader *reader = &readers[index];
|
||||
reader->name = name;
|
||||
|
||||
reader->hw = initWaveAnalyzerDriver("wave input", brainPin);
|
||||
reader->hw = addWaveAnalyzerDriver("wave input", brainPin);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
digital_input_s *hw = registeredIcus.add();
|
||||
|
@ -196,7 +199,10 @@ digital_input_s * initWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin)
|
|||
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) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -24,11 +24,13 @@ typedef struct {
|
|||
} digital_input_s;
|
||||
|
||||
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 removeWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin);
|
||||
|
||||
ICUDriver * getInputCaptureDriver(const char *msg, brain_pin_e hwPin);
|
||||
icuchannel_t getInputCaptureChannel(brain_pin_e hwPin);
|
||||
void stopWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -67,22 +67,21 @@ bool hasVehicleSpeedSensor() {
|
|||
}
|
||||
|
||||
void stopVSSPins(void) {
|
||||
stopWaveAnalyzerDriver("VSS", activeConfiguration.bc.vehicleSpeedSensorInputPin);
|
||||
removeWaveAnalyzerDriver("VSS", activeConfiguration.bc.vehicleSpeedSensorInputPin);
|
||||
}
|
||||
|
||||
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) {
|
||||
logger = l;
|
||||
addConsoleAction("speedinfo", speedInfo);
|
||||
if (!hasVehicleSpeedSensor())
|
||||
return;
|
||||
digital_input_s* vehicleSpeedInput = initWaveAnalyzerDriver("VSS", boardConfiguration->vehicleSpeedSensorInputPin);
|
||||
startInputDriver(vehicleSpeedInput, true);
|
||||
|
||||
vehicleSpeedInput->widthListeners.registerCallback((VoidInt) vsAnaWidthCallback, NULL);
|
||||
startVSSPins();
|
||||
}
|
||||
#else /* EFI_VEHICLE_SPEED */
|
||||
|
||||
|
|
Loading…
Reference in New Issue