Skip to content

Commit

Permalink
minor cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
mck1117 committed Sep 15, 2024
1 parent 1d37f0e commit f73becd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 4 additions & 6 deletions firmware/controllers/trigger/trigger_central.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ static angle_t wrapVvt(angle_t vvtPosition, int period) {
return vvtPosition;
}

static void logVvtFront(bool isImportantFront, bool isRising, efitick_t nowNt, int index) {
static void logVvtFront(bool isRising, efitick_t nowNt, int index) {
// If we care about both edges OR displayLogicLevel is set, log every front exactly as it is
addEngineSnifferVvtEvent(index, isRising);

Expand All @@ -217,6 +217,8 @@ void hwHandleVvtCamSignal(bool isRising, efitick_t nowNt, int index) {
// Invert if so configured
isRising ^= engineConfiguration->invertCamVVTSignal;

logVvtFront(isRising, nowNt, index);

int bankIndex = index / CAMS_PER_BANK;
int camIndex = index % CAMS_PER_BANK;
if (isRising) {
Expand All @@ -234,11 +236,7 @@ void hwHandleVvtCamSignal(bool isRising, efitick_t nowNt, int index) {

// Non real decoders only use the rising edge
bool vvtUseOnlyRise = !isVvtWithRealDecoder || vvtShape.useOnlyRisingEdges;
bool isImportantFront = !vvtUseOnlyRise || isRising;

logVvtFront(isImportantFront, isRising, nowNt, index);

if (!isImportantFront) {
if (vvtUseOnlyRise && !isRising) {
// This edge is unimportant, ignore it.
return;
}
Expand Down
4 changes: 1 addition & 3 deletions firmware/util/loggingcentral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ const char* swapOutputBuffers(size_t* actualOutputBufferSize) {
chibios_rt::MutexLocker lock(logBufferMutex);

// Swap buffers under lock
auto temp = writeBuffer;
writeBuffer = readBuffer;
readBuffer = temp;
std::swap(writeBuffer, readBuffer);

// Reset the front buffer - it's now empty
writeBuffer->reset();
Expand Down

0 comments on commit f73becd

Please sign in to comment.