auto-sync

This commit is contained in:
rusEfi 2015-08-30 18:01:44 -04:00
parent a377cc61eb
commit 2f3f98b5d2
3 changed files with 15 additions and 12 deletions

View File

@ -32,6 +32,9 @@
#include "wave_analyzer.h"
#endif
// see RUS_EFI_VERSION_TAG in console source code
#define RUS_EFI_VERSION_TAG "rusEfiVersion"
#include "trigger_central.h"
#include "engine_state.h"
#include "io_pins.h"
@ -302,8 +305,10 @@ static void printInfo(systime_t nowSeconds) {
return;
}
timeOfPreviousPrintVersion = nowSeconds;
appendPrintf(&logger, "rusEfiVersion%s%d@%s %s%s", DELIMETER, getRusEfiVersion(), VCS_VERSION,
appendPrintf(&logger, "%s%s%d@%s %s %d%s", RUS_EFI_VERSION_TAG, DELIMETER,
getRusEfiVersion(), VCS_VERSION,
getConfigurationName(engineConfiguration->engineType),
getTimeNowSeconds(),
DELIMETER);
#if EFI_PROD_CODE || defined(__DOXYGEN__)
printOutPin(CRANK1, boardConfiguration->triggerInputPins[0]);

View File

@ -54,7 +54,8 @@ public class BinaryProtocol {
private final IncomingDataBuffer incomingData;
private boolean isBurnPending;
private final Object lock = new Object();
private final Object ioLock = new Object();
private final Object imageLock = new Object();
private ConfigurationImage controller;
// todo: fix this, this is HORRIBLE!
@ -185,7 +186,7 @@ public class BinaryProtocol {
dropPending();
stream.write((SWITCH_TO_BINARY_COMMAND + "\n").getBytes());
synchronized (lock) {
synchronized (ioLock) {
boolean isTimeout = incomingData.waitForBytes(2, start, "switch to binary");
if (isTimeout) {
close();
@ -211,7 +212,7 @@ public class BinaryProtocol {
}
private void dropPending() throws IOException {
synchronized (lock) {
synchronized (ioLock) {
if (isClosed)
return;
incomingData.dropPending();
@ -246,7 +247,7 @@ public class BinaryProtocol {
private byte[] receivePacket(String msg, boolean allowLongResponse) throws InterruptedException, EOFException {
long start = System.currentTimeMillis();
synchronized (lock) {
synchronized (ioLock) {
boolean isTimeout = incomingData.waitForBytes(2, start, msg + " header");
if (isTimeout)
return null;
@ -263,11 +264,8 @@ public class BinaryProtocol {
return null;
byte[] packet = new byte[packetSize];
int packetCrc;
synchronized (lock) {
incomingData.getData(packet);
packetCrc = swap32(incomingData.getInt());
}
int packetCrc = swap32(incomingData.getInt());
int actualCrc = crc32(packet);
boolean isCrcOk = actualCrc == packetCrc;
@ -393,13 +391,13 @@ public class BinaryProtocol {
}
public void setController(ConfigurationImage controller) {
synchronized (lock) {
synchronized (imageLock) {
this.controller = controller.clone();
}
}
public ConfigurationImage getController() {
synchronized (lock) {
synchronized (imageLock) {
if (controller == null)
return null;
return controller.clone();

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 = 20150823;
public static final int CONSOLE_VERSION = 20150830;
public static final boolean SHOW_STIMULATOR = false;
private static final String TAB_INDEX = "main_tab";
protected static final String PORT_KEY = "port";