From 25f255590b0a999fe9dd07e440a59d6305bbebbd Mon Sep 17 00:00:00 2001 From: dd060606 Date: Mon, 10 Mar 2025 14:24:37 +0100 Subject: [PATCH] fix: build issues --- Core/Src/functions.cpp | 8 +++++++- Core/Src/main.cpp | 4 ++-- Core/Startup/startup_stm32l073rztx.s | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Core/Src/functions.cpp b/Core/Src/functions.cpp index bc1b2b7..8e469b5 100644 --- a/Core/Src/functions.cpp +++ b/Core/Src/functions.cpp @@ -3,6 +3,9 @@ #include "functions.h" #include "motors.h" +#include "encoder.h" + +extern Encoder encoder1; uint32_t lastTick = 0; // Variable pour mémoriser l'heure de la dernière action @@ -25,9 +28,12 @@ void Cpploop(Motor *motor){ //On actualise toute les 10ms et on effectue tous les controles périodiques if(isDelayPassed(10)) { - + if(encoder1.getTotalDistance() > 10) { + motor->stop(); + } //On met à jour le statut des moteurs motor->update(); + } diff --git a/Core/Src/main.cpp b/Core/Src/main.cpp index c40f39d..6dc1488 100644 --- a/Core/Src/main.cpp +++ b/Core/Src/main.cpp @@ -116,7 +116,7 @@ int main(void) { Motor motor(TIM3); //On fait accélérer les moteurs - //motor.accelerer(626); + motor.accelerer(300); /* USER CODE END 2 */ @@ -127,7 +127,7 @@ int main(void) { /* USER CODE BEGIN 3 */ - //Cpploop(&motor); + Cpploop(&motor); } /* USER CODE END 3 */ diff --git a/Core/Startup/startup_stm32l073rztx.s b/Core/Startup/startup_stm32l073rztx.s index 09131b5..5879b41 100644 --- a/Core/Startup/startup_stm32l073rztx.s +++ b/Core/Startup/startup_stm32l073rztx.s @@ -48,7 +48,7 @@ defined in linker script */ .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: - ldr r0, =_estack + ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/