From 048c7a602582e35af9f9d5b4537da1ed3a118673 Mon Sep 17 00:00:00 2001 From: rusefi Date: Thu, 8 Oct 2020 17:50:43 -0400 Subject: [PATCH] SD card logs not valid for REO #1864 --- firmware/console/binary/tunerstudio_outputs.h | 2 +- firmware/console/binary_log/binary_logging.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/firmware/console/binary/tunerstudio_outputs.h b/firmware/console/binary/tunerstudio_outputs.h index 961d1084b0..1b160386f6 100644 --- a/firmware/console/binary/tunerstudio_outputs.h +++ b/firmware/console/binary/tunerstudio_outputs.h @@ -196,7 +196,7 @@ typedef struct { // we want a hash of engineMake+engineCode+vehicleName in the log file in order to match TS logs to rusEFI Online tune int16_t engineMakeCodeNameCrc16; // 138 // Errors - int totalTriggerErrorCounter; // 140 + scaled_channel totalTriggerErrorCounter; // 140 int orderingErrorCounter; // 144 int16_t warningCounter; // 148 int16_t lastErrorCode; // 150 diff --git a/firmware/console/binary_log/binary_logging.cpp b/firmware/console/binary_log/binary_logging.cpp index d14ed84637..6d6a420df4 100644 --- a/firmware/console/binary_log/binary_logging.cpp +++ b/firmware/console/binary_log/binary_logging.cpp @@ -10,8 +10,16 @@ #include "efitime.h" #include "crc.h" + +#define TIME_PRECISION 1000 + +// floating number of seconds with millisecond precision +scaled_channel packedTime; + static const LogField fields[] = { {tsOutputChannels.rpm, GAUGE_NAME_RPM, "rpm", 0}, + {packedTime, GAUGE_NAME_TIME, "sec", 0}, + {tsOutputChannels.totalTriggerErrorCounter, GAUGE_NAME_TRG_ERR, "err", 0}, {tsOutputChannels.vehicleSpeedKph, GAUGE_NAME_VVS, "kph", 0}, {tsOutputChannels.internalMcuTemperature, GAUGE_NAME_CPU_TEMP, "C", 0}, {tsOutputChannels.coolantTemperature, GAUGE_NAME_CLT, "C", 1}, @@ -108,6 +116,8 @@ size_t writeBlock(char* buffer) { buffer[2] = timestamp >> 8; buffer[3] = timestamp & 0xFF; + packedTime = currentTimeMillis() * 1.0 / TIME_PRECISION; + // Offset 4 = field data const char* dataBlockStart = buffer + 4; char* dataBlock = buffer + 4;