auto-sync

This commit is contained in:
rusEfi 2015-02-09 11:05:46 -06:00
parent 3d11c62246
commit 11c4ad9d3d
18 changed files with 30 additions and 48 deletions

View File

@ -165,8 +165,6 @@ void initializeConsole(Logging *sharedLogger) {
startConsole(&handleConsoleLine);
initLogging(&logger, "console");
sayHello();
addConsoleAction("test", sayNothing);
addConsoleAction("hello", sayHello);

View File

@ -273,7 +273,7 @@ static char LOGGING_BUFFER[700];
volatile int needToReportStatus = FALSE;
static int prevCkpEventCounter = -1;
static LoggingWithStorage logger2;
static LoggingWithStorage logger2("main event handler");
static void printStatus(void) {
needToReportStatus = TRUE;
@ -640,7 +640,6 @@ void initStatusLoop(Engine *engine) {
addConsoleActionI("warn", setWarningEnabled);
#if EFI_PROD_CODE
initLogging(&logger2, "main event handler");
#if EFI_ENGINE_CONTROL
addConsoleActionFFP("fuelinfo2", (VoidFloatFloatVoidPtr) showFuelInfo2,

View File

@ -21,7 +21,7 @@
#define isRunningBenchTest() true
#endif
static LoggingWithStorage logger;
static LoggingWithStorage logger("engine");
extern engine_pins_s enginePins;
@ -55,7 +55,6 @@ void Engine::precalc(engine_configuration_s *engineConfiguration) {
}
void Engine::init() {
initLogging(&logger, "engine");
}
static bool stopPin(NamedOutputPin *output) {

View File

@ -73,7 +73,7 @@ board_configuration_s *boardConfiguration = &persistentState.persistentConfigura
static VirtualTimer everyMsTimer;
static LoggingWithStorage logger;
static LoggingWithStorage logger("Engine Controller");
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
static engine_configuration2_s ec2 CCM_OPTIONAL;
@ -337,7 +337,6 @@ void initEngineContoller(Logging *sharedLogger, Engine *engine) {
if (hasFirmwareError()) {
return;
}
initLogging(&logger, "Engine Controller");
initSensors(engine);

View File

@ -15,7 +15,7 @@
#endif /* EFI_HD44780_LCD */
static time_t timeOfPreviousWarning = -10;
static LoggingWithStorage logger;
static LoggingWithStorage logger("error handling");
#define WARNING_PREFIX "WARNING: "
@ -104,6 +104,5 @@ void onUnlockHook(void) {
}
void initErrorHandling(void) {
initLogging(&logger, "error handling");
msObjectInit(&warningStream, (uint8_t *) warningBuffer, WARNING_BUFFER_SIZE, 0);
}

View File

@ -34,7 +34,7 @@
#include "pin_repository.h"
#include "efiGpio.h"
static LoggingWithStorage logger;
static LoggingWithStorage logger("InjectorCentral");
EXTERN_ENGINE
;
@ -208,7 +208,6 @@ static msg_t benchThread(int param) {
}
void initInjectorCentral(Engine *engine) {
initLogging(&logger, "InjectorCentral");
chThdCreateStatic(benchThreadStack, sizeof(benchThreadStack), NORMALPRIO, (tfunc_t) benchThread, NULL);
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {

View File

@ -62,7 +62,7 @@ int waveChartUsedSize;
static Logging debugLogging;
#endif /* DEBUG_WAVE */
static LoggingWithStorage logger;
static LoggingWithStorage logger("wave info");
void WaveChart::resetWaveChart() {
#if DEBUG_WAVE
@ -220,7 +220,6 @@ void showWaveChartHistogram(void) {
}
void initWaveChart(WaveChart *chart) {
initLogging(&logger, "wave info");
if (!engineConfiguration->isDigitalChartEnabled) {
printMsg(&logger, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! chart disabled");

View File

@ -30,7 +30,7 @@ EXTERN_ENGINE
static int canReadCounter = 0;
static int can_write_ok = 0;
static int can_write_not_ok = 0;
static LoggingWithStorage logger;
static LoggingWithStorage logger("CAN driver");
static THD_WORKING_AREA(canTreadStack, UTILITY_THREAD_STACK_SIZE);
/*
@ -252,8 +252,6 @@ void initCan(void) {
return;
#endif /* EFI_PROD_CODE */
initLogging(&logger, "CAN driver");
#if STM32_CAN_USE_CAN2
// CAN1 is required for CAN2
canStart(&CAND1, &canConfig);

View File

@ -23,7 +23,7 @@
extern board_configuration_s *boardConfiguration;
static LoggingWithStorage logger;
static LoggingWithStorage logger("io_pins");
static OutputPin sdCsPin;
@ -97,8 +97,6 @@ void initPrimaryPins(void) {
}
void initOutputPins(void) {
initLogging(&logger, "io_pins");
/**
* want to make sure it's all zeros so that we can compare in initOutputPinExt() method
*/

View File

@ -29,7 +29,7 @@
extern board_configuration_s *boardConfiguration;
extern engine_configuration_s *engineConfiguration;
static LoggingWithStorage logging;
static LoggingWithStorage logging("uart gps");
static SerialConfig GPSserialConfig = { GPS_SERIAL_SPEED, 0, USART_CR2_STOP1_BITS | USART_CR2_LINEN, 0 };
static THD_WORKING_AREA(gpsThreadStack, UTILITY_THREAD_STACK_SIZE);
@ -108,7 +108,6 @@ void initGps(void) {
if(!engineConfiguration->isGpsEnabled)
return;
initLogging(&logging, "uart gps");
sdStart(GPS_SERIAL_DEVICE, &GPSserialConfig);
// GPS we have USART1: PB7 -> USART1_RX and PB6 -> USART1_TX

View File

@ -20,7 +20,7 @@
const char *PIN_USED[PIN_REPO_SIZE];
static int initialized = FALSE;
static LoggingWithStorage logger;
static LoggingWithStorage logger("pin repos");
static int totalPinsUsed = 0;
/**
@ -125,7 +125,6 @@ void initPinRepository(void) {
/**
* this method cannot use console because this method is invoked before console is initialized
*/
initLogging(&logger, "pin repos");
msObjectInit(&portNameStream, (uint8_t*) portNameBuffer, sizeof(portNameBuffer), 0);

View File

@ -117,7 +117,7 @@
#include "engine_emulator.h"
#endif /* EFI_ENGINE_EMULATOR */
static LoggingWithStorage sharedLogger;
static LoggingWithStorage sharedLogger("main");
bool_t main_loop_started = false;
@ -156,7 +156,6 @@ void runRusEfi(void) {
* Next we should initialize serial port console, it's important to know what's going on
*/
initializeConsole(&sharedLogger);
initLogging(&sharedLogger, "main");
engine->init();
@ -259,5 +258,5 @@ int getRusEfiVersion(void) {
return 1; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE == 0)
return 1; // this is here to make the compiler happy about the unused array
return 20150208;
return 20150209;
}

View File

@ -174,10 +174,6 @@ int isInitialized(Logging *logging) {
return logging->isInitialized == MAGIC_LOGGING_FLAG;
}
void initLogging(LoggingWithStorage *logging, const char *name) {
initLoggingExt(logging, name, logging->DEFAULT_BUFFER, sizeof(logging->DEFAULT_BUFFER));
}
void debugInt(Logging *logging, const char *caption, int value) {
append(logging, caption);
append(logging, DELIMETER);
@ -389,10 +385,8 @@ void initIntermediateLoggingBuffer(void) {
#endif /* ! EFI_UNIT_TEST */
// todo: eliminate this constructor
LoggingWithStorage::LoggingWithStorage() {
}
LoggingWithStorage::LoggingWithStorage(const char *name) {
initLogging(this, name);
#if ! EFI_UNIT_TEST
initLoggingExt(this, name, DEFAULT_BUFFER, sizeof(DEFAULT_BUFFER));
#endif /* ! EFI_UNIT_TEST */
}

View File

@ -37,7 +37,6 @@ public:
class LoggingWithStorage : public Logging {
public:
LoggingWithStorage();
LoggingWithStorage(const char *name);
char DEFAULT_BUFFER[200];
};
@ -57,7 +56,6 @@ uint32_t remainingSize(Logging *logging);
int isInitialized(Logging *logging);
void initLogging(LoggingWithStorage *logging, const char *name);
void initLoggingExt(Logging *logging, const char *name, char *buffer, int bufferSize);
void debugInt(Logging *logging, const char *caption, int value);

View File

@ -1,7 +1,6 @@
package com.rusefi.io;
import com.irnems.core.MessagesCentral;
import com.rusefi.io.tcp.TcpConnector;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
@ -9,8 +8,6 @@ import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import static com.rusefi.io.tcp.TcpConnector.parseIntWithReason;
/**
* This class keeps re-sending a command till a proper confirmation is received
* <p/>
@ -97,6 +94,10 @@ public class CommandQueue {
});
}
/**
* this method handles command confirmations packed as
* TODO: add example, todo: refactor method and add unit test
*/
private void handleConfirmationMessage(String message, MessagesCentral mc) {
String confirmation = message.substring(CONFIRMATION_PREFIX.length());
int index = confirmation.indexOf(":");
@ -104,7 +105,14 @@ public class CommandQueue {
mc.postMessage(CommandQueue.class, "Broken confirmation: " + confirmation);
return;
}
int length = parseIntWithReason(confirmation.substring(index + 1), "CQ confirmation");
String number = confirmation.substring(index + 1);
int length;
try {
length = Integer.parseInt(number);
} catch (NumberFormatException e) {
mc.postMessage(CommandQueue.class, "Broken confirmation length: " + confirmation);
return;
}
if (length != index) {
mc.postMessage(CommandQueue.class, "Broken confirmation length: " + confirmation);
return;

View File

@ -23,7 +23,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
* @see WavePanel
*/
public class Launcher extends FrameHelper {
public static final int CONSOLE_VERSION = 20150204;
public static final int CONSOLE_VERSION = 20150209;
public static final boolean SHOW_STIMULATOR = true;
public static final String TAB_INDEX = "main_tab";
private final String port;

View File

@ -10,7 +10,7 @@
#include "engine_configuration.h"
#include "adc_math.h"
static LoggingWithStorage logger;
static LoggingWithStorage logger("simulator board");
extern engine_configuration_s *engineConfiguration;
static float fakeAdcValues[16];
@ -49,7 +49,6 @@ static void setMapVoltage(float voltage) {
}
void initFakeBoard(void) {
initLogging(&logger, "simulator board");
addConsoleActionF("set_mock_clt_voltage", setCltVoltage);
addConsoleActionF("set_mock_iat_voltage", setIatVoltage);

View File

@ -41,7 +41,7 @@ bool isInsideTriggerHandler;
persistent_config_container_s persistentState;
static engine_configuration2_s ec2;
static LoggingWithStorage sharedLogger;
static LoggingWithStorage sharedLogger("simulator");
engine_configuration_s * engineConfiguration = &persistentState.persistentConfiguration.engineConfiguration;
board_configuration_s *boardConfiguration = &persistentState.persistentConfiguration.engineConfiguration.bc;
@ -66,12 +66,10 @@ float getMap(void) {
}
void rusEfiFunctionalTest(void) {
initLogging(&sharedLogger, "simulator");
initializeConsole(&sharedLogger);
initFakeBoard();
initStatusLoop(engine);
initDataStructures(PASS_ENGINE_PARAMETER_F);