diff --git a/STM32/CM7/Core/Inc/global_state.h b/STM32/CM7/Core/Inc/global_state.h index d26ba16..fcdcef3 100644 --- a/STM32/CM7/Core/Inc/global_state.h +++ b/STM32/CM7/Core/Inc/global_state.h @@ -1,7 +1,7 @@ // Copyright (C) 2026 Pierre Barbier // Copyright (C) 2026 Association Exergie // SPDX-License-Identifier: GPL-3.0-or-later - +#pragma once #include #include diff --git a/STM32/CM7/Core/Src/tasks/cam.c b/STM32/CM7/Core/Src/tasks/cam.c index 2a8b552..c2323a9 100644 --- a/STM32/CM7/Core/Src/tasks/cam.c +++ b/STM32/CM7/Core/Src/tasks/cam.c @@ -6,6 +6,7 @@ #include "cmsis_os2.h" #include "macros.h" #include "main.h" +#include "global_state.h" #include "ring_buffer.h" #include "tasks.h" @@ -17,7 +18,10 @@ void camHandler(void *argument) { ringBufferRead(&state_g.cam_RB, 0)); // FILTERS - + if (CAM_TRIGD) { + ringBufferRevert(state_g.cam_RB,1); + return; + } state_g.cam_state = CAM_TRIGD; state_g.cam_miss_ctr = 0; switch (state_g.sync_state) { diff --git a/STM32/CM7/Core/Src/tasks/crank.c b/STM32/CM7/Core/Src/tasks/crank.c index d2eecd4..6e14295 100644 --- a/STM32/CM7/Core/Src/tasks/crank.c +++ b/STM32/CM7/Core/Src/tasks/crank.c @@ -15,7 +15,6 @@ void crankHandler(void *argument) { DEBUG_LOG("Crank pulse detected at: %lu\n\r", ringBufferRead(&state_g.crank_RB, 0)); // FILTER - // INCREMENT SWITCH switch (state_g.crank_state) { case CYCLE_COMPRESSION: {