Split SSM LTV queries into two sets to fix issue #72

This commit is contained in:
Dale Schultz 2018-04-27 19:00:43 -04:00
parent d6e77ed7b5
commit 8753bef296
1 changed files with 23 additions and 2 deletions

View File

@ -1,6 +1,6 @@
/* /*
* RomRaider Open-Source Tuning, Logging and Reflashing * RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2015 RomRaider.com * Copyright (C) 2006-2018 RomRaider.com
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -147,10 +147,31 @@ public final class SSMLearningTableValues extends SwingWorker<Void, Void>
settings.getLoggerConnectionProperties()); settings.getLoggerConnectionProperties());
try { try {
Collection<EcuQuery> queries = buildLearningQueries(); Collection<EcuQuery> queries = buildLearningQueries();
// Break queries into two sets to avoid the ECU packet limit
final int setSize = queries.size() / 2;
final Collection<EcuQuery> querySet1 = new ArrayList<EcuQuery>();
final Collection<EcuQuery> querySet2 = new ArrayList<EcuQuery>();
int s = 0;
for (EcuQuery q : queries) {
if (s < setSize) {
querySet1.add(q);
}
else {
querySet2.add(q);
}
s++;
}
LOGGER.trace(
String.format("Queries:%d, Set size:%d, Set 1 size:%d, Set 2 size:%d",
queries.size(), setSize, querySet1.size(), querySet2.size()));
LOGGER.info(message); LOGGER.info(message);
connection.sendAddressReads( connection.sendAddressReads(
queries, querySet1,
settings.getDestinationTarget(),
new PollingStateImpl());
connection.sendAddressReads(
querySet2,
settings.getDestinationTarget(), settings.getDestinationTarget(),
new PollingStateImpl()); new PollingStateImpl());
LOGGER.info("Current vehicle info & A/F values retrieved."); LOGGER.info("Current vehicle info & A/F values retrieved.");