mirror of https://github.com/rusefi/rusefi-1.git
console composite logger
This commit is contained in:
parent
3705c9522f
commit
347413e44b
|
@ -51,6 +51,10 @@ static bool coil = false;
|
||||||
// same about injectors
|
// same about injectors
|
||||||
static bool injector = false;
|
static bool injector = false;
|
||||||
|
|
||||||
|
int getCompositeRecordCount() {
|
||||||
|
return NextIdx;
|
||||||
|
}
|
||||||
|
|
||||||
static void SetNextCompositeEntry(efitick_t timestamp, bool trigger1, bool trigger2,
|
static void SetNextCompositeEntry(efitick_t timestamp, bool trigger1, bool trigger2,
|
||||||
bool isTDC DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
bool isTDC DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
uint32_t nowUs = NT2US(timestamp);
|
uint32_t nowUs = NT2US(timestamp);
|
||||||
|
@ -159,6 +163,12 @@ void EnableToothLogger() {
|
||||||
tsOutputChannels.toothLogReady = true;
|
tsOutputChannels.toothLogReady = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EnableToothLoggerIfNotEnabled() {
|
||||||
|
if (!ToothLoggerEnabled) {
|
||||||
|
EnableToothLogger();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DisableToothLogger() {
|
void DisableToothLogger() {
|
||||||
ToothLoggerEnabled = false;
|
ToothLoggerEnabled = false;
|
||||||
tsOutputChannels.toothLogReady = false;
|
tsOutputChannels.toothLogReady = false;
|
||||||
|
|
|
@ -13,6 +13,10 @@
|
||||||
#include "rusefi_enums.h"
|
#include "rusefi_enums.h"
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
|
||||||
|
int getCompositeRecordCount();
|
||||||
|
|
||||||
|
void EnableToothLoggerIfNotEnabled();
|
||||||
|
|
||||||
// Enable the tooth logger - this clears the buffer starts logging
|
// Enable the tooth logger - this clears the buffer starts logging
|
||||||
void EnableToothLogger();
|
void EnableToothLogger();
|
||||||
|
|
||||||
|
|
|
@ -749,6 +749,8 @@ bool handlePlainCommand(ts_channel_s *tsChannel, uint8_t command) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int transmitted = 0;
|
||||||
|
|
||||||
|
|
||||||
int tunerStudioHandleCrcCommand(ts_channel_s *tsChannel, char *data, int incomingPacketSize) {
|
int tunerStudioHandleCrcCommand(ts_channel_s *tsChannel, char *data, int incomingPacketSize) {
|
||||||
ScopePerf perf(PE::TunerStudioHandleCrcCommand);
|
ScopePerf perf(PE::TunerStudioHandleCrcCommand);
|
||||||
|
@ -842,6 +844,26 @@ int tunerStudioHandleCrcCommand(ts_channel_s *tsChannel, char *data, int incomin
|
||||||
sendOkResponse(tsChannel, TS_CRC);
|
sendOkResponse(tsChannel, TS_CRC);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case TS_GET_COMPOSITE_BUFFER_DONE_DIFFERENTLY:
|
||||||
|
{
|
||||||
|
const uint8_t* const buffer = GetToothLoggerBuffer().Buffer;
|
||||||
|
|
||||||
|
const uint8_t* const start = buffer + COMPOSITE_PACKET_SIZE * transmitted;
|
||||||
|
|
||||||
|
int currentEnd = getCompositeRecordCount();
|
||||||
|
|
||||||
|
if (currentEnd > transmitted) {
|
||||||
|
// more normal case - tail after head
|
||||||
|
sr5SendResponse(tsChannel, TS_CRC, start, COMPOSITE_PACKET_SIZE * (currentEnd - transmitted));
|
||||||
|
transmitted = currentEnd;
|
||||||
|
} else {
|
||||||
|
// we are here if tail of buffer has reached the end of buffer and re-started from the start of buffer
|
||||||
|
// sending end of the buffer, next transmission would take care of the rest
|
||||||
|
sr5SendResponse(tsChannel, TS_CRC, start, COMPOSITE_PACKET_SIZE * (COMPOSITE_PACKET_COUNT - transmitted));
|
||||||
|
transmitted = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case TS_GET_LOGGER_GET_BUFFER:
|
case TS_GET_LOGGER_GET_BUFFER:
|
||||||
{
|
{
|
||||||
auto toothBuffer = GetToothLoggerBuffer();
|
auto toothBuffer = GetToothLoggerBuffer();
|
||||||
|
|
Loading…
Reference in New Issue