TS protocol debugging #336

This commit is contained in:
rusefi 2017-03-26 17:19:08 -04:00
parent 907e058d95
commit 46f9bdd552
5 changed files with 12 additions and 5 deletions

View File

@ -144,7 +144,7 @@ static void resetTs(void) {
static void printErrorCounters(void) { static void printErrorCounters(void) {
scheduleMsg(&tsLogger, "TunerStudio size=%d / total=%d / errors=%d / H=%d / O=%d / P=%d / B=%d", scheduleMsg(&tsLogger, "TunerStudio size=%d / total=%d / errors=%d / H=%d / O=%d / P=%d / B=%d",
sizeof(tsOutputChannels), tsState.tsCounter, tsState.errorCounter, tsState.queryCommandCounter, sizeof(tsOutputChannels), tsState.totalCounter, tsState.errorCounter, tsState.queryCommandCounter,
tsState.outputChannelsCommandCounter, tsState.readPageCommandsCounter, tsState.burnCommandCounter); tsState.outputChannelsCommandCounter, tsState.readPageCommandsCounter, tsState.burnCommandCounter);
scheduleMsg(&tsLogger, "TunerStudio W=%d / C=%d / P=%d / page=%d", tsState.writeValueCommandCounter, scheduleMsg(&tsLogger, "TunerStudio W=%d / C=%d / P=%d / page=%d", tsState.writeValueCommandCounter,
tsState.writeChunkCommandCounter, tsState.pageCommandCounter, currentPageId); tsState.writeChunkCommandCounter, tsState.pageCommandCounter, currentPageId);
@ -454,7 +454,7 @@ void runBinaryProtocolLoop(ts_channel_s *tsChannel, bool isConsoleRedirect) {
// scheduleSimpleMsg(&logger, "ts channel is now ready ", hTimeNow()); // scheduleSimpleMsg(&logger, "ts channel is now ready ", hTimeNow());
} }
tsState.tsCounter++; tsState.totalCounter++;
uint8_t firstByte; uint8_t firstByte;
int recieved = chnReadTimeout(tsChannel->channel, &firstByte, 1, TS_READ_TIMEOUT); int recieved = chnReadTimeout(tsChannel->channel, &firstByte, 1, TS_READ_TIMEOUT);
@ -637,6 +637,8 @@ static void handleGetVersion(ts_channel_s *tsChannel) {
} }
static void handleGetText(ts_channel_s *tsChannel) { static void handleGetText(ts_channel_s *tsChannel) {
tsState.textCommandCounter++;
int outputSize; int outputSize;
char *output = swapOutputBuffers(&outputSize); char *output = swapOutputBuffers(&outputSize);
#if EFI_SIMULATOR || defined(__DOXYGEN__) #if EFI_SIMULATOR || defined(__DOXYGEN__)

View File

@ -27,7 +27,8 @@ typedef struct {
int crc32CheckCommandCounter; int crc32CheckCommandCounter;
int writeChunkCommandCounter; int writeChunkCommandCounter;
int errorCounter; int errorCounter;
int tsCounter; int totalCounter;
int textCommandCounter;
} tunerstudio_counters_s; } tunerstudio_counters_s;
bool handlePlainCommand(ts_channel_s *tsChannel, uint8_t command); bool handlePlainCommand(ts_channel_s *tsChannel, uint8_t command);

View File

@ -86,6 +86,7 @@ extern TunerStudioOutputChannels tsOutputChannels;
#endif #endif
extern bool hasFirmwareErrorFlag; extern bool hasFirmwareErrorFlag;
extern tunerstudio_counters_s tsState;
#define FULL_LOGGING_KEY "fl" #define FULL_LOGGING_KEY "fl"
static char LOGGING_BUFFER[1400] CCM_OPTIONAL; static char LOGGING_BUFFER[1400] CCM_OPTIONAL;
@ -730,6 +731,9 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
if (engineConfiguration->debugMode == DBG_TPS_ACCEL) { if (engineConfiguration->debugMode == DBG_TPS_ACCEL) {
tsOutputChannels->debugIntField1 = engine->tpsAccelEnrichment.cb.getSize(); tsOutputChannels->debugIntField1 = engine->tpsAccelEnrichment.cb.getSize();
} else if (engineConfiguration->debugMode == DBG_SR5_PROTOCOL) {
tsOutputChannels->debugIntField1 = tsState.textCommandCounter * 1000000 + tsState.burnCommandCounter + tsState.totalCounter;
tsOutputChannels->debugIntField2 = tsState.outputChannelsCommandCounter * 100000 + tsState.readPageCommandsCounter * 1000 + tsState.writeValueCommandCounter;
} }
if (engineConfiguration->debugMode == DBG_TRIGGER_INPUT) { if (engineConfiguration->debugMode == DBG_TRIGGER_INPUT) {

View File

@ -682,7 +682,7 @@ typedef enum {
DBG_FUEL_PID_CORRECTION = 11, DBG_FUEL_PID_CORRECTION = 11,
DBG_VEHICLE_SPEED_SENSOR = 12, DBG_VEHICLE_SPEED_SENSOR = 12,
DBG_SD_CARD = 13, DBG_SD_CARD = 13,
DM_14 = 14, DBG_SR5_PROTOCOL = 14,
DM_15 = 15, DM_15 = 15,
DM_16 = 16, DM_16 = 16,
DM_17 = 17, DM_17 = 17,

View File

@ -250,5 +250,5 @@ int getRusEfiVersion(void) {
return 123; // this is here to make the compiler happy about the unused array return 123; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] * 0 != 0) if (UNUSED_CCM_SIZE[0] * 0 != 0)
return 3211; // this is here to make the compiler happy about the unused array return 3211; // this is here to make the compiler happy about the unused array
return 20170323; return 20170326;
} }