From 17be0a2a8c8655a2cb6f7ce1c3cac91260cfac5a Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 25 Aug 2023 14:14:09 +0200 Subject: [PATCH] home to correct direction + go back to 20kHz interrupt --- Core/Src/home_screen.c | 3 ++- Core/Src/main.c | 2 +- PSE.ioc | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Core/Src/home_screen.c b/Core/Src/home_screen.c index 09833fe..097f9dc 100644 --- a/Core/Src/home_screen.c +++ b/Core/Src/home_screen.c @@ -69,9 +69,10 @@ static void unit_home_handler(lv_event_t * e){ if(code == LV_EVENT_CLICKED) { pse_unit* unit = lv_event_get_user_data(e); pse_stepper_conf* c = unit->stepper_conf; + if(c->steps_counter == 0) return; c->stopAtHome = 1; c->step_max = 1; - pse_sp_set_dir(c, 0); + pse_sp_set_dir(c, c->steps_counter < 0); pse_sp_start_axis(c); } } diff --git a/Core/Src/main.c b/Core/Src/main.c index e6de458..8420fe7 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -387,7 +387,7 @@ static void MX_TIM4_Init(void) htim4.Instance = TIM4; htim4.Init.Prescaler = 64; htim4.Init.CounterMode = TIM_COUNTERMODE_UP; - htim4.Init.Period = 100; + htim4.Init.Period = 50; htim4.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; htim4.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE; if (HAL_TIM_Base_Init(&htim4) != HAL_OK) diff --git a/PSE.ioc b/PSE.ioc index 172b689..27f3e56 100644 --- a/PSE.ioc +++ b/PSE.ioc @@ -312,7 +312,7 @@ SDIO.HardwareFlowControl=SDIO_HARDWARE_FLOW_CONTROL_DISABLE SDIO.IPParameters=ClockDiv,HardwareFlowControl TIM4.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE TIM4.IPParameters=Prescaler,Period,AutoReloadPreload -TIM4.Period=100 +TIM4.Period=50 TIM4.Prescaler=64 USART1.IPParameters=VirtualMode USART1.VirtualMode=VM_ASYNC