counter for test command

This commit is contained in:
rusefi 2017-05-09 12:07:52 -04:00
parent cf86a0fe4c
commit 9d03be6731
3 changed files with 6 additions and 4 deletions

View File

@ -613,16 +613,16 @@ void handleOutputChannelsCommand(ts_channel_s *tsChannel, ts_response_format_e m
#define TEST_RESPONSE_TAG " ts_p_alive\r\n"
void handleTestCommand(ts_channel_s *tsChannel) {
static char warningCodeBuff[7];
tsState.testCommandCounter++;
static char testOutputBuffer[12];
/**
* this is NOT a standard TunerStudio command, this is my own
* extension of the protocol to simplify troubleshooting
*/
tunerStudioDebug("got T (Test)");
tunerStudioWriteData(tsChannel, (const uint8_t *) VCS_VERSION, sizeof(VCS_VERSION));
warningCodeBuff[0] = ' ';
itoa10(warningCodeBuff + 1, engine->engineState.lastErrorCode);
tunerStudioWriteData(tsChannel, (const uint8_t *) warningCodeBuff, strlen(warningCodeBuff));
chsnprintf(testOutputBuffer, sizeof(testOutputBuffer), "%d %d", engine->engineState.lastErrorCode, tsState.testCommandCounter);
tunerStudioWriteData(tsChannel, (const uint8_t *) testOutputBuffer, strlen(testOutputBuffer));
/**
* Please note that this response is a magic constant used by dev console for protocol detection
* @see EngineState#TS_PROTOCOL_TAG

View File

@ -29,6 +29,7 @@ typedef struct {
int errorCounter;
int totalCounter;
int textCommandCounter;
int testCommandCounter;
} tunerstudio_counters_s;
bool handlePlainCommand(ts_channel_s *tsChannel, uint8_t command);

View File

@ -197,6 +197,7 @@ static char dateBuffer[30];
static void lcdPrintf(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
// todo: migrate to chsnprintf
lcdLineStream.eos = 0; // reset
chvprintf((BaseSequentialStream *) &lcdLineStream, fmt, ap);
lcdLineStream.buffer[lcdLineStream.eos] = 0; // terminator