From 30cc41dc38e839eef43a47748d713a64bdd06d8c Mon Sep 17 00:00:00 2001 From: Theodor Chikin Date: Thu, 25 Jun 2026 15:08:27 +0300 Subject: [PATCH] save --- Src/main.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Src/main.c b/Src/main.c index 8644d57..c7ec041 100644 --- a/Src/main.c +++ b/Src/main.c @@ -184,7 +184,9 @@ int main(void) // TIM4 -> ARR = 53; // for 1.735 MHz. It`s the highest frequency for correct ADC work. At higher freq artifacts (voltage peaks) appears. //TIM4 -> ARR = 100; // for 1.735 MHz. It`s the highest frequency for correct ADC work. At higher freq artifacts (voltage peaks) appears. - TIM4 -> ARR = 37; //for 2.42 MHz. Highest freq for stm_ADC based on stm32G431-- 2.8 MHz + //TIM4 -> ARR = 37; //for 2.42 MHz. Highest freq for stm_ADC based on stm32G431-- 2.8 MHz + + TIM4 -> ARR = 92*8 -1; //for 125 kHz TIM4 -> CCR3 = (TIM4 -> ARR +1)/2 - 1; @@ -441,8 +443,10 @@ int main(void) while(1); uint16_t step_counter = 0; - uint16_t trigger_counter = 0; - uint16_t trigger_step = (uint8_t )((task.max_param - task.current_param)/task.delta_param * 10); + uint16_t trigger_counter = 3; + //uint16_t trigger_step = (uint8_t )((task.max_param - task.current_param)/task.delta_param * 10); + uint16_t trigger_step = 50; + uint16_t task_sheduler = 0; @@ -495,12 +499,12 @@ int main(void) //HAL_GPIO_WritePin(GPIOG, GPIO_PIN_9, GPIO_PIN_RESET); //* if (step_counter % trigger_step == 0){ //trigger at every 60 step - OUT_trigger(trigger_counter); + //OUT_trigger(trigger_counter); ++trigger_counter; } ++step_counter; - HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_RESET); //stop trigger pulse + //HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_RESET); //stop trigger pulse //*/ /* ++task_sheduler; @@ -539,6 +543,9 @@ int main(void) HAL_GPIO_WritePin(OUT_6_GPIO_Port, OUT_6_Pin, GPIO_PIN_RESET); HAL_GPIO_WritePin(OUT_7_GPIO_Port, OUT_7_Pin, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_RESET); //stop trigger pulse + + task.current_param = task.min_param; Set_LTEC(TT_CHANGE_CURR_1, task.current_param); if (task.tau > 3) @@ -2269,6 +2276,7 @@ void OUT_trigger(uint8_t out_n) case 3: HAL_GPIO_WritePin(OUT_3_GPIO_Port, OUT_3_Pin, GPIO_PIN_SET); + HAL_GPIO_WritePin(OUT_3_GPIO_Port, OUT_3_Pin, GPIO_PIN_RESET); break;