14 #if !EFI_SHAFT_POSITION_INPUT
15 fail(
"EFI_SHAFT_POSITION_INPUT required to have EFI_EMULATE_POSITION_SENSORS")
37 #include "logicdata.h"
39 static std::vector<CompositeEvent>
events;
48 event.timestamp = timestamp;
80 #if EFI_TUNER_STUDIO && (EFI_PROD_CODE || EFI_SIMULATOR)
88 chibios_rt::CriticalSectionLocker csl;
124 chibios_rt::CriticalSectionLocker csl;
139 if (msg == MSG_TIMEOUT) {
149 chibios_rt::CriticalSectionLocker csl;
168 chibios_rt::CriticalSectionLocker csl;
171 criticalAssertVoid(msg == MSG_OK,
"Composite logger post to free buffer fail");
186 buffer->startTime.reset(timestamp);
197 chibios_rt::CriticalSectionLocker csl;
206 size_t idx =
buffer->nextIdx;
207 auto nextIdx = idx + 1;
208 buffer->nextIdx = nextIdx;
213 uint32_t nowUs = NT2US(timestamp);
228 bool bufferTimedOut =
buffer->startTime.hasElapsedSec(5);
231 if (bufferFull || bufferTimedOut) {
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()
UNUSED(samplingTimeSeconds)
static chibios_rt::Mailbox< CanFrameData *, canFrameCount > filledBuffers
static chibios_rt::Mailbox< CanFrameData *, canFrameCount > freeBuffers
@ SHAFT_SECONDARY_FALLING
void LogTriggerInjectorState(efitick_t timestamp, bool state)
void LogTriggerTooth(trigger_event_e tooth, efitick_t timestamp)
static bool currentTrigger1
void DisableToothLogger()
static bool currentTrigger2
static CompositeBuffer * GetToothLoggerBufferImpl(sysinterval_t timeout)
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
const std::vector< CompositeEvent > & getCompositeEvents()
static bool currentInjectorState
CompositeBuffer * GetToothLoggerBufferBlocking()
void LogTriggerCoilState(efitick_t timestamp, bool state)
static bool currentCoilState
static CompositeBuffer * currentBuffer
static CompositeBuffer * findBuffer(efitick_t timestamp)
static chibios_rt::Mailbox< CompositeBuffer *, BUFFER_COUNT > freeBuffers CCM_OPTIONAL
CompositeBuffer * GetToothLoggerBufferNonblocking()
void ReturnToothLoggerBuffer(CompositeBuffer *buffer)
bool IsToothLoggerEnabled()
static constexpr size_t BUFFER_COUNT
static std::vector< CompositeEvent > events
void EnableToothLoggerIfNotEnabled()
void SetNextCompositeEntry(efitick_t timestamp)
static CompositeBuffer * buffers
static BigBufferHandle buffer