14#if !EFI_SHAFT_POSITION_INPUT
15 fail(
"EFI_SHAFT_POSITION_INPUT required to have EFI_EMULATE_POSITION_SENSORS")
38void jsonTraceEntry(
const char* name,
int pid,
bool isEnter, efitick_t timestamp) {
39extern FILE *jsonTrace;
40 if (jsonTrace !=
nullptr) {
41 fprintf(jsonTrace,
",\n");
42 fprintf(jsonTrace,
"{\"name\":\"%s\",\"ph\":\"%s\",\"tid\":0,\"pid\":%d,\"ts\":%f}",
52static std::vector<CompositeEvent>
events;
61 event.timestamp = timestamp;
93#if EFI_TUNER_STUDIO && (EFI_PROD_CODE || EFI_SIMULATOR)
101 chibios_rt::CriticalSectionLocker csl;
137 chibios_rt::CriticalSectionLocker csl;
152 if (msg == MSG_TIMEOUT) {
162 chibios_rt::CriticalSectionLocker csl;
181 chibios_rt::CriticalSectionLocker csl;
184 criticalAssertVoid(msg == MSG_OK,
"Composite logger post to free buffer fail");
199 buffer->startTime.reset(timestamp);
210 chibios_rt::CriticalSectionLocker csl;
219 size_t idx =
buffer->nextIdx;
220 auto nextIdx = idx + 1;
221 buffer->nextIdx = nextIdx;
223 if (idx < efi::size(
buffer->buffer)) {
226 uint32_t nowUs = NT2US(timestamp);
239 bool bufferFull = nextIdx >= efi::size(
buffer->buffer);
241 bool bufferTimedOut =
buffer->startTime.hasElapsedSec(5);
244 if (bufferFull || bufferTimedOut) {
258#define JSON_TRG_PID 4
259#define JSON_CAM_PID 10
BigBufferHandle getBigBuffer(BigBufferUser user)
const TBuffer * get() const
TriggerCentral triggerCentral
TunerStudioOutputChannels outputChannels
PrimaryTriggerDecoder triggerState
bool getShaftSynchronized()
uint32_t SWAP_UINT32(uint32_t x)
TriggerCentral * getTriggerCentral()
static Engine *const engine
UNUSED(samplingTimeSeconds)
static chibios_rt::Mailbox< CanFrameData *, canFrameCount > filledBuffers
static chibios_rt::Mailbox< CanFrameData *, canFrameCount > freeBuffers
state("state", SensorCategory.SENSOR_INPUTS, FieldType.INT8, 1739, 1.0, -1.0, -1.0, "")
@ SHAFT_SECONDARY_FALLING
static bool currentTrigger1
void jsonTraceEntry(const char *name, int pid, bool isEnter, efitick_t timestamp)
void DisableToothLogger()
static CompositeBuffer * GetToothLoggerBufferImpl(sysinterval_t timeout)
static bool currentTrigger2
void LogTriggerTopDeadCenter(efitick_t timestamp)
static volatile bool ToothLoggerEnabled
fail("EFI_SHAFT_POSITION_INPUT required to have EFI_EMULATE_POSITION_SENSORS") static_assert(sizeof(composite_logger_s)
static void setToothLogReady(bool value)
static BigBufferHandle bufferHandle
static bool currentInjectorState
void LogTriggerInjectorState(efitick_t timestamp, size_t index, bool state)
void LogTriggerCoilState(efitick_t timestamp, size_t index, bool state)
static bool currentCoilState
static CompositeBuffer * currentBuffer
void LogTriggerCamTooth(bool isRising, efitick_t timestamp, int index)
const std::vector< CompositeEvent > & getCompositeEvents()
static chibios_rt::Mailbox< CompositeBuffer *, BUFFER_COUNT > freeBuffers CCM_OPTIONAL
void LogTriggerSync(bool isSync, efitick_t timestamp)
CompositeBuffer * GetToothLoggerBufferNonblocking()
void ReturnToothLoggerBuffer(CompositeBuffer *buffer)
bool IsToothLoggerEnabled()
static CompositeBuffer * findBuffer(efitick_t timestamp)
static constexpr size_t BUFFER_COUNT
CompositeBuffer * GetToothLoggerBufferBlocking()
static std::vector< CompositeEvent > events
void EnableToothLoggerIfNotEnabled()
void SetNextCompositeEntry(efitick_t timestamp)
static CompositeBuffer * buffers
static BigBufferHandle buffer