2015-07-10 06:01:56 -07:00
|
|
|
/*
|
2020-05-25 10:02:05 -07:00
|
|
|
* @file tunerstudio_outputs.h
|
2015-07-10 06:01:56 -07:00
|
|
|
* @brief Tuner Studio connectivity configuration
|
|
|
|
*
|
|
|
|
* In this file the configuration of TunerStudio is defined
|
|
|
|
*
|
|
|
|
* @date Oct 22, 2013
|
2020-01-13 18:57:43 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
|
2020-02-24 13:47:10 -08:00
|
|
|
#pragma once
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
#include "rusefi_types.h"
|
2020-02-24 13:47:10 -08:00
|
|
|
#include "scaled_channel.h"
|
2019-12-22 05:12:45 -08:00
|
|
|
#include "tunerstudio_debug_struct.h"
|
2021-11-17 21:19:11 -08:00
|
|
|
#include "ts_outputs_generated.h"
|
2019-12-22 05:12:45 -08:00
|
|
|
|
2020-04-26 11:06:09 -07:00
|
|
|
enum class TsCalMode : uint8_t {
|
|
|
|
None = 0,
|
|
|
|
Tps1Max = 1,
|
|
|
|
Tps1Min = 2,
|
|
|
|
EtbKp = 3,
|
|
|
|
EtbKi = 4,
|
|
|
|
EtbKd = 5,
|
2020-05-18 11:32:00 -07:00
|
|
|
Tps1SecondaryMax = 6,
|
|
|
|
Tps1SecondaryMin = 7,
|
2020-08-23 20:41:35 -07:00
|
|
|
Tps2Max = 8,
|
|
|
|
Tps2Min = 9,
|
|
|
|
Tps2SecondaryMax = 10,
|
|
|
|
Tps2SecondaryMin = 11,
|
2020-04-26 11:06:09 -07:00
|
|
|
};
|
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
/**
|
2021-11-17 20:22:08 -08:00
|
|
|
* todo https://github.com/rusefi/rusefi/issues/197
|
|
|
|
* At the moment rusEFI does NOT have any code generation around TS output channels, three locations have to be changed manually
|
2019-12-19 19:40:27 -08:00
|
|
|
* 1) this TunerStudioOutputChannels firmware version of the structure
|
|
|
|
* 2) '[OutputChannels]' block in rusefi.input
|
2021-11-17 20:22:08 -08:00
|
|
|
* 3) com.rusefi.core.Sensor enum in rusEFI console source code
|
2019-12-19 19:40:27 -08:00
|
|
|
*
|
2021-11-17 21:19:11 -08:00
|
|
|
* status update: there is progress, a portion of this struct is now generated! we inherit from generated
|
|
|
|
* ts_outputs_s and eventually the whole thing would be generated
|
|
|
|
*
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
2021-11-17 21:19:11 -08:00
|
|
|
struct TunerStudioOutputChannels : ts_outputs_s {
|
2018-01-06 07:53:15 -08:00
|
|
|
/* see also [OutputChannels] in rusefi.input */
|
2019-12-22 05:12:45 -08:00
|
|
|
|
|
|
|
// temperatures
|
|
|
|
scaled_temperature auxTemp1; // offset 16
|
|
|
|
scaled_temperature auxTemp2; // offset 18
|
|
|
|
|
|
|
|
// throttle, pedal
|
|
|
|
scaled_percent throttlePosition; // 20
|
|
|
|
scaled_percent pedalPosition; // 22
|
|
|
|
uint16_t tpsADC; // 24
|
|
|
|
|
|
|
|
// air flow/mass measurment
|
|
|
|
scaled_voltage massAirFlowVoltage; // 26
|
2020-07-03 20:06:00 -07:00
|
|
|
scaled_channel<uint16_t, PACK_MULT_MASS_FLOW> massAirFlow; // 28
|
2019-12-22 05:12:45 -08:00
|
|
|
scaled_pressure manifoldAirPressure; // 30
|
|
|
|
scaled_pressure baroPressure; // 32
|
|
|
|
|
2020-10-26 15:15:17 -07:00
|
|
|
scaled_lambda lambda; // 34
|
2021-11-01 20:33:59 -07:00
|
|
|
scaled_channel<uint8_t, 10> knockRetard; // 36
|
|
|
|
uint8_t unused37;
|
2019-12-22 05:12:45 -08:00
|
|
|
|
|
|
|
// misc sensors
|
|
|
|
scaled_voltage vBatt; // 38
|
|
|
|
scaled_pressure oilPressure; // 40
|
2021-07-08 06:25:31 -07:00
|
|
|
scaled_angle vvtPositionB1I; // 42
|
2019-12-22 05:12:45 -08:00
|
|
|
|
|
|
|
// Fuel math
|
2020-09-30 17:19:51 -07:00
|
|
|
scaled_channel<uint16_t, 1000> chargeAirMass; // 44 cylinder airmass in mg, 0-65 grams
|
2020-10-26 04:23:13 -07:00
|
|
|
scaled_fuel_mass_mg crankingFuelMass; // 46
|
2019-12-22 05:12:45 -08:00
|
|
|
scaled_afr currentTargetAfr; // 48
|
|
|
|
// This is the raw value we take from the fuel map or base fuel algorithm, before the corrections
|
2020-09-30 17:19:51 -07:00
|
|
|
scaled_fuel_mass_mg fuelBase; // 50
|
2019-12-22 05:12:45 -08:00
|
|
|
// Total fuel with CLT, IAT and TPS acceleration without injector lag corrections per cycle, as pulse per cycle
|
2020-10-26 04:23:13 -07:00
|
|
|
scaled_fuel_mass_mg fuelRunning; // 52
|
2019-12-22 05:12:45 -08:00
|
|
|
// Actual last injection time - including all compensation and injection mode
|
|
|
|
scaled_ms actualLastInjection; // 54
|
|
|
|
scaled_channel<uint8_t, 2> injectorDutyCycle; // 56
|
|
|
|
scaled_channel<uint8_t, 2> veValue; // 57
|
|
|
|
scaled_angle injectionOffset; // 58
|
|
|
|
scaled_temperature tCharge; // 60
|
|
|
|
|
|
|
|
// Corrections
|
|
|
|
scaled_ms injectorLagMs; // 62
|
|
|
|
scaled_percent iatCorrection; // 64
|
|
|
|
scaled_percent cltCorrection; // 66
|
|
|
|
scaled_percent baroCorrection; // 68
|
2021-11-05 17:02:15 -07:00
|
|
|
uint16_t currentEnginePhase; // 70
|
2019-12-22 05:12:45 -08:00
|
|
|
|
|
|
|
// Wall model AE
|
|
|
|
scaled_ms wallFuelAmount; // 72
|
|
|
|
scaled_channel<int16_t, 1000> wallFuelCorrection; // 74
|
|
|
|
|
|
|
|
// TPS/load AE
|
2021-10-16 18:23:32 -07:00
|
|
|
scaled_percent unused76; // 76
|
2019-12-22 05:12:45 -08:00
|
|
|
scaled_percent deltaTps; // 78
|
2021-10-16 18:23:32 -07:00
|
|
|
scaled_percent unused80; // 80
|
2019-12-22 05:12:45 -08:00
|
|
|
scaled_ms tpsAccelFuel; // 82
|
|
|
|
|
|
|
|
// Ignition
|
|
|
|
scaled_angle ignitionAdvance; // 84
|
|
|
|
scaled_ms sparkDwell; // 86
|
|
|
|
scaled_percent coilDutyCycle; // 88
|
|
|
|
|
|
|
|
// Idle & ETB
|
|
|
|
scaled_percent idlePosition; // 90
|
|
|
|
scaled_percent etbTarget; // 92
|
|
|
|
scaled_percent etb1DutyCycle; // 94
|
|
|
|
scaled_percent etb1Error; // 96
|
|
|
|
|
|
|
|
// Fuel system
|
|
|
|
scaled_percent fuelTankLevel; // 98
|
2021-03-19 14:04:42 -07:00
|
|
|
scaled_channel<uint16_t> totalFuelConsumption; // 100
|
|
|
|
scaled_channel<uint16_t, PACK_MULT_FUEL_FLOW> fuelFlowRate; // 102
|
2019-12-22 05:12:45 -08:00
|
|
|
|
2020-09-07 07:15:42 -07:00
|
|
|
// Y axis values for selectable tables
|
|
|
|
scaled_channel<uint16_t, 100> veTableYAxis; // 104
|
|
|
|
scaled_channel<uint16_t, 100> afrTableYAxis; // 106
|
|
|
|
|
2019-12-22 05:12:45 -08:00
|
|
|
// Knock
|
2021-04-03 17:28:55 -07:00
|
|
|
scaled_channel<float> knockLevel; // 108
|
2019-12-22 05:12:45 -08:00
|
|
|
|
|
|
|
// Mode, firmware, protocol, run time
|
2021-10-05 13:27:09 -07:00
|
|
|
scaled_channel<uint32_t> timeSeconds; // 112
|
|
|
|
scaled_channel<uint32_t> engineMode; // 116
|
|
|
|
scaled_channel<uint32_t> firmwareVersion; // 120
|
2020-06-04 17:43:52 -07:00
|
|
|
// todo: this not needed in light of TS_SIGNATURE but rusEFI console still uses it. Need to migrate
|
|
|
|
// rusEFI console from TS_FILE_VERSION to TS_SIGNATURE :(
|
|
|
|
|
2019-12-22 05:12:45 -08:00
|
|
|
uint32_t tsConfigVersion; // 124
|
|
|
|
|
2020-04-26 11:06:09 -07:00
|
|
|
// These two fields indicate to TS that we'd like to set a particular field to a particular value
|
|
|
|
// We use a maintainConstantValue in TS for each field we'd like to set, like this:
|
|
|
|
// maintainConstantValue = tpsMax, { (calibrationMode == 1 ) ? calibrationValue : tpsMax }
|
|
|
|
// maintainConstantValue = tpsMin, { (calibrationMode == 2 ) ? calibrationValue : tpsMin }
|
|
|
|
// When the mode is set to a particular value, TS will copy the calibrationValue in to the specified field.
|
|
|
|
//
|
|
|
|
// With this simple construct, the ECU can send any number of internally computed configuration fields
|
|
|
|
// back to TunerStudio, getting around the problem of setting values on the controller without TS's knowledge.
|
|
|
|
// The ECU simply has to sequentially set a mode/value, wait briefly, then repeat until all the values
|
|
|
|
// it wants to send have been sent.
|
|
|
|
float calibrationValue; // 128
|
|
|
|
TsCalMode calibrationMode; // 132
|
2020-05-09 15:31:41 -07:00
|
|
|
uint8_t padding[1]; // 133
|
2020-04-26 11:06:09 -07:00
|
|
|
|
2020-07-04 13:40:31 -07:00
|
|
|
// Values used for load axes for fuel/ign tables
|
|
|
|
// These may or may not be the same value, depending on mode
|
|
|
|
scaled_channel<uint16_t, 100> fuelingLoad; // 134
|
|
|
|
scaled_channel<uint16_t, 100> ignitionLoad; // 136
|
|
|
|
|
2020-05-09 17:04:58 -07:00
|
|
|
// we want a hash of engineMake+engineCode+vehicleName in the log file in order to match TS logs to rusEFI Online tune
|
2021-09-08 18:15:41 -07:00
|
|
|
scaled_channel<uint16_t> engineMakeCodeNameCrc16; // 138
|
2019-12-22 05:12:45 -08:00
|
|
|
// Errors
|
2020-10-08 14:50:43 -07:00
|
|
|
scaled_channel<uint32_t> totalTriggerErrorCounter; // 140
|
2020-07-04 13:40:31 -07:00
|
|
|
int orderingErrorCounter; // 144
|
2021-09-05 06:16:35 -07:00
|
|
|
scaled_channel<uint16_t> warningCounter; // 148
|
|
|
|
scaled_channel<uint16_t> lastErrorCode; // 150
|
2020-07-04 13:40:31 -07:00
|
|
|
int16_t recentErrorCodes[8]; // 152-166
|
2019-12-22 05:12:45 -08:00
|
|
|
|
|
|
|
// Debug
|
2021-09-05 11:43:35 -07:00
|
|
|
scaled_channel<float> debugFloatField1; // 168
|
|
|
|
scaled_channel<float> debugFloatField2;
|
|
|
|
scaled_channel<float> debugFloatField3;
|
|
|
|
scaled_channel<float> debugFloatField4;
|
|
|
|
scaled_channel<float> debugFloatField5;
|
|
|
|
scaled_channel<float> debugFloatField6;
|
|
|
|
scaled_channel<float> debugFloatField7;
|
2021-09-05 06:16:35 -07:00
|
|
|
scaled_channel<uint32_t> debugIntField1;
|
|
|
|
scaled_channel<uint32_t> debugIntField2;
|
|
|
|
scaled_channel<uint32_t> debugIntField3;
|
2021-09-05 07:01:04 -07:00
|
|
|
scaled_channel<uint16_t> debugIntField4;
|
|
|
|
scaled_channel<uint16_t> debugIntField5; // 210
|
2019-12-22 05:12:45 -08:00
|
|
|
|
|
|
|
// accelerometer
|
2021-11-17 20:16:15 -08:00
|
|
|
scaled_percent accelerationX; // 212
|
|
|
|
scaled_percent accelerationY; // 214
|
2019-12-22 05:12:45 -08:00
|
|
|
|
|
|
|
// EGT
|
2021-11-17 20:16:15 -08:00
|
|
|
uint16_t egtValues[EGT_CHANNEL_COUNT] ; // 216
|
2020-04-26 11:06:09 -07:00
|
|
|
|
2020-07-04 13:40:31 -07:00
|
|
|
scaled_percent throttle2Position; // 232
|
2020-02-27 00:21:42 -08:00
|
|
|
|
2020-07-04 13:40:31 -07:00
|
|
|
scaled_voltage rawTps1Primary; // 234
|
|
|
|
scaled_voltage rawPpsPrimary; // 236
|
|
|
|
scaled_voltage rawClt; // 238
|
|
|
|
scaled_voltage rawIat; // 240
|
|
|
|
scaled_voltage rawOilPressure; // 242
|
2020-04-16 17:32:07 -07:00
|
|
|
|
2021-09-08 18:15:41 -07:00
|
|
|
scaled_channel<uint16_t> tuneCrc16; // 244
|
2020-09-02 10:30:54 -07:00
|
|
|
|
2021-11-17 20:22:08 -08:00
|
|
|
scaled_channel<uint8_t> unusedAt246;
|
2020-09-02 10:30:54 -07:00
|
|
|
|
2021-10-03 21:30:20 -07:00
|
|
|
scaled_channel<uint8_t> tcuCurrentGear; // 247
|
2020-08-05 22:15:41 -07:00
|
|
|
|
2020-08-21 05:53:23 -07:00
|
|
|
scaled_voltage rawPpsSecondary; // 248
|
|
|
|
|
2021-09-19 00:54:59 -07:00
|
|
|
scaled_channel<int8_t> knockLevels[12]; // 250
|
2020-08-31 18:05:33 -07:00
|
|
|
|
2021-10-03 21:30:20 -07:00
|
|
|
scaled_channel<uint8_t> tcuDesiredGear; // 262
|
2021-01-05 04:57:26 -08:00
|
|
|
scaled_channel<uint8_t, 2> flexPercent; // 263
|
2020-09-02 10:30:54 -07:00
|
|
|
|
2020-09-18 00:04:07 -07:00
|
|
|
scaled_voltage rawIdlePositionSensor; // 264
|
|
|
|
scaled_voltage rawWastegatePositionSensor; // 266
|
|
|
|
|
|
|
|
scaled_percent wastegatePosition; // 268
|
|
|
|
scaled_percent idlePositionSensor; // 270
|
|
|
|
|
2020-10-23 04:31:47 -07:00
|
|
|
scaled_voltage rawLowFuelPressure; // 272
|
|
|
|
scaled_voltage rawHighFuelPressure; // 274
|
2020-10-22 20:17:29 -07:00
|
|
|
|
2020-10-23 04:31:47 -07:00
|
|
|
scaled_pressure lowFuelPressure; // 276
|
|
|
|
scaled_high_pressure highFuelPressure; // 278
|
|
|
|
|
2020-10-30 14:42:00 -07:00
|
|
|
scaled_lambda targetLambda; // 280
|
2020-10-31 14:52:07 -07:00
|
|
|
scaled_afr airFuelRatio; // 282
|
2020-10-30 14:42:00 -07:00
|
|
|
|
2020-12-02 08:12:19 -08:00
|
|
|
scaled_ms VssAcceleration; //284
|
2020-12-09 11:30:51 -08:00
|
|
|
|
|
|
|
scaled_lambda lambda2; // 286
|
|
|
|
scaled_afr airFuelRatio2; // 288
|
|
|
|
|
2021-07-08 06:25:31 -07:00
|
|
|
scaled_angle vvtPositionB1E; // 290
|
|
|
|
scaled_angle vvtPositionB2I; // 292
|
|
|
|
scaled_angle vvtPositionB2E; // 294
|
2021-05-08 14:41:50 -07:00
|
|
|
|
|
|
|
scaled_percent fuelTrim[2]; // 296 & 298
|
|
|
|
|
2021-06-18 13:27:44 -07:00
|
|
|
scaled_voltage rawTps1Secondary; // 300
|
|
|
|
scaled_voltage rawTps2Primary; // 302
|
|
|
|
scaled_voltage rawTps2Secondary; // 304
|
|
|
|
|
2021-10-05 21:19:33 -07:00
|
|
|
scaled_channel<uint16_t> knockCount;// 306
|
2021-09-20 11:27:26 -07:00
|
|
|
|
2021-11-17 20:16:15 -08:00
|
|
|
scaled_percent accelerationZ; // 308
|
|
|
|
scaled_percent accelerationRoll; // 310
|
|
|
|
scaled_percent accelerationYaw; // 312
|
2021-11-02 12:03:57 -07:00
|
|
|
|
|
|
|
scaled_channel<int8_t> vvtTargets[4]; // 314
|
2021-11-04 16:43:22 -07:00
|
|
|
scaled_channel<uint16_t> turboSpeed; // 318
|
2021-11-02 12:03:57 -07:00
|
|
|
|
2021-11-04 16:43:22 -07:00
|
|
|
uint8_t unusedAtTheEnd[18]; // we have some unused bytes to allow compatible TS changes
|
2019-12-22 05:12:45 -08:00
|
|
|
|
|
|
|
// Temporary - will remove soon
|
|
|
|
TsDebugChannels* getDebugChannels() {
|
|
|
|
return reinterpret_cast<TsDebugChannels*>(&debugFloatField1);
|
|
|
|
}
|
|
|
|
|
2018-01-06 07:53:15 -08:00
|
|
|
/* see also [OutputChannels] in rusefi.input */
|
2020-07-31 17:08:26 -07:00
|
|
|
/* see also TS_OUTPUT_SIZE in rusefi_config.txt */
|
2021-06-25 17:58:38 -07:00
|
|
|
};
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2019-10-08 18:02:51 -07:00
|
|
|
extern TunerStudioOutputChannels tsOutputChannels;
|