From 4691492f913d0730703f8fcdacd0a02d455d65a1 Mon Sep 17 00:00:00 2001 From: yincheng.zhong <634916154@qq.com> Date: 星期一, 29 一月 2024 10:37:32 +0800 Subject: [PATCH] 国新智能V1.7 --- Src/main.c | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Src/main.c b/Src/main.c index a83bbd0..a7d8767 100644 --- a/Src/main.c +++ b/Src/main.c @@ -33,7 +33,7 @@ #define NSH1 0x0001 #define GP 0x0002 #define FLASH_HARDWARE_VERSION_MAP (uint32_t)0x08004F00 //硬件版本号和批次信息位置 -//#define DEBUG_MODE +#define DEBUG_MODE /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ @@ -289,7 +289,7 @@ 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] = (1<<8)|39; + g_com_map[VERSION] = (1<<8)|7; active_flag = g_com_map[ACTIVE_INDEX]; module_power = g_com_map[POWER]; imu_enable=g_com_map[IMU_ENABLE]; @@ -303,7 +303,7 @@ slot_startcount=tyncpoll_time*1000/LPTIMER_LSB; lastpoll_time=tyncpoll_time; tag_frequency = 1000/g_com_map[COM_INTERVAL]; - bigslot_num = TOTAL_SLOTNUM/tag_frequency; +// bigslot_num = TOTAL_SLOTNUM/tag_frequency; total_slotnum = 1000/g_com_map[COM_INTERVAL]; nomovesleeptime = g_com_map[NOMOVESLEEP_TIME]; if(active_flag==0) @@ -909,6 +909,8 @@ } extern uint8_t tx_near_msg[80],stationary_flag; float key_keeptime; +uint16_t current_count1; +uint16_t lpcount1; void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim) { static uint8_t i=0; @@ -916,6 +918,16 @@ g_start_send_flag=1; current_slotnum++; // SetNextPollTime(tyncpoll_time); + + current_count1=HAL_LPTIM_ReadCounter(&hlptim1); + lpcount1 = current_count1+32.768*g_com_map[COM_INTERVAL];; + if(lpcount1>=32768) + { + lpcount1 -=32768; + } + __HAL_LPTIM_COMPARE_SET(&hlptim1, lpcount1); + + nomove_count+=(float)g_com_map[COM_INTERVAL]/1000; if(motor_keeptime>0) { @@ -943,7 +955,7 @@ } if(nomove_count>=nomovesleeptime-1&&imu_enable) { - tx_near_msg[TAGSTATE] = tx_near_msg[TAGSTATE]|GOINGSLEEPBIT; +// tx_near_msg[TAGSTATE] = tx_near_msg[TAGSTATE]|GOINGSLEEPBIT; } if(nomove_count>nomovesleeptime&&imu_enable) { -- Gitblit v1.9.3