delimeter is not comma (#3533)

* delimeter is not comma

* do it in config txt

* use txt

* s

* string

* compat

* also, spelling is hard

* use new name

* use new name

* generate enough for happy console

* use an even less common character

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
Matthew Kennedy 2021-11-19 01:01:45 -08:00 committed by GitHub
parent 692e3d7e9f
commit caee2a5439
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 32 additions and 33 deletions

View File

@ -176,7 +176,7 @@ static systime_t timeOfPreviousPrintVersion = 0;
#if EFI_PROD_CODE
static void printOutPin(const char *pinName, brain_pin_e hwPin) {
if (isBrainPinValid(hwPin)) {
logger.appendPrintf("%s%s%s@%s%s", PROTOCOL_OUTPIN, DELIMETER, pinName, hwPortname(hwPin), DELIMETER);
logger.appendPrintf(PROTOCOL_OUTPIN LOG_DELIMITER "%s@%s" LOG_DELIMITER, pinName, hwPortname(hwPin));
}
}
#endif /* EFI_PROD_CODE */

View File

@ -241,12 +241,11 @@ void StartupFuelPumping::update() {
void printCurrentState(Logging *logging, int seconds, const char *engineTypeName, const char *firmwareBuildId) {
// VersionChecker in rusEFI console is parsing these version string, please follow the expected format
logging->appendPrintf("%s%s%d@%s %s %s %d%s", PROTOCOL_VERSION_TAG, DELIMETER,
logging->appendPrintf(PROTOCOL_VERSION_TAG LOG_DELIMITER "%d@%s %s %s %d" LOG_DELIMITER,
getRusEfiVersion(), VCS_VERSION,
firmwareBuildId,
engineTypeName,
seconds,
DELIMETER);
seconds);
}
void TriggerConfiguration::update() {

View File

@ -82,7 +82,7 @@ void WaveChart::reset() {
counter = 0;
startTimeNt = 0;
collectingData = false;
logging.appendPrintf( "%s%s", PROTOCOL_ENGINE_SNIFFER, DELIMETER);
logging.appendPrintf( "%s%s", PROTOCOL_ENGINE_SNIFFER, LOG_DELIMITER);
}
void WaveChart::startDataCollection() {
@ -139,7 +139,7 @@ void WaveChart::publishIfFull() {
}
void WaveChart::publish() {
logging.appendPrintf( DELIMETER);
logging.appendPrintf( LOG_DELIMITER);
waveChartUsedSize = logging.loggingSize();
#if DEBUG_WAVE
Logging *l = &chart->logging;

View File

@ -169,38 +169,38 @@ static void reportWave(Logging *logging, int index) {
float dwellMs = getSignalOnTime(index);
float periodMs = getSignalPeriodMs(index);
logging->appendPrintf("duty%d%s", index, DELIMETER);
logging->appendPrintf("duty%d%s", index, LOG_DELIMITER);
logging->appendFloat(100.0f * dwellMs / periodMs, 2);
logging->appendPrintf("%s", DELIMETER);
logging->appendPrintf("%s", LOG_DELIMITER);
/**
* that's the ON time of the LAST signal
*/
logging->appendPrintf("dwell%d%s", index, DELIMETER);
logging->appendPrintf("dwell%d%s", index, LOG_DELIMITER);
logging->appendFloat(dwellMs, 2);
logging->appendPrintf("%s", DELIMETER);
logging->appendPrintf("%s", LOG_DELIMITER);
/**
* that's the total ON time during the previous engine cycle
*/
logging->appendPrintf("total_dwell%d%s", index, DELIMETER);
logging->appendPrintf("total_dwell%d%s", index, LOG_DELIMITER);
logging->appendFloat(readers[index].prevTotalOnTimeUs / 1000.0f, 2);
logging->appendPrintf("%s", DELIMETER);
logging->appendPrintf("%s", LOG_DELIMITER);
logging->appendPrintf("period%d%s", index, DELIMETER);
logging->appendPrintf("period%d%s", index, LOG_DELIMITER);
logging->appendFloat(periodMs, 2);
logging->appendPrintf("%s", DELIMETER);
logging->appendPrintf("%s", LOG_DELIMITER);
uint32_t offsetUs = getWaveOffset(index);
int rpm = GET_RPM();
if (rpm != 0) {
float oneDegreeUs = getOneDegreeTimeUs(rpm);
logging->appendPrintf("advance%d%s", index, DELIMETER);
logging->appendPrintf("advance%d%s", index, LOG_DELIMITER);
float angle = (offsetUs / oneDegreeUs) - tdcPosition();
fixAngle(angle, "waveAn", CUSTOM_ERR_6564);
logging->appendFloat(angle, 3);
logging->appendPrintf("%s", DELIMETER);
logging->appendPrintf("%s", LOG_DELIMITER);
}
}
}

View File

@ -52,7 +52,7 @@ void scAddData(float angle, float value) {
// Reset logging and append header
scLogging.reset();
scLogging.appendPrintf( "%s%s", PROTOCOL_ANALOG_CHART, DELIMETER);
scLogging.appendPrintf(PROTOCOL_ANALOG_CHART LOG_DELIMITER);
}
} else if (state == ScState::Logging) {
// If running and the revolution idx changes, terminate logging and wait for flush
@ -86,7 +86,7 @@ void publishSensorChartIfFull() {
return;
}
scLogging.appendPrintf(DELIMETER);
scLogging.appendPrintf(LOG_DELIMITER);
scheduleLogging(&scLogging);
state = ScState::Armed;

View File

@ -68,6 +68,8 @@
! when this happens.
#define FLASH_DATA_VERSION 10003
#define LOG_DELIMITER "`"
! all the sub-structures are going to be nested within the primary structure, that's
! needed to get a proper TunerStudio file

View File

@ -317,12 +317,12 @@ void printHistogram(Logging *logging, histogram_s *histogram) {
int len = hsReport(histogram, report);
logging->reset();
logging.append(PROTOCOL_MSG DELIMETER);
logging.append(PROTOCOL_MSG LOG_DELIMITER);
logging.appendPrintf("histogram %s *", histogram->name);
for (int i = 0; i < len; i++)
logging.appendPrintf("%d ", report[i]);
logging.appendPrintf("*");
logging.append(DELIMETER);
logging.append(LOG_DELIMITER);
scheduleLogging(logging);
#else
UNUSED(logging);

View File

@ -208,7 +208,7 @@ void efiPrintfInternal(const char *format, ...) {
va_end(ap);
// Ensure that the string is comma-terminated in case it overflowed
lineBuffer->buffer[sizeof(lineBuffer->buffer) - 1] = ',';
lineBuffer->buffer[sizeof(lineBuffer->buffer) - 1] = LOG_DELIMITER[0];
{
// Push the buffer in to the written list so it can be written back

View File

@ -9,8 +9,6 @@
#include <cstddef>
#include "rusefi_generated.h"
#define DELIMETER ","
class Logging;
void startLoggingProcessor();
@ -25,7 +23,7 @@ namespace priv
// "normal" logging messages need a header and footer, so put them in
// the format string at compile time
#define efiPrintf(fmt, ...) priv::efiPrintfInternal(PROTOCOL_MSG DELIMETER fmt DELIMETER, ##__VA_ARGS__)
#define efiPrintf(fmt, ...) priv::efiPrintfInternal(PROTOCOL_MSG LOG_DELIMITER fmt LOG_DELIMITER, ##__VA_ARGS__)
/**
* This is the legacy function to copy the contents of a local Logging object in to the output buffer

View File

@ -1450,6 +1450,7 @@ public class Fields {
public static final int LIS302DLCsPin_offset = 2043;
public static final int LIS302DLCsPinMode_offset = 2417;
public static final int LOAD_1_BYTE_PACKING_MULT = 2;
public static final String LOG_DELIMITER = "$";
public static final int log_format_e_LF_NATIVE = 0;
public static final int log_format_e_LM_MLV = 1;
public static final int logFormat_offset = 496;

View File

@ -20,7 +20,6 @@ import static com.devexperts.logging.Logging.getLogging;
public class EngineState {
private static final Logging log = getLogging(EngineState.class);
public static final String SEPARATOR = ",";
public static final String PACKING_DELIMITER = ":";
public static final Class<EngineState> ENGINE_STATE_CLASS = EngineState.class;
private final Object lock = new Object();
@ -38,7 +37,7 @@ public class EngineState {
public StringActionPair(String key, ValueCallback<String> second) {
super(key, second);
prefix = key.toLowerCase() + SEPARATOR;
prefix = key.toLowerCase() + Fields.LOG_DELIMITER;
}
@Override
@ -137,13 +136,13 @@ public class EngineState {
}
if (originalResponse.length() == response.length()) {
log.info("EngineState.unknown: " + response);
int keyEnd = response.indexOf(SEPARATOR);
int keyEnd = response.indexOf(Fields.LOG_DELIMITER);
if (keyEnd == -1) {
// discarding invalid line
return "";
}
String unknownKey = response.substring(0, keyEnd);
int valueEnd = response.indexOf(SEPARATOR, keyEnd + 1);
int valueEnd = response.indexOf(Fields.LOG_DELIMITER, keyEnd + 1);
if (valueEnd == -1) {
// discarding invalid line
return "";
@ -151,25 +150,25 @@ public class EngineState {
String value = response.substring(keyEnd, valueEnd);
log.info("Invalid key [" + unknownKey + "] value [" + value + "]");
// trying to process the rest of the line
response = response.substring(valueEnd + SEPARATOR.length());
response = response.substring(valueEnd + Fields.LOG_DELIMITER.length());
}
return response;
}
public static String skipToken(String string) {
int keyEnd = string.indexOf(SEPARATOR);
int keyEnd = string.indexOf(Fields.LOG_DELIMITER);
if (keyEnd == -1) {
// discarding invalid line
return "";
}
return string.substring(keyEnd + SEPARATOR.length());
return string.substring(keyEnd + Fields.LOG_DELIMITER.length());
}
public static String handleStringActionPair(String response, StringActionPair pair, EngineStateListener listener) {
if (startWithIgnoreCase(response, pair.prefix)) {
String key = pair.first;
int beginIndex = key.length() + 1;
int endIndex = response.indexOf(SEPARATOR, beginIndex);
int endIndex = response.indexOf(Fields.LOG_DELIMITER, beginIndex);
if (endIndex == -1)
endIndex = response.length();
@ -180,7 +179,7 @@ public class EngineState {
response = response.substring(endIndex);
if (!response.isEmpty())
response = response.substring(1); // skipping the separator
response = response.substring(1); // skipping the Fields.LOG_DELIMITER
return response;
}
return response;