diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index f0c920fdcb..0b707dab45 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -855,7 +855,9 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ } break; case DBG_ION: - //ionPostState(tsOutputChannels); +#if EFI_CDM_INTEGRATION + ionPostState(tsOutputChannels); +#endif /* EFI_CDM_INTEGRATION */ break; default: ; diff --git a/firmware/controllers/algo/engine_configuration_generated_structures.h b/firmware/controllers/algo/engine_configuration_generated_structures.h index 8a01051344..126114ba62 100644 --- a/firmware/controllers/algo/engine_configuration_generated_structures.h +++ b/firmware/controllers/algo/engine_configuration_generated_structures.h @@ -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 #ifndef ENGINE_CONFIGURATION_GENERATED_H_ #define ENGINE_CONFIGURATION_GENERATED_H_ @@ -905,6 +905,7 @@ typedef struct { brain_pin_e spi3sckPin; /** * Saab Combustion Detection Module knock signal input pin + * also known as Saab Ion Sensing Module * offset 337 */ brain_pin_e cdmInputPin; @@ -1314,7 +1315,7 @@ typedef struct { */ int HD44780height; /** - * First TPS, first channel. See aslo pedalPositionAdcChannel + * First TPS, single channel so far. See aslo pedalPositionAdcChannel * offset 512 */ adc_channel_e tps1_1AdcChannel; @@ -1327,7 +1328,7 @@ typedef struct { */ adc_channel_e fuelLevelSensor; /** - * Second throttle body position sensor + * Second throttle body position sensor, single channel so far * offset 515 */ adc_channel_e tps2_1AdcChannel; @@ -2728,4 +2729,4 @@ typedef struct { #endif // 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 diff --git a/firmware/hw_layer/cdm_ion_sense.cpp b/firmware/hw_layer/cdm_ion_sense.cpp index 84762ad6c5..781f2e02e1 100644 --- a/firmware/hw_layer/cdm_ion_sense.cpp +++ b/firmware/hw_layer/cdm_ion_sense.cpp @@ -1,6 +1,8 @@ /* * @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 * * 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 + #include "digital_input_exti.h" EXTERN_ENGINE; +static CdmState instance; + #if EFI_TUNER_STUDIO void ionPostState(TunerStudioOutputChannels *tsOutputChannels) { - + tsOutputChannels->debugIntField1 = instance.totalCdmEvents; } -#endif - -static CdmState instance; +#endif /* EFI_TUNER_STUDIO */ static void extIonCallback(void *arg) { UNUSED(arg); + instance.totalCdmEvents++; int currentRevolution = engine->triggerCentral.triggerState.getTotalRevolutionCounter(); - instance.onNewSignal(currentRevolution); } diff --git a/firmware/hw_layer/cdm_ion_sense.h b/firmware/hw_layer/cdm_ion_sense.h index 71022a0ee5..2bc9dd90ed 100644 --- a/firmware/hw_layer/cdm_ion_sense.h +++ b/firmware/hw_layer/cdm_ion_sense.h @@ -18,6 +18,7 @@ public: * accumulated value for engine cycle which is not over yet */ int accumulator; + int totalCdmEvents = 0; /** * event counter for previous complete engine cycle */ diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 5162d279f3..0f3e5faa6e 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -300,8 +300,8 @@ bit issue_294_28; 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 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 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 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 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 -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; 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 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 joystickAPin;