From 0e91bca2aaebc14a6ea8ef97433d4a7953876ffa Mon Sep 17 00:00:00 2001 From: yincheng.zhong <634916154@qq.com> Date: 星期三, 29 三月 2023 15:08:23 +0800 Subject: [PATCH] Merge branch '防撞' of http://47.108.70.204:60062/r/XRange_Tag into 防撞 --- Src/main.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Src/main.c b/Src/main.c index b937b7c..89182e9 100644 --- a/Src/main.c +++ b/Src/main.c @@ -188,6 +188,7 @@ if(HAL_GPIO_ReadPin(INPUT_5V_GPIO_Port,INPUT_5V_Pin)) { nomove_count = 0; + bat_percent=Get_Battary(); if(state5v==0) { state5v=1; @@ -282,7 +283,7 @@ { case 1: - HAL_GPIO_WritePin(GPIOB, MOTOR_Pin, GPIO_PIN_SET); + HAL_GPIO_WritePin(GPIOB, MOTOR_Pin, GPIO_PIN_SET); GPIO_InitStruct.Pin = MOTOR_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; @@ -295,6 +296,7 @@ break; } } +int16_t g_commap_antdelay; u8 active_flag,nomovesleeptime; void Program_Init(void) { float temp; @@ -306,9 +308,9 @@ hardware_pici = STMFLASH_ReadHalfWord(FLASH_HARDWARE_VERSION_MAP+2); hardware_type = STMFLASH_ReadHalfWord(FLASH_HARDWARE_VERSION_MAP+4); //deca_sleep(1000); - g_com_map[VERSION] = 0x011a; + g_com_map[VERSION] = (1<<8)|33; active_flag = g_com_map[ACTIVE_INDEX]; - module_power = g_com_map[POWER]; + module_power = g_com_map[POWER]; imu_enable=g_com_map[IMU_ENABLE]; motor_enable=g_com_map[MOTOR_ENABLE]; @@ -342,7 +344,11 @@ {module_power=67;} if(module_power<0) {module_power=0;} - + if(g_com_map[ANT_LENGTH]>10000) + { + g_com_map[ANT_LENGTH] = 0; + } + g_commap_antdelay = -g_com_map[DIST_OFFSET]; current_slotnum=1; current_time=GetLPTime(); if (HAL_LPTIM_TimeOut_Start_IT(&hlptim1, LPTIMER_1S_COUNT, slot_startcount) != HAL_OK) //system time is 1010ms 1 puls=30.518us @@ -423,7 +429,7 @@ /* USER CODE BEGIN 2 */ LED_LG_ON; Program_Init(); - LIS3DH_Data_Init(); + Accelerometer_Init(); Dw1000_Init(); Dw1000_App_Init(); HardWareTypeDiffConfig(); -- Gitblit v1.9.3