From 1d465c1412f2d6ce5a95880b8715a1b7f06473b6 Mon Sep 17 00:00:00 2001 From: ahiuchingau <20424172+ahiuchingau@users.noreply.github.com> Date: Wed, 7 Aug 2024 18:15:52 -0400 Subject: [PATCH] well two out of three motors are now stepping --- .../firmware/motor_control/motor_hardware.c | 4 ++-- .../flex-stacker/firmware/ui/freertos_ui_task.cpp | 2 +- stm32-modules/flex-stacker/firmware/ui/ui_hardware.c | 4 ++-- .../include/flex-stacker/firmware/motor_interrupt.hpp | 10 +++++----- .../flex-stacker/flex-stacker/motor_driver_task.hpp | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/stm32-modules/flex-stacker/firmware/motor_control/motor_hardware.c b/stm32-modules/flex-stacker/firmware/motor_control/motor_hardware.c index 4cee69446..3f3dc4eab 100644 --- a/stm32-modules/flex-stacker/firmware/motor_control/motor_hardware.c +++ b/stm32-modules/flex-stacker/firmware/motor_control/motor_hardware.c @@ -219,8 +219,8 @@ void MX_TIM3_Init(void) { void motor_hardware_interrupt_init(void){ MX_TIM17_Init(); -// MX_TIM20_Init(); -// MX_TIM3_Init(); + MX_TIM20_Init(); + MX_TIM3_Init(); } void motor_hardware_init(void){ diff --git a/stm32-modules/flex-stacker/firmware/ui/freertos_ui_task.cpp b/stm32-modules/flex-stacker/firmware/ui/freertos_ui_task.cpp index 9f2f3513a..a69376669 100644 --- a/stm32-modules/flex-stacker/firmware/ui/freertos_ui_task.cpp +++ b/stm32-modules/flex-stacker/firmware/ui/freertos_ui_task.cpp @@ -1,7 +1,7 @@ #include "firmware/freertos_tasks.hpp" #include "firmware/ui_hardware.h" -static constexpr uint32_t HALF_SECOND = 100; +static constexpr uint32_t HALF_SECOND = 500; namespace ui_control_task { diff --git a/stm32-modules/flex-stacker/firmware/ui/ui_hardware.c b/stm32-modules/flex-stacker/firmware/ui/ui_hardware.c index f9f01ebaa..cf57bde44 100644 --- a/stm32-modules/flex-stacker/firmware/ui/ui_hardware.c +++ b/stm32-modules/flex-stacker/firmware/ui/ui_hardware.c @@ -13,6 +13,6 @@ void ui_hardware_set_heartbeat_led(bool setting) { HAL_GPIO_WritePin(nSTATUS_LED_GPIO_Port, nSTATUS_LED_Pin, setting ? GPIO_PIN_SET : GPIO_PIN_RESET); - HAL_GPIO_WritePin(GPIOC, GPIO_PIN_2, - setting ? GPIO_PIN_SET : GPIO_PIN_RESET); +// HAL_GPIO_WritePin(GPIOC, GPIO_PIN_2, +// setting ? GPIO_PIN_SET : GPIO_PIN_RESET); } diff --git a/stm32-modules/include/flex-stacker/firmware/motor_interrupt.hpp b/stm32-modules/include/flex-stacker/firmware/motor_interrupt.hpp index e30e80e39..f6a09f85d 100644 --- a/stm32-modules/include/flex-stacker/firmware/motor_interrupt.hpp +++ b/stm32-modules/include/flex-stacker/firmware/motor_interrupt.hpp @@ -9,11 +9,11 @@ class MotorInterruptController { public: MotorInterruptController(MotorID m_id): m_id(m_id) {} void tick() { -// unstep_motor(m_id); -// step_count = (step_count + 1) % 20000; -// if (step_count == 0) { -// step_motor(m_id); -// } + unstep_motor(m_id); + step_count = (step_count + 1) % 20000; + if (step_count == 0) { + step_motor(m_id); + } } private: MotorID m_id; diff --git a/stm32-modules/include/flex-stacker/flex-stacker/motor_driver_task.hpp b/stm32-modules/include/flex-stacker/flex-stacker/motor_driver_task.hpp index 5a000d7a0..1c5640e6f 100644 --- a/stm32-modules/include/flex-stacker/flex-stacker/motor_driver_task.hpp +++ b/stm32-modules/include/flex-stacker/flex-stacker/motor_driver_task.hpp @@ -67,7 +67,7 @@ static constexpr tmc2160::TMC2160RegisterMap motor_x_config{ .hstrt = 0b111, .hend = 0b1001, .tbl = 0b1, - .mres = 0b100}, + .mres = 0b1000}, .coolconf = {.semin = 0b11, .semax = 0b100}, .pwmconf = {.pwm_ofs = 0x1F, .pwm_grad = 0x18,