From 1771904eac1a21e3e6d6e2e08eaec856366f386f Mon Sep 17 00:00:00 2001 From: Pierre Barbier Date: Wed, 3 Jun 2026 13:52:01 +0200 Subject: [PATCH] Added Injection time and a phase macro --- STM32/CM7/Core/Inc/macros.h | 1 + STM32/CM7/Core/Src/tasks/crank.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/STM32/CM7/Core/Inc/macros.h b/STM32/CM7/Core/Inc/macros.h index d76b5da..f09fa86 100644 --- a/STM32/CM7/Core/Inc/macros.h +++ b/STM32/CM7/Core/Inc/macros.h @@ -5,6 +5,7 @@ #include "global_state.h" #ifdef DEBUG #include "SEGGER_RTT.h" +#define INJECTION_PHASE 0 #define DEBUG_LOG(fmt, ...) SEGGER_RTT_printf(0, fmt "\n", ##__VA_ARGS__) #else #define DEBUG_LOG(fmt, ...) \ diff --git a/STM32/CM7/Core/Src/tasks/crank.c b/STM32/CM7/Core/Src/tasks/crank.c index 8d74158..1c99af9 100644 --- a/STM32/CM7/Core/Src/tasks/crank.c +++ b/STM32/CM7/Core/Src/tasks/crank.c @@ -72,6 +72,9 @@ void crankHandler(void *argument) { uint32_t d_spark = d1a * (45 - SPARK_ADVANCE) / 180; uint32_t t_spark = CRANK(0) + d_spark; // TODO: schedule spark + } else if (state_g.crank_state == CYCLE_EXHAUST) { + uint32_t t_injection = CRANK(0) + (45+INJECTION_PHASE) * (CRANK(4) - CRANK(0)) / 720; + //TODO Schedule injection } } }