diff --git a/firmware/config/engines/GY6_139QMB.cpp b/firmware/config/engines/GY6_139QMB.cpp index a8aef4a05e..85c35c092f 100644 --- a/firmware/config/engines/GY6_139QMB.cpp +++ b/firmware/config/engines/GY6_139QMB.cpp @@ -29,5 +29,5 @@ void setGy6139qmbDefaultEngineConfiguration(engine_configuration_s *engineConfig engineConfiguration->trigger.customTotalToothCount = 1; engineConfiguration->trigger.customSkippedToothCount = 0; engineConfiguration->trigger.customIsSynchronizationNeeded = false; -//todo engineConfiguration2->triggerShape.needSecondTriggerInput = false; + engineConfiguration->needSecondTriggerInput = false; } diff --git a/firmware/config/engines/sachs.cpp b/firmware/config/engines/sachs.cpp index 83d04c8c3e..844cb6e34a 100644 --- a/firmware/config/engines/sachs.cpp +++ b/firmware/config/engines/sachs.cpp @@ -13,6 +13,20 @@ void setSachs(engine_configuration_s *engineConfiguration) { engineConfiguration->displacement = 0.1; // 100cc + engineConfiguration->cylindersCount = 1; + engineConfiguration->engineCycle = 360; + + engineConfiguration->firingOrder = FO_ONE_CYLINDER; + + /** + * We treat the trigger as 1/0 toothed wheel + */ + engineConfiguration->trigger.type = TT_TOOTHED_WHEEL; + engineConfiguration->trigger.customTotalToothCount = 1; + engineConfiguration->trigger.customSkippedToothCount = 0; + engineConfiguration->trigger.customIsSynchronizationNeeded = false; + engineConfiguration->needSecondTriggerInput = false; + engineConfiguration->hasIatSensor = false; engineConfiguration->hasMapSensor = false; diff --git a/firmware/hw_layer/adc_inputs.cpp b/firmware/hw_layer/adc_inputs.cpp index f33588cad6..ffc215e98d 100644 --- a/firmware/hw_layer/adc_inputs.cpp +++ b/firmware/hw_layer/adc_inputs.cpp @@ -30,8 +30,6 @@ AdcDevice::AdcDevice(ADCConversionGroup* hwConfig) { memset(internalAdcIndexByHardwareIndex, 0xFFFFFFFF, sizeof(internalAdcIndexByHardwareIndex)); } -#define ADC_NUMBER_CHANNELS_FAST 1 - // todo: migrate from hardware timer to software ADC conversion triggering // todo: I guess we would have to use ChibiOS timer and not our own timer because // todo: adcStartConversionI requires OS lock. currently slow ADC is 10Hz (?) @@ -117,9 +115,10 @@ ADC_TwoSamplingDelay_5Cycles, // cr1 ADC_CR2_SWSTART, // cr2 0, // sample times for channels 10...18 + // todo: IS SOMETHING MISSING HERE? ADC_SMPR2_SMP_AN0(MY_SAMPLING_FAST), // In this field must be specified the sample times for channels 0...9 - ADC_SQR1_NUM_CH(ADC_NUMBER_CHANNELS_FAST), // Conversion group sequence 13...16 + sequence length + 0, // Conversion group sequence 13...16 + sequence length 0, // Conversion group sequence 7...12 0 @@ -382,8 +381,10 @@ void AdcDevice::addChannel(adc_channel_e hwChannel) { hardwareIndexByIndernalAdcIndex[logicChannel] = hwChannel; if (logicChannel < 6) { hwConfig->sqr3 += (hwChannel) << (5 * logicChannel); - } else { + } else if (logicChannel < 12) { hwConfig->sqr2 += (hwChannel) << (5 * (logicChannel - 6)); + } else { + hwConfig->sqr1 += (hwChannel) << (5 * (logicChannel - 12)); } // todo: support for more then 12 channels? not sure how needed it would be diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index c5464cc747..6a6bbd7060 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -260,5 +260,5 @@ int getRusEfiVersion(void) { return 1; // this is here to make the compiler happy about the unused array if (UNUSED_CCM_SIZE == 0) return 1; // this is here to make the compiler happy about the unused array - return 20150126; + return 20150127; } diff --git a/unit_tests/main.cpp b/unit_tests/main.cpp index aac2a5cdd2..406ed1dbb7 100644 --- a/unit_tests/main.cpp +++ b/unit_tests/main.cpp @@ -143,7 +143,7 @@ int main(void) { testMenuTree(); // resizeMap(); - printf("Success 20150101\r\n"); + printf("Success 20150127\r\n"); return EXIT_SUCCESS; } diff --git a/unit_tests/test_trigger_decoder.cpp b/unit_tests/test_trigger_decoder.cpp index 9701bbc81a..05e8997fe1 100644 --- a/unit_tests/test_trigger_decoder.cpp +++ b/unit_tests/test_trigger_decoder.cpp @@ -534,6 +534,7 @@ void testTriggerDecoder(void) { testTriggerDecoder3("citroen", CITROEN_TU3JP, 0, 0.4833, 0.0, 2.9994); testTriggerDecoder3("neon NGC", DODGE_NEON_2003, 5, 0.4861, 0.0, CHRYSLER_NGC_GAP); + testTriggerDecoder2("sachs", SACHS, 0, 0.5000, 0.000); testMazda323();