auto-sync
This commit is contained in:
parent
0a90863bde
commit
7b92b4babc
|
@ -66,7 +66,8 @@ static const ignition_table_t tps_advance_table = {
|
|||
static const float rpmSteps[16] = {800, 1200, 1600, 2000, 2500, 2800,
|
||||
3280, 3693.0, 4106.0, 4520.0, 4933.0, 5346.0, 5760.0, 6173.0, 6586.0, 7000.0};
|
||||
|
||||
void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfiguration) {
|
||||
void setCitroenBerlingoTU3JPConfiguration(persistent_config_s *config) {
|
||||
engine_configuration_s *engineConfiguration = &config->engineConfiguration;
|
||||
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
||||
|
||||
engineConfiguration->engineType = CITROEN_TU3JP;
|
||||
|
@ -86,7 +87,7 @@ void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfigur
|
|||
engineConfiguration->rpmHardLimit = 5000;
|
||||
engineConfiguration->cranking.rpm = 600;
|
||||
|
||||
memcpy(engineConfiguration->ve2RpmBins, rpmSteps, sizeof(rpmSteps));
|
||||
memcpy(config->ve2RpmBins, rpmSteps, sizeof(rpmSteps));
|
||||
|
||||
/**
|
||||
* Cranking fuel setting
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
|
||||
#include "engine_configuration.h"
|
||||
|
||||
void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfiguration);
|
||||
void setCitroenBerlingoTU3JPConfiguration(persistent_config_s *config);
|
||||
|
||||
#endif /* CITROENBERLINGOTU3JP_H_ */
|
||||
|
|
|
@ -53,7 +53,7 @@ static SerialConfig tsSerialConfig = { 0, 0, USART_CR2_STOP1_BITS | USART_CR2_LI
|
|||
EXTERN_ENGINE
|
||||
;
|
||||
|
||||
#define MAX_PAGE_ID 0
|
||||
extern short currentPageId;
|
||||
|
||||
// in MS, that's 10 seconds
|
||||
#define TS_READ_TIMEOUT 10000
|
||||
|
@ -112,14 +112,6 @@ static void resetTs(void) {
|
|||
memset(&tsState, 0, sizeof(tsState));
|
||||
}
|
||||
|
||||
/**
|
||||
* For some reason I could not get the 'pages' feature of Tuner Studio working - as
|
||||
* a workaround the whole configuration is just one page
|
||||
*
|
||||
* this field is in the end to simply aligning situation
|
||||
*/
|
||||
static short currentPageId;
|
||||
|
||||
void printTsStats(void) {
|
||||
#if EFI_PROD_CODE
|
||||
if (!isSerialOverUart()) {
|
||||
|
@ -132,7 +124,7 @@ void printTsStats(void) {
|
|||
tsState.outputChannelsCommandCounter, tsState.readPageCommandsCounter, tsState.burnCommandCounter);
|
||||
scheduleMsg(tsLogger, "TunerStudio W=%d / C=%d / P=%d / page=%d", tsState.writeValueCommandCounter,
|
||||
tsState.writeChunkCommandCounter, tsState.pageCommandCounter, currentPageId);
|
||||
scheduleMsg(tsLogger, "page size=%d", sizeof(engine_configuration_s));
|
||||
scheduleMsg(tsLogger, "page size=%d", getTunerStudioPageSize(currentPageId));
|
||||
|
||||
// scheduleMsg(logger, "analogChartFrequency %d",
|
||||
// (int) (&engineConfiguration->analogChartFrequency) - (int) engineConfiguration);
|
||||
|
@ -173,8 +165,8 @@ char *getWorkingPageAddr(int pageIndex) {
|
|||
switch (pageIndex) {
|
||||
case 0:
|
||||
return (char*) &configWorkingCopy.engineConfiguration;
|
||||
// case 1:
|
||||
// return (char*) &configWorkingCopy.boardConfiguration;
|
||||
case 1:
|
||||
return (char*) &configWorkingCopy.ve2Table;
|
||||
// case 2: // fuelTable
|
||||
// case 3: // ignitionTable
|
||||
// case 4: // veTable
|
||||
|
@ -188,8 +180,8 @@ int getTunerStudioPageSize(int pageIndex) {
|
|||
switch (pageIndex) {
|
||||
case 0:
|
||||
return PAGE_0_SIZE;
|
||||
// case 1:
|
||||
// return sizeof(configWorkingCopy.boardConfiguration);
|
||||
case 1:
|
||||
return PAGE_1_SIZE;
|
||||
// case 2:
|
||||
// case 3:
|
||||
// case 4:
|
||||
|
@ -202,7 +194,7 @@ void handlePageSelectCommand(ts_response_format_e mode, uint16_t pageId) {
|
|||
tsState.pageCommandCounter++;
|
||||
|
||||
currentPageId = pageId;
|
||||
scheduleMsg(tsLogger, "page %d selected", currentPageId);
|
||||
scheduleMsg(tsLogger, "PAGE %d", currentPageId);
|
||||
tsSendResponse(mode, NULL, 0);
|
||||
}
|
||||
|
||||
|
@ -213,17 +205,17 @@ void handlePageSelectCommand(ts_response_format_e mode, uint16_t pageId) {
|
|||
void handleWriteChunkCommand(ts_response_format_e mode, short offset, short count, void *content) {
|
||||
tsState.writeChunkCommandCounter++;
|
||||
|
||||
scheduleMsg(tsLogger, "%d receiving page %d chunk offset %d size %d", mode, currentPageId, offset, count);
|
||||
scheduleMsg(tsLogger, "WRITE CHUNK m=%d p=%d o=%d s=%d", mode, currentPageId, offset, count);
|
||||
|
||||
if (offset > getTunerStudioPageSize(currentPageId)) {
|
||||
scheduleMsg(tsLogger, "ERROR offset %d", offset);
|
||||
scheduleMsg(tsLogger, "ERROR invalid offset %d", offset);
|
||||
tunerStudioError("ERROR: out of range");
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
if (count > getTunerStudioPageSize(currentPageId)) {
|
||||
tunerStudioError("ERROR: unexpected count");
|
||||
scheduleMsg(tsLogger, "ERROR count %d", count);
|
||||
scheduleMsg(tsLogger, "ERROR unexpected count %d", count);
|
||||
count = 0;
|
||||
}
|
||||
|
||||
|
@ -276,20 +268,18 @@ static void sendErrorCode(void) {
|
|||
|
||||
void handlePageReadCommand(ts_response_format_e mode, uint16_t pageId, uint16_t offset, uint16_t count) {
|
||||
tsState.readPageCommandsCounter++;
|
||||
tunerStudioDebug("got R (Read page)");
|
||||
currentPageId = pageId;
|
||||
|
||||
#if EFI_TUNER_STUDIO_VERBOSE
|
||||
scheduleMsg(tsLogger, "%d: Page requested: page %d offset=%d count=%d", mode, (int) currentPageId, offset,
|
||||
scheduleMsg(tsLogger, "READ m=%d p=%d o=%d c=%d", mode, (int) currentPageId, offset,
|
||||
count);
|
||||
printTsStats();
|
||||
#endif
|
||||
|
||||
if (currentPageId > MAX_PAGE_ID) {
|
||||
scheduleMsg(tsLogger, "invalid Page number %x", currentPageId);
|
||||
|
||||
if (currentPageId >= PAGE_COUNT) {
|
||||
// something is not right here
|
||||
currentPageId = 0;
|
||||
tunerStudioError("ERROR: invalid page");
|
||||
tunerStudioError("ERROR: invalid page number");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -336,7 +326,7 @@ void handleBurnCommand(ts_response_format_e mode, uint16_t page) {
|
|||
|
||||
requestBurn();
|
||||
tunerStudioWriteCrcPacket(TS_RESPONSE_BURN_OK, NULL, 0);
|
||||
scheduleMsg(tsLogger, "burned in (ms): %d", currentTimeMillis() - nowMs);
|
||||
scheduleMsg(tsLogger, "BURN in %dms", currentTimeMillis() - nowMs);
|
||||
}
|
||||
|
||||
static TunerStudioReadRequest readRequest;
|
||||
|
@ -385,6 +375,7 @@ static bool handlePlainCommand(uint8_t command) {
|
|||
tsState.errorCounter++;
|
||||
return true;
|
||||
}
|
||||
currentPageId = writeChunkRequest.page;
|
||||
|
||||
handleWriteChunkCommand(TS_PLAIN, writeChunkRequest.offset, writeChunkRequest.count, (uint8_t * )&crcIoBuffer);
|
||||
return true;
|
||||
|
|
|
@ -34,6 +34,7 @@ void tunerStudioWriteCrcPacket(const uint8_t command, const void *buf, const uin
|
|||
|
||||
typedef pre_packed struct
|
||||
post_packed {
|
||||
short int page;
|
||||
short int offset;
|
||||
short int count;
|
||||
} TunerStudioWriteChunkRequest;
|
||||
|
|
|
@ -73,6 +73,8 @@ TunerStudioOutputChannels tsOutputChannels;
|
|||
*/
|
||||
persistent_config_s configWorkingCopy;
|
||||
|
||||
short currentPageId;
|
||||
|
||||
void tunerStudioError(const char *msg) {
|
||||
tunerStudioDebug(msg);
|
||||
tsState.errorCounter++;
|
||||
|
@ -90,9 +92,10 @@ int tunerStudioHandleCrcCommand(uint8_t *data, int incomingPacketSize) {
|
|||
uint16_t page = *(uint16_t *) data;
|
||||
handlePageSelectCommand(TS_CRC, page);
|
||||
} else if (command == TS_CHUNK_WRITE_COMMAND) {
|
||||
uint16_t offset = *(uint16_t *) data;
|
||||
uint16_t count = *(uint16_t *) (data + 2);
|
||||
handleWriteChunkCommand(TS_CRC, offset, count, data + 4);
|
||||
currentPageId = *(uint16_t *) data;
|
||||
uint16_t offset = *(uint16_t *) (data + 2);
|
||||
uint16_t count = *(uint16_t *) (data + 4);
|
||||
handleWriteChunkCommand(TS_CRC, offset, count, data + sizeof(TunerStudioWriteChunkRequest));
|
||||
} else if (command == TS_SINGLE_WRITE_COMMAND) {
|
||||
uint16_t page = *(uint16_t *) data;
|
||||
uint16_t offset = *(uint16_t *) (data + 2);
|
||||
|
|
|
@ -18,7 +18,11 @@
|
|||
*/
|
||||
#define TS_FILE_VERSION 20150216
|
||||
|
||||
#define PAGE_0_SIZE 15160
|
||||
#define PAGE_COUNT 2
|
||||
|
||||
#define PAGE_0_SIZE 14008
|
||||
#define PAGE_1_SIZE 1152
|
||||
|
||||
#define TS_OUTPUT_SIZE 196
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -134,12 +134,13 @@ void setWholeTimingTable(engine_configuration_s *engineConfiguration, float valu
|
|||
* This method sets the default global engine configuration. These values are later overridden by engine-specific defaults
|
||||
* and the settings saves in flash memory.
|
||||
*/
|
||||
void setDefaultConfiguration(engine_configuration_s *engineConfiguration) {
|
||||
void setDefaultConfiguration(persistent_config_s *config) {
|
||||
engine_configuration_s *engineConfiguration = &config->engineConfiguration;
|
||||
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
||||
memset(engineConfiguration, 0, sizeof(engine_configuration_s));
|
||||
memset(boardConfiguration, 0, sizeof(board_configuration_s));
|
||||
|
||||
setDetaultVETable(engineConfiguration);
|
||||
setDetaultVETable(config);
|
||||
|
||||
boardConfiguration->mafSensorType = Bosch0280218037;
|
||||
setBosch0280218037(engineConfiguration);
|
||||
|
@ -539,7 +540,7 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_EN
|
|||
/**
|
||||
* Let's apply global defaults first
|
||||
*/
|
||||
setDefaultConfiguration(engineConfiguration);
|
||||
setDefaultConfiguration(config);
|
||||
#if EFI_SIMULATOR
|
||||
engineConfiguration->directSelfStimulation = true;
|
||||
#endif /* */
|
||||
|
@ -632,7 +633,7 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_EN
|
|||
setMiata1996(engineConfiguration);
|
||||
break;
|
||||
case CITROEN_TU3JP:
|
||||
setCitroenBerlingoTU3JPConfiguration(engineConfiguration);
|
||||
setCitroenBerlingoTU3JPConfiguration(config);
|
||||
break;
|
||||
case ROVER_V8:
|
||||
setRoverv8(engineConfiguration);
|
||||
|
|
|
@ -40,6 +40,17 @@ operation_mode_e getOperationMode(engine_configuration_s const *engineConfigurat
|
|||
|
||||
typedef struct {
|
||||
engine_configuration_s engineConfiguration;
|
||||
|
||||
ve_table_t ve2Table;
|
||||
/**
|
||||
* offset 15032
|
||||
*/
|
||||
float ve2LoadBins[FUEL_LOAD_COUNT];
|
||||
/**
|
||||
* offset 15096
|
||||
*/
|
||||
float ve2RpmBins[FUEL_RPM_COUNT];
|
||||
|
||||
} persistent_config_s;
|
||||
|
||||
typedef struct {
|
||||
|
@ -49,7 +60,7 @@ typedef struct {
|
|||
crc_t value;
|
||||
} persistent_config_container_s;
|
||||
|
||||
void setDefaultConfiguration(engine_configuration_s *engineConfiguration);
|
||||
void setDefaultConfiguration(persistent_config_s *config);
|
||||
void setMap(fuel_table_t table, float value);
|
||||
void setWholeFuelMap(engine_configuration_s *engineConfiguration, float value);
|
||||
void setWholeTimingTable(engine_configuration_s *engineConfiguration, float value);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this section was generated by config_definition.jar on Fri Feb 20 16:22:15 EST 2015
|
||||
// this section was generated by config_definition.jar on Fri Feb 27 21:32:08 EST 2015
|
||||
// begin
|
||||
#include "rusefi_types.h"
|
||||
typedef struct {
|
||||
|
@ -1168,20 +1168,8 @@ typedef struct {
|
|||
* offset 13944
|
||||
*/
|
||||
float injPhaseRpmBins[FUEL_RPM_COUNT];
|
||||
/**
|
||||
* offset 14008
|
||||
*/
|
||||
ve_table_t ve2Table;
|
||||
/**
|
||||
* offset 15032
|
||||
*/
|
||||
float ve2LoadBins[FUEL_LOAD_COUNT];
|
||||
/**
|
||||
* offset 15096
|
||||
*/
|
||||
float ve2RpmBins[FUEL_RPM_COUNT];
|
||||
/** total size 15160*/
|
||||
/** total size 14008*/
|
||||
} engine_configuration_s;
|
||||
|
||||
// end
|
||||
// this section was generated by config_definition.jar on Fri Feb 20 16:22:15 EST 2015
|
||||
// this section was generated by config_definition.jar on Fri Feb 27 21:32:08 EST 2015
|
||||
|
|
|
@ -92,14 +92,15 @@ float getSpeedDensityFuel(int rpm DECLARE_ENGINE_PARAMETER_S) {
|
|||
return sdMath(engineConfiguration, VE, map, AFR, tChargeK) * 1000;
|
||||
}
|
||||
|
||||
void setDetaultVETable(engine_configuration_s *engineConfiguration) {
|
||||
void setDetaultVETable(persistent_config_s *config) {
|
||||
engine_configuration_s *engineConfiguration = &config->engineConfiguration;
|
||||
setRpmTableBin(engineConfiguration->veRpmBins, FUEL_RPM_COUNT);
|
||||
setTableBin2(engineConfiguration->veLoadBins, FUEL_LOAD_COUNT, 10, 300, 1);
|
||||
veMap.setAll(0.8);
|
||||
|
||||
setRpmTableBin(engineConfiguration->ve2RpmBins, FUEL_RPM_COUNT);
|
||||
setTableBin2(engineConfiguration->ve2LoadBins, FUEL_LOAD_COUNT, 10, 300, 1);
|
||||
ve2Map.setAll(0.8);
|
||||
setRpmTableBin(config->ve2RpmBins, FUEL_RPM_COUNT);
|
||||
setTableBin2(config->ve2LoadBins, FUEL_LOAD_COUNT, 10, 300, 1);
|
||||
ve2Map.setAll(0.81);
|
||||
|
||||
setRpmTableBin(engineConfiguration->afrRpmBins, FUEL_RPM_COUNT);
|
||||
setTableBin2(engineConfiguration->afrLoadBins, FUEL_LOAD_COUNT, 10, 300, 1);
|
||||
|
@ -110,6 +111,6 @@ void initSpeedDensity(persistent_config_s *config) {
|
|||
efiAssertVoid(config!=NULL, "config is NULL");
|
||||
engine_configuration_s *e = &config->engineConfiguration;
|
||||
veMap.init(e->veTable, e->veLoadBins, e->veRpmBins);
|
||||
ve2Map.init(e->ve2Table, e->ve2LoadBins, e->ve2RpmBins);
|
||||
ve2Map.init(config->ve2Table, config->ve2LoadBins, config->ve2RpmBins);
|
||||
afrMap.init(e->afrTable, e->afrLoadBins, e->afrRpmBins);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "engine.h"
|
||||
|
||||
float getTCharge(int rpm, float tps, float coolantTemp, float airTemp);
|
||||
void setDetaultVETable(engine_configuration_s *engineConfiguration);
|
||||
void setDetaultVETable(persistent_config_s *config);
|
||||
float sdMath(engine_configuration_s *engineConfiguration, float VE, float MAP, float AFR, float tempK);
|
||||
|
||||
#define gramm_second_to_cc_minute(gs) ((gs) / 0.0119997981)
|
||||
|
|
|
@ -505,8 +505,8 @@ fuel_table_t injectionPhase;
|
|||
float[FUEL_LOAD_COUNT] injPhaseLoadBins;;"Load", 1, 0.0, 0, 300.0, 2
|
||||
float[FUEL_RPM_COUNT] injPhaseRpmBins;;"RPM", 1, 0.0, 0, 18000.0, 2
|
||||
|
||||
ve_table_t ve2Table;
|
||||
float[FUEL_LOAD_COUNT] ve2LoadBins;;"%", 1, 0.0, 0, 300.0, 2
|
||||
float[FUEL_RPM_COUNT] ve2RpmBins;;"RPM", 1, 0.0, 0, 18000.0, 2
|
||||
! ve_table_t ve2Table;
|
||||
! float[FUEL_LOAD_COUNT] ve2LoadBins;;"%", 1, 0.0, 0, 300.0, 2
|
||||
! float[FUEL_RPM_COUNT] ve2RpmBins;;"RPM", 1, 0.0, 0, 18000.0, 2
|
||||
|
||||
end_struct
|
|
@ -12,14 +12,14 @@ enable2ndByteCanID = false
|
|||
messageEnvelopeFormat = msEnvelope_1.0
|
||||
|
||||
endianness = little
|
||||
nPages = 1
|
||||
nPages = 2
|
||||
|
||||
pageIdentifier = "\x00\x00"
|
||||
pageReadCommand = "R\x00\x00%2o%2c"
|
||||
burnCommand = "B\x00\x00"
|
||||
pageActivate = "P\x00\x00"
|
||||
pageValueWrite = "W\x00\x00%2o%v"
|
||||
pageChunkWrite = "C%2o%2c%v"
|
||||
pageIdentifier = "\x00\x00", "\x01\x00"
|
||||
pageReadCommand = "R\x00\x00%2o%2c", "R\x01\x00%2o%2c"
|
||||
burnCommand = "B\x00\x00", "B\x01\x00"
|
||||
pageActivate = "P\x00\x00", "P\x01\x00"
|
||||
pageValueWrite = "W\x00\x00%2o%v", "W\x01\x00%2o%v"
|
||||
pageChunkWrite = "C\x00\x00%2o%2c%v", "C\x01\x00%2o%2c%v"
|
||||
|
||||
;communication settings
|
||||
;e.g. put writeblocks off and add an interwrite delay
|
||||
|
@ -37,9 +37,9 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated by ConfigDefinition.jar on Wed Feb 25 19:12:49 EST 2015
|
||||
; this section was generated by ConfigDefinition.jar on Fri Feb 27 21:32:10 EST 2015
|
||||
|
||||
pageSize = 15160
|
||||
pageSize = 14008
|
||||
page = 1
|
||||
engineType = bits, S32, 0, [0:2], "AUDI_AAN", "DODGE_NEON_1995", "FORD_ASPIRE_1996", "FORD_FIESTA", "NISSAN_PRIMERA", "HONDA_ACCORD", "FORD_INLINE_6_1995", "GY6_139QMB"
|
||||
;skipping headerMagicValue offset 4
|
||||
|
@ -483,11 +483,14 @@ page = 1
|
|||
injectionPhase = array, F32, 12856, [16x16],"ms", 1, 0, 0.0, 300.0, 2
|
||||
injPhaseLoadBins = array, F32, 13880, [16], "Load", 1, 0.0, 0, 300.0, 2
|
||||
injPhaseRpmBins = array, F32, 13944, [16], "RPM", 1, 0.0, 0, 18000.0, 2
|
||||
ve2Table = array, F32, 14008, [16x16],"%", 100, 0, 0, 100.0, 2
|
||||
ve2LoadBins = array, F32, 15032, [16], "%", 1, 0.0, 0, 300.0, 2
|
||||
ve2RpmBins = array, F32, 15096, [16], "RPM", 1, 0.0, 0, 18000.0, 2
|
||||
; total TS size = 15160
|
||||
; total TS size = 14008
|
||||
; CONFIG_DEFINITION_END
|
||||
|
||||
page = 2
|
||||
ve2Table = array, F32, 0, [16x16],"%", 100, 0, 0, 100.0, 2
|
||||
ve2LoadBins = array, F32, 1024, [16], "%", 1, 0.0, 0, 300.0, 2
|
||||
ve2RpmBins = array, F32, 1088, [16], "RPM", 1, 0.0, 0, 18000.0, 2
|
||||
|
||||
|
||||
|
||||
[Tuning]
|
||||
|
|
Loading…
Reference in New Issue