void startTunerStudioConnectivity(void) { initLogging(&logger, "tuner studio"); if (sizeof(engine_configuration_s) != getTunerStudioPageSize(0)) firmwareError("TS page size mismatch: %d/%d", sizeof(engine_configuration_s), getTunerStudioPageSize(0)); if (sizeof(TunerStudioOutputChannels) != TS_OUTPUT_SIZE) firmwareError("TS outputs size mismatch: %d/%d", sizeof(TunerStudioOutputChannels), TS_OUTPUT_SIZE); memset(&tsState, 0, sizeof(tsState)); #if EFI_PROD_CODE if (isSerialOverUart()) { print("TunerStudio over USB serial"); usb_serial_start(); } else { print("TunerStudio over USART"); mySetPadMode("tunerstudio rx", TS_SERIAL_RX_PORT, TS_SERIAL_RX_PIN, PAL_MODE_ALTERNATE(TS_SERIAL_AF)); mySetPadMode("tunerstudio tx", TS_SERIAL_TX_PORT, TS_SERIAL_TX_PIN, PAL_MODE_ALTERNATE(TS_SERIAL_AF)); sdStart(TS_SERIAL_UART_DEVICE, &tsSerialConfig); } #endif /* EFI_PROD_CODE */ syncTunerStudioCopy(); addConsoleAction("tsinfo", printStats); chThdCreateStatic(TS_WORKING_AREA, sizeof(TS_WORKING_AREA), NORMALPRIO, tsThreadEntryPoint, NULL); }
void startTunerStudioConnectivity(void) { if (sizeof(persistent_config_s) != getTunerStudioPageSize(0)) firmwareError("TS page size mismatch: %d/%d", sizeof(persistent_config_s), getTunerStudioPageSize(0)); if (sizeof(TunerStudioOutputChannels) != TS_OUTPUT_SIZE) firmwareError("TS outputs size mismatch: %d/%d", sizeof(TunerStudioOutputChannels), TS_OUTPUT_SIZE); memset(&tsState, 0, sizeof(tsState)); syncTunerStudioCopy(); addConsoleAction("tsinfo", printTsStats); addConsoleAction("reset_ts", resetTs); addConsoleActionI("set_ts_speed", setTsSpeed); tsChannel.channel = getTsSerialDevice(); tsChannel.writeBuffer = tsCrcWriteBuffer; chThdCreateStatic(tsThreadStack, sizeof(tsThreadStack), NORMALPRIO, tsThreadEntryPoint, NULL); }
void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_ENGINE_PARAMETER_S) { /** * Let's apply global defaults first */ setDefaultConfiguration(PASS_ENGINE_PARAMETER_F); #if EFI_SIMULATOR || defined(__DOXYGEN__) engineConfiguration->directSelfStimulation = true; #endif /* */ engineConfiguration->engineType = engineType; engineConfiguration->headerMagicValue = HEADER_MAGIC_NUMBER; /** * And override them with engine-specific defaults */ switch (engineType) { case CUSTOM_ENGINE: setCustomEngineConfiguration(PASS_ENGINE_PARAMETER_F); break; case ACURA_RSX: setAcuraRSX(engineConfiguration); break; #if EFI_SUPPORT_DODGE_NEON || defined(__DOXYGEN__) case DODGE_NEON_1995: setDodgeNeon1995EngineConfiguration(PASS_ENGINE_PARAMETER_F); break; case DODGE_NEON_2003: setDodgeNeonNGCEngineConfiguration(PASS_ENGINE_PARAMETER_F); break; #endif /* EFI_SUPPORT_DODGE_NEON */ #if EFI_SUPPORT_FORD_ASPIRE || defined(__DOXYGEN__) case FORD_ASPIRE_1996: setFordAspireEngineConfiguration(PASS_ENGINE_PARAMETER_F); break; #endif /* EFI_SUPPORT_FORD_ASPIRE */ #if EFI_SUPPORT_FORD_FIESTA || defined(__DOXYGEN__) case FORD_FIESTA: setFordFiestaDefaultEngineConfiguration(PASS_ENGINE_PARAMETER_F); break; #endif /* EFI_SUPPORT_FORD_FIESTA */ #if EFI_SUPPORT_NISSAN_PRIMERA || defined(__DOXYGEN__) case NISSAN_PRIMERA: setNissanPrimeraEngineConfiguration(engineConfiguration); break; #endif case HONDA_ACCORD_CD: setHondaAccordConfigurationThreeWires(PASS_ENGINE_PARAMETER_F); break; case HONDA_ACCORD_CD_TWO_WIRES: setHondaAccordConfiguration1_24(PASS_ENGINE_PARAMETER_F); break; case HONDA_ACCORD_CD_DIP: setHondaAccordConfigurationDip(PASS_ENGINE_PARAMETER_F); break; case MITSU_4G93: setMitsubishiConfiguration(PASS_ENGINE_PARAMETER_F); break; #if EFI_SUPPORT_1995_FORD_INLINE_6 || defined(__DOXYGEN__) case FORD_INLINE_6_1995: setFordInline6(PASS_ENGINE_PARAMETER_F); break; #endif /* EFI_SUPPORT_1995_FORD_INLINE_6 */ case GY6_139QMB: setGy6139qmbDefaultEngineConfiguration(PASS_ENGINE_PARAMETER_F); break; case MAZDA_MIATA_NB: setMazdaMiataNbEngineConfiguration(PASS_ENGINE_PARAMETER_F); break; case MAZDA_323: setMazda323EngineConfiguration(engineConfiguration); break; case MAZDA_626: setMazda626EngineConfiguration(PASS_ENGINE_PARAMETER_F); break; case SATURN_ION_2004: setSaturnIonEngineConfiguration(engineConfiguration); break; case MINI_COOPER_R50: setMiniCooperR50(engineConfiguration); break; case FORD_ESCORT_GT: setFordEscortGt(PASS_ENGINE_PARAMETER_F); break; case MIATA_1990: setMiata1990(PASS_ENGINE_PARAMETER_F); break; case MIATA_1994_DEVIATOR: setMiata1994_d(PASS_ENGINE_PARAMETER_F); break; case MIATA_1994_SPAGS: setMiata1994_s(PASS_ENGINE_PARAMETER_F); break; case MIATA_1996: setMiata1996(PASS_ENGINE_PARAMETER_F); break; case CITROEN_TU3JP: setCitroenBerlingoTU3JPConfiguration(PASS_ENGINE_PARAMETER_F); break; case ROVER_V8: setRoverv8(PASS_ENGINE_PARAMETER_F); break; case SUBARU_2003_WRX: setSubaru2003Wrx(PASS_ENGINE_PARAMETER_F); break; case BMW_E34: setBmwE34(PASS_ENGINE_PARAMETER_F); break; case GM_2_2: setGm2_2(PASS_ENGINE_PARAMETER_F); break; case DODGE_RAM: setDodgeRam1996(PASS_ENGINE_PARAMETER_F); break; case DODGE_STRATUS: setDodgeStratus(PASS_ENGINE_PARAMETER_F); break; case VW_ABA: setVwAba(PASS_ENGINE_PARAMETER_F); break; case TEST_ENGINE: setTestEngineConfiguration(PASS_ENGINE_PARAMETER_F); break; case SACHS: setSachs(PASS_ENGINE_PARAMETER_F); break; case DAIHATSU: setDaihatsu(PASS_ENGINE_PARAMETER_F); break; default: warning(OBD_PCM_Processor_Fault, "Unexpected engine type: %d", engineType); } applyNonPersistentConfiguration(logger PASS_ENGINE_PARAMETER); // todo: eliminate triggerShape.operationMode? if (engineConfiguration->operationMode != engine->triggerShape.getOperationMode()) firmwareError("operationMode mismatch"); #if EFI_TUNER_STUDIO syncTunerStudioCopy(); #endif }