From 0d1b2a9e6b47bf4850a69b5daeb7eb17eb0215a7 Mon Sep 17 00:00:00 2001 From: guanjiao <sqrgj@163.com> Date: 星期六, 15 九月 2018 20:44:01 +0800 Subject: [PATCH] 修改滤波参数 --- 源码/核心板/Src/main.c | 82 +++++++--------------------------------- 1 files changed, 15 insertions(+), 67 deletions(-) diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" index b0e5590..ea6efee 100644 --- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" +++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/main.c" @@ -6,17 +6,12 @@ #include "beep.h" #include "dw_driver.h" #include "dw_app.h" -#include "filters.h" #include "stm32f10x_it.h" #include "serial_at_cmd_app.h" #include "global_param.h" //#define WORK_MODE_TAG #define WORK_MODE_ANCHOR -#define START_ALARM_DIST_CM 200 -#define BEEM_ON_TIME_MS 200 - -float dis_after_filter = 500; void Device_Init(void) { @@ -24,6 +19,9 @@ SystemInit(); Nvic_Init(); Systick_Init(); +#ifdef WORK_MODE_TAG + RTC_Configuration(); +#endif Led_Init(); Beep_Init(); DW_GPIO_Init(); @@ -49,83 +47,33 @@ * * @return none */ + int main(void) { - LPFilter_Frac* p_Dis_Filter; - + Device_Init(); Program_Init(); Dw1000_Init(); - p_Dis_Filter = New_LP_Frac(0.7); +#ifdef WORK_MODE_TAG + tag_sleep_configuraion(); +#endif + /* Loop forever initiating ranging exchanges. */ while(1) { #ifdef WORK_MODE_TAG + if(g_start_send_flag) + { + g_start_send_flag = 0; Tag_App(); + } + RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); + PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI); #else Anchor_App(); - #endif - - //除UWB之外的其他代码... - dis_after_filter = LP_Frac_Update(p_Dis_Filter, dist_cm); - - if(dis_after_filter <= g_com_map[ALARM_DISTANCE]) - { -// g_beep_off_time = (uint32_t)dis_after_filter * 10; -// if(g_beep_off_time <= 0) -// g_beep_off_time = 0; -// g_beep_on_time = BEEM_ON_TIME_MS; - switch(g_com_map[ALARM_DEV]) - { - case 0: - BEEP2_ON; - BEEP_OFF; - OUT2_OFF; - break; - case 1: - BEEP_ON; - BEEP2_OFF; - OUT2_OFF; - break; - case 2: - OUT2_ON; - BEEP_OFF; - BEEP2_OFF; - break; - default: - BEEP2_ON; - BEEP_ON; - OUT2_ON; - break; - } - } - else - { -// g_beep_on_time = 0; -// g_beep_off_time = 0; - switch(g_com_map[ALARM_DEV]) - { - case 0: - BEEP2_OFF; - break; - case 1: - BEEP_OFF; - break; - case 2: - OUT2_OFF; - break; - default: - BEEP2_OFF; - BEEP_OFF; - OUT2_OFF; - break; - } - } - - } } -- Gitblit v1.9.3