diff --git a/App/Src/anemometer_dev.c b/App/Src/anemometer_dev.c index 0bd7211..bd56d62 100644 --- a/App/Src/anemometer_dev.c +++ b/App/Src/anemometer_dev.c @@ -183,7 +183,8 @@ float32_t cal_tof(q15_t* x,uint32_t len) //echo_dt = (x[i-1]-x[i+1])/2.0/(x[i-1]-2*x[i]+x[i+1]); echo_dt = find_maxValPosition_by_sinInterpolation(x[i-1],x[i],x[i+1]); echo_p = (float32_t)i+echo_dt-0*(float32_t)(ADC_SAMP_RATE_MHz/DRIVE_FREQ_MHz); - + + return echo_p; } // 如果15% ~45%之间的数据未找到,则找45-80%的顶点。 diff --git a/Core/Src/adc.c b/Core/Src/adc.c index 6cabcb4..6ac61b5 100644 --- a/Core/Src/adc.c +++ b/Core/Src/adc.c @@ -76,7 +76,7 @@ void MX_ADC1_Init(void) */ sConfig.Channel = ADC_CHANNEL_1; sConfig.Rank = ADC_REGULAR_RANK_1; - sConfig.SamplingTime = ADC_SAMPLETIME_12CYCLES_5; + sConfig.SamplingTime = ADC_SAMPLETIME_6CYCLES_5; sConfig.SingleDiff = ADC_SINGLE_ENDED; sConfig.OffsetNumber = ADC_OFFSET_NONE; sConfig.Offset = 0; diff --git a/Core/Src/stm32l4xx_it.c b/Core/Src/stm32l4xx_it.c index 94572a0..be42d77 100644 --- a/Core/Src/stm32l4xx_it.c +++ b/Core/Src/stm32l4xx_it.c @@ -95,7 +95,8 @@ void NMI_Handler(void) void HardFault_Handler(void) { /* USER CODE BEGIN HardFault_IRQn 0 */ - + __iar_builtin_set_FAULTMASK(1); + NVIC_SystemReset(); /* USER CODE END HardFault_IRQn 0 */ while (1) { diff --git a/EWARM/micro_climate.ewp b/EWARM/micro_climate.ewp index 226fbf4..5af3410 100644 --- a/EWARM/micro_climate.ewp +++ b/EWARM/micro_climate.ewp @@ -676,7 +676,7 @@