From f86186d5848cf90b8bb72bd3fa7e14fe574459bd Mon Sep 17 00:00:00 2001 From: rusEfi Date: Sat, 31 Jan 2015 16:04:13 -0600 Subject: [PATCH] auto-sync --- firmware/console/tunerstudio/tunerstudio.cpp | 9 ++++++++- firmware/console/tunerstudio/tunerstudio_algo.cpp | 8 ++++---- firmware/console/tunerstudio/tunerstudio_algo.h | 2 ++ firmware/flash_openocd.bat | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/firmware/console/tunerstudio/tunerstudio.cpp b/firmware/console/tunerstudio/tunerstudio.cpp index 02a77a135b..c50d74d4a4 100644 --- a/firmware/console/tunerstudio/tunerstudio.cpp +++ b/firmware/console/tunerstudio/tunerstudio.cpp @@ -317,6 +317,9 @@ void handleBurnCommand(ts_response_format_e mode, uint16_t page) { static TunerStudioReadRequest readRequest; static short int pageIn; +/** + * @return true if legacy command was processed, false otherwise + */ static bool handlePlainCommand(uint8_t command) { if (command == TS_HELLO_COMMAND || command == TS_HELLO_COMMAND_DEPRECATED) { scheduleMsg(tsLogger, "Got naked Query command"); @@ -343,7 +346,10 @@ static bool handlePlainCommand(uint8_t command) { //scheduleMsg(logger, "Got naked Channels???"); handleOutputChannelsCommand(TS_PLAIN); return true; - } else if (command == 'F') { + } else if (command == TS_LEGACY_HELLO_COMMAND) { + tunerStudioDebug("ignoring LEGACY_HELLO_COMMAND"); + return true; + } else if (command == TS_COMMAND_F) { tunerStudioDebug("not ignoring F"); tunerStudioWriteData((const uint8_t *) PROTOCOL, strlen(PROTOCOL)); return true; @@ -355,6 +361,7 @@ static bool handlePlainCommand(uint8_t command) { static bool isKnownCommand(char command) { return command == TS_HELLO_COMMAND || command == TS_READ_COMMAND || command == TS_OUTPUT_COMMAND || command == TS_PAGE_COMMAND || command == TS_BURN_COMMAND || command == TS_SINGLE_WRITE_COMMAND + || command == TS_LEGACY_HELLO_COMMAND || command == TS_CHUNK_WRITE_COMMAND; } diff --git a/firmware/console/tunerstudio/tunerstudio_algo.cpp b/firmware/console/tunerstudio/tunerstudio_algo.cpp index 8ef3022054..bb1bb01cee 100644 --- a/firmware/console/tunerstudio/tunerstudio_algo.cpp +++ b/firmware/console/tunerstudio/tunerstudio_algo.cpp @@ -108,12 +108,12 @@ int tunerStudioHandleCrcCommand(uint8_t *data, int incomingPacketSize) { handlePageReadCommand(TS_CRC, page, offset, count); } else if (command == 't' || command == 'T') { handleTestCommand(); - } else if (command == 'Q') { + } else if (command == TS_LEGACY_HELLO_COMMAND) { /** * 'Q' is the query command used for compatibility with older ECUs */ tunerStudioDebug("ignoring Q"); - } else if (command == 'F') { + } else if (command == TS_COMMAND_F) { tunerStudioDebug("ignoring F"); /** * http://www.msextra.com/forums/viewtopic.php?f=122&t=48327 @@ -124,9 +124,9 @@ int tunerStudioHandleCrcCommand(uint8_t *data, int incomingPacketSize) { */ } else { tunerStudioError("ERROR: ignoring unexpected command"); - return FALSE; + return false; } - return TRUE; + return true; } void tsSendResponse(ts_response_format_e mode, const uint8_t * buffer, int size) { diff --git a/firmware/console/tunerstudio/tunerstudio_algo.h b/firmware/console/tunerstudio/tunerstudio_algo.h index de779698d0..cd8139d770 100644 --- a/firmware/console/tunerstudio/tunerstudio_algo.h +++ b/firmware/console/tunerstudio/tunerstudio_algo.h @@ -63,9 +63,11 @@ void tunerStudioError(const char *msg); #define TS_HELLO_COMMAND_DEPRECATED 'H' #define TS_HELLO_COMMAND 'S' +#define TS_LEGACY_HELLO_COMMAND 'Q' #define TS_OUTPUT_COMMAND 'O' #define TS_READ_COMMAND 'R' #define TS_PAGE_COMMAND 'P' +#define TS_COMMAND_F 'F' #define TS_SINGLE_WRITE_COMMAND 'W' #define TS_CHUNK_WRITE_COMMAND 'C' diff --git a/firmware/flash_openocd.bat b/firmware/flash_openocd.bat index 7c79ff8a8c..0b8e568ddd 100644 --- a/firmware/flash_openocd.bat +++ b/firmware/flash_openocd.bat @@ -1 +1 @@ -openocd-0.8.0.exe -f interface/stlink-v2.cfg -f board/stm32f4discovery.cfg -c init -c targets -c "halt" -c "flash write_image erase build/rusefi.elf" -c "verify_image firmware.elf" -c "reset run" -c shutdown +openocd-0.8.0.exe -f interface/stlink-v2.cfg -f board/stm32f4discovery.cfg -c init -c targets -c "halt" -c "flash write_image erase rusefi.elf" -c "verify_image rusefi.elf" -c "reset run" -c shutdown