Saab CDM knock signal integration #647

This commit is contained in:
rusefi 2019-05-05 17:21:36 -04:00
parent 58f92ae30d
commit 5523caa536
5 changed files with 22 additions and 14 deletions

View File

@ -855,7 +855,9 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
} }
break; break;
case DBG_ION: case DBG_ION:
//ionPostState(tsOutputChannels); #if EFI_CDM_INTEGRATION
ionPostState(tsOutputChannels);
#endif /* EFI_CDM_INTEGRATION */
break; break;
default: default:
; ;

View File

@ -1,4 +1,4 @@
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun May 05 11:03:35 EDT 2019 // this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun May 05 17:20:47 EDT 2019
// begin // begin
#ifndef ENGINE_CONFIGURATION_GENERATED_H_ #ifndef ENGINE_CONFIGURATION_GENERATED_H_
#define ENGINE_CONFIGURATION_GENERATED_H_ #define ENGINE_CONFIGURATION_GENERATED_H_
@ -905,6 +905,7 @@ typedef struct {
brain_pin_e spi3sckPin; brain_pin_e spi3sckPin;
/** /**
* Saab Combustion Detection Module knock signal input pin * Saab Combustion Detection Module knock signal input pin
* also known as Saab Ion Sensing Module
* offset 337 * offset 337
*/ */
brain_pin_e cdmInputPin; brain_pin_e cdmInputPin;
@ -1314,7 +1315,7 @@ typedef struct {
*/ */
int HD44780height; int HD44780height;
/** /**
* First TPS, first channel. See aslo pedalPositionAdcChannel * First TPS, single channel so far. See aslo pedalPositionAdcChannel
* offset 512 * offset 512
*/ */
adc_channel_e tps1_1AdcChannel; adc_channel_e tps1_1AdcChannel;
@ -1327,7 +1328,7 @@ typedef struct {
*/ */
adc_channel_e fuelLevelSensor; adc_channel_e fuelLevelSensor;
/** /**
* Second throttle body position sensor * Second throttle body position sensor, single channel so far
* offset 515 * offset 515
*/ */
adc_channel_e tps2_1AdcChannel; adc_channel_e tps2_1AdcChannel;
@ -2728,4 +2729,4 @@ typedef struct {
#endif #endif
// end // end
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun May 05 11:03:35 EDT 2019 // this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun May 05 17:20:47 EDT 2019

View File

@ -1,6 +1,8 @@
/* /*
* @file cdm_ion_sense.cpp * @file cdm_ion_sense.cpp
* *
* Saab Ion Sensing Module integration
*
* See https://github.com/rusefi/rusefi_documentation/tree/master/misc/Saab_Trionic_8_Combustion%20Detection%20Module_on_Mazda_Miata_running_rusEfi * See https://github.com/rusefi/rusefi_documentation/tree/master/misc/Saab_Trionic_8_Combustion%20Detection%20Module_on_Mazda_Miata_running_rusEfi
* *
* Created on: Dec 31, 2018 * Created on: Dec 31, 2018
@ -30,24 +32,26 @@ void CdmState::onNewSignal(int currentRevolution) {
} }
} }
// above logic compiles unconditionally so that unit tests are happy, but without an instance linker would have nothing to link
#if EFI_CDM_INTEGRATION #if EFI_CDM_INTEGRATION
#include "digital_input_exti.h" #include "digital_input_exti.h"
EXTERN_ENGINE; EXTERN_ENGINE;
static CdmState instance;
#if EFI_TUNER_STUDIO #if EFI_TUNER_STUDIO
void ionPostState(TunerStudioOutputChannels *tsOutputChannels) { void ionPostState(TunerStudioOutputChannels *tsOutputChannels) {
tsOutputChannels->debugIntField1 = instance.totalCdmEvents;
} }
#endif #endif /* EFI_TUNER_STUDIO */
static CdmState instance;
static void extIonCallback(void *arg) { static void extIonCallback(void *arg) {
UNUSED(arg); UNUSED(arg);
instance.totalCdmEvents++;
int currentRevolution = engine->triggerCentral.triggerState.getTotalRevolutionCounter(); int currentRevolution = engine->triggerCentral.triggerState.getTotalRevolutionCounter();
instance.onNewSignal(currentRevolution); instance.onNewSignal(currentRevolution);
} }

View File

@ -18,6 +18,7 @@ public:
* accumulated value for engine cycle which is not over yet * accumulated value for engine cycle which is not over yet
*/ */
int accumulator; int accumulator;
int totalCdmEvents = 0;
/** /**
* event counter for previous complete engine cycle * event counter for previous complete engine cycle
*/ */

View File

@ -300,8 +300,8 @@ bit issue_294_28;
bit issue_294_29; bit issue_294_29;
int16_t tpsMin;Closed throttle. todo: extract these two fields into a structure\ntodo: we need two sets of TPS parameters - modern ETBs have two sensors\nSee also tpsAdcChannel\nset tps_min X;"ADC", 1, 0, 0, 1023, 0 int16_t tpsMin;Closed throttle. todo: extract these two fields into a structure\ntodo: we need two sets of TPS parameters - modern ETBs have two sensors\nSee also tps1_1AdcChannel\nset tps_min X;"ADC", 1, 0, 0, 1023, 0
int16_t tpsMax;Full throtle. tpsMax value as 10 bit ADC value. Not Voltage!\nSee also tpsAdcChannel\nset tps_max X;"ADC", 1, 0, 0, 1023, 0 int16_t tpsMax;Full throtle. tpsMax value as 10 bit ADC value. Not Voltage!\nSee also tps1_1AdcChannel\nset tps_max X;"ADC", 1, 0, 0, 1023, 0
int16_t tpsErrorDetectionTooLow;+TPS error detection, what TPS % value is unrealistically low;"%", 1, 0, -40, 200, 0 int16_t tpsErrorDetectionTooLow;+TPS error detection, what TPS % value is unrealistically low;"%", 1, 0, -40, 200, 0
int16_t tpsErrorDetectionTooHigh;+TPS error detection, what TPS % value is unrealistically high;"%", 1, 0, -40, 200, 0 int16_t tpsErrorDetectionTooHigh;+TPS error detection, what TPS % value is unrealistically high;"%", 1, 0, -40, 200, 0
@ -454,7 +454,7 @@ end_struct
afr_sensor_s afr afr_sensor_s afr
adc_channel_e throttlePedalPositionAdcChannel;Electronic throttle pedal position input\nSingle channel so far\nSee also tpsAdcChannel adc_channel_e throttlePedalPositionAdcChannel;Electronic throttle pedal position input\nSingle channel so far\nSee also tps1_1AdcChannel
brain_pin_e tle6240_cs; brain_pin_e tle6240_cs;
pin_output_mode_e tle6240_csPinMode; pin_output_mode_e tle6240_csPinMode;
@ -657,7 +657,7 @@ custom fsio_setting_t 4 scalar, F32, @OFFSET@, "Val", 1, 0, 0,
brain_pin_e spi3misoPin; brain_pin_e spi3misoPin;
brain_pin_e spi3sckPin; brain_pin_e spi3sckPin;
brain_pin_e cdmInputPin;Saab Combustion Detection Module knock signal input pin brain_pin_e cdmInputPin;Saab Combustion Detection Module knock signal input pin\nalso known as Saab Ion Sensing Module
brain_pin_e joystickCenterPin; brain_pin_e joystickCenterPin;
brain_pin_e joystickAPin; brain_pin_e joystickAPin;