auto-sync

This commit is contained in:
rusEfi 2015-04-19 19:11:22 -04:00
parent 7aea7b0d55
commit f146392106
6 changed files with 57 additions and 20 deletions

View File

@ -389,7 +389,7 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
engineConfiguration->fanOffTemperature = 80;
// boardConfiguration->tunerStudioSerialSpeed = 9600;
boardConfiguration->tunerStudioSerialSpeed = 38400;
boardConfiguration->tunerStudioSerialSpeed = 19200;
engineConfiguration->algorithm = LM_SPEED_DENSITY;
boardConfiguration->alternatorControlPin = GPIOD_5;
@ -404,6 +404,13 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
// engineConfiguration->canNbcType = CAN_BUS_MAZDA_RX8;
engineConfiguration->mapAccelLength = 12;
engineConfiguration->mapAccelEnrichmentThreshold = 5; // kPa
engineConfiguration->mapAccelEnrichmentMultiplier = 0;
engineConfiguration->tpsAccelLength = 12;
engineConfiguration->tpsAccelEnrichmentThreshold = 10;
engineConfiguration->tpsAccelEnrichmentMultiplier = 0.15;
}
#endif /* EFI_SUPPORT_DODGE_NEON */

View File

@ -134,6 +134,15 @@ static void resetTs(void) {
memset(&tsState, 0, sizeof(tsState));
}
static void printErrorCounters(void) {
scheduleMsg(&tsLogger, "TunerStudio size=%d / total=%d / errors=%d / H=%d / O=%d / P=%d / B=%d",
sizeof(tsOutputChannels), tsState.tsCounter, tsState.errorCounter, tsState.queryCommandCounter,
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", getTunerStudioPageSize(currentPageId));
}
void printTsStats(void) {
#if EFI_PROD_CODE
if (!isSerialOverUart()) {
@ -141,12 +150,8 @@ void printTsStats(void) {
portname(TS_SERIAL_TX_PORT), TS_SERIAL_TX_PIN, boardConfiguration->tunerStudioSerialSpeed);
}
#endif /* EFI_PROD_CODE */
scheduleMsg(&tsLogger, "TunerStudio size=%d / total=%d / errors=%d / H=%d / O=%d / P=%d / B=%d",
sizeof(tsOutputChannels), tsState.tsCounter, tsState.errorCounter, tsState.queryCommandCounter,
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", getTunerStudioPageSize(currentPageId));
printErrorCounters();
// scheduleMsg(logger, "analogChartFrequency %d",
// (int) (&engineConfiguration->analogChartFrequency) - (int) engineConfiguration);
@ -172,7 +177,6 @@ static void setTsSpeed(int value) {
void tunerStudioDebug(const char *msg) {
#if EFI_TUNER_STUDIO_VERBOSE
scheduleMsg(&tsLogger, "%s", msg);
printTsStats();
#endif
}
@ -244,7 +248,7 @@ void handleWriteChunkCommand(ts_channel_s *tsChannel, ts_response_format_e mode,
void *content) {
tsState.writeChunkCommandCounter++;
scheduleMsg(&tsLogger, "WRITE CHUNK m=%d p=%d o=%d s=%d", mode, currentPageId, offset, count);
scheduleMsg(&tsLogger, "WRITE CHUNK mode=%d p=%d o=%d s=%d", mode, currentPageId, offset, count);
if (offset > getTunerStudioPageSize(currentPageId)) {
scheduleMsg(&tsLogger, "ERROR invalid offset %d", offset);
@ -263,7 +267,6 @@ void handleWriteChunkCommand(ts_channel_s *tsChannel, ts_response_format_e mode,
yellowMagic(currentPageId, offset, count);
tsSendResponse(tsChannel, mode, NULL, 0);
printTsStats();
}
void handleCrc32Check(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t pageId, uint16_t offset,
@ -332,8 +335,7 @@ void handlePageReadCommand(ts_channel_s *tsChannel, ts_response_format_e mode, u
currentPageId = pageId;
#if EFI_TUNER_STUDIO_VERBOSE
scheduleMsg(&tsLogger, "READ m=%d p=%d o=%d c=%d", mode, (int) currentPageId, offset, count);
printTsStats();
scheduleMsg(&tsLogger, "READ mode=%d page=%d offset=%d size=%d", mode, (int) currentPageId, offset, count);
#endif
if (currentPageId >= PAGE_COUNT) {
@ -354,7 +356,7 @@ void handlePageReadCommand(ts_channel_s *tsChannel, ts_response_format_e mode, u
const uint8_t *addr = (const uint8_t *) (getWorkingPageAddr(currentPageId) + offset);
tsSendResponse(tsChannel, mode, addr, count);
#if EFI_TUNER_STUDIO_VERBOSE
scheduleMsg(&tsLogger, "Sending %d done", count);
// scheduleMsg(&tsLogger, "Sending %d done", count);
#endif
}
@ -365,6 +367,12 @@ void requestBurn(void) {
incrementGlobalConfigurationVersion();
}
static void sendResponseCode(ts_response_format_e mode, ts_channel_s *tsChannel, const uint8_t responseCode) {
if (mode == TS_CRC) {
tunerStudioWriteCrcPacket(tsChannel, responseCode, NULL, 0);
}
}
/**
* 'Burn' command is a command to commit the changes
*/
@ -385,7 +393,7 @@ void handleBurnCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint1
memcpy(&persistentState.persistentConfiguration, &configWorkingCopy, sizeof(persistent_config_s));
requestBurn();
tunerStudioWriteCrcPacket(tsChannel, TS_RESPONSE_BURN_OK, NULL, 0);
sendResponseCode(mode, tsChannel, TS_RESPONSE_BURN_OK);
scheduleMsg(&tsLogger, "BURN in %dms", currentTimeMillis() - nowMs);
}
@ -470,9 +478,10 @@ void runBinaryProtocolLoop(ts_channel_s *tsChannel, bool_t isConsoleRedirect) {
incomingPacketSize + CRC_VALUE_SIZE - 1, TS_READ_TIMEOUT);
int expectedSize = incomingPacketSize + CRC_VALUE_SIZE - 1;
if (recieved != expectedSize) {
scheduleMsg(&tsLogger, "got ONLY %d for packet size %d/%d for command %c", recieved, incomingPacketSize,
scheduleMsg(&tsLogger, "Got only %d bytes while expecting %d for command %c", recieved,
expectedSize, command);
tunerStudioError("ERROR: not enough");
tunerStudioError("ERROR: not enough bytes in stream");
sendResponseCode(TS_CRC, tsChannel, TS_RESPONSE_UNDERRUN);
continue;
}
@ -533,6 +542,7 @@ short currentPageId;
void tunerStudioError(const char *msg) {
tunerStudioDebug(msg);
printErrorCounters();
tsState.errorCounter++;
}

View File

@ -24,6 +24,8 @@
#define TS_RESPONSE_OK 0x00
#define TS_RESPONSE_BURN_OK 0x04
#define TS_RESPONSE_COMMAND_OK 0x07
#define TS_RESPONSE_UNDERRUN 0x80
#define TS_RESPONSE_CRC_FAILURE 0x82
typedef enum {

View File

@ -557,6 +557,14 @@ static void setWholeTimingMapCmd(float value) {
setWholeTimingMap(value);
}
static void setWholeVeCmd(float value) {
scheduleMsg(&logger, "Setting whole VE map to %f", value);
if (engineConfiguration->algorithm != LM_SPEED_DENSITY) {
scheduleMsg(&logger, "WARNING: setting VE map not in SD mode is pointless");
}
setMap(config->veTable, value);
}
static void setWholeFuelMapCmd(float value) {
scheduleMsg(&logger, "Setting whole fuel map to %f", value);
if (engineConfiguration->algorithm == LM_SPEED_DENSITY) {
@ -931,6 +939,7 @@ void initSettings(engine_configuration_s *engineConfiguration) {
addConsoleActionF("set_whole_phase_map", setWholePhaseMapCmd);
addConsoleActionF("set_whole_timing_map", setWholeTimingMapCmd);
addConsoleActionF("set_whole_fuel_map", setWholeFuelMapCmd);
addConsoleActionF("set_whole_ve_map", setWholeVeCmd);
addConsoleActionSSS("set_fuel_map", setFuelMap);
addConsoleActionF("set_whole_timing_map", setWholeTimingMap);

View File

@ -32,7 +32,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
* @see com.rusefi.StartupFrame
*/
public class Launcher {
public static final int CONSOLE_VERSION = 20150413;
public static final int CONSOLE_VERSION = 20150419;
public static final boolean SHOW_STIMULATOR = false;
private static final String TAB_INDEX = "main_tab";
protected static final String PORT_KEY = "port";

View File

@ -10,6 +10,8 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
@ -91,7 +93,10 @@ public class RecentCommands {
public void run() {
content.removeAll();
synchronized (entries) {
for (Entry entry : entries.keySet()) {
Set<Entry> sorted = new TreeSet<Entry>();
sorted.addAll(entries.keySet());
for (Entry entry : sorted) {
content.add(createButton(entry));
}
}
@ -133,7 +138,7 @@ public class RecentCommands {
return sb.toString();
}
static class Entry {
static class Entry implements Comparable<Entry> {
private final String command;
Entry(String command) {
@ -162,6 +167,10 @@ public class RecentCommands {
"command='" + command + '\'' +
'}';
}
}
@Override
public int compareTo(Entry o) {
return command.compareTo(o.command);
}
}
}