| | |
| | | |
| | | |
| | | switch(motor_state) |
| | | {case 0: |
| | | { |
| | | case 0: |
| | | if(hardware_type==NSH1) |
| | | {MOTOR_OFF; |
| | | }else if(hardware_type==GP) |
| | |
| | | u16 total_slotnum,current_slotnum; |
| | | extern int32_t offsettimeus; |
| | | |
| | | void SetNextPollTime(u16 time) |
| | | { |
| | | int32_t lpcount,lptime,target_time; |
| | | |
| | | if(current_slotnum>=total_slotnum) |
| | | current_slotnum-=total_slotnum; |
| | | |
| | | target_time=((current_slotnum*g_com_map[COM_INTERVAL])+time)*1000; |
| | | //if(target_time<90000) |
| | | { |
| | | lptime=target_time-offsettimeus; |
| | | lpcount = lptime/LPTIMER_LSB; |
| | | if(lpcount>LPTIMER_1S_COUNT) |
| | | lpcount-=LPTIMER_1S_COUNT; |
| | | if(lpcount<0) |
| | | { |
| | | lpcount+=LPTIMER_1S_COUNT; |
| | | } |
| | | __HAL_LPTIM_COMPARE_SET(&hlptim1, lpcount); |
| | | } |
| | | } |
| | | |
| | | void HardWareTypeDiffConfig(void) |
| | | { |
| | |
| | | break; |
| | | } |
| | | } |
| | | uint16_t bigslot_num; |
| | | int16_t g_commap_antdelay; |
| | | u8 active_flag,nomovesleeptime; |
| | | void Program_Init(void) |
| | |
| | | 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; |
| | | total_slotnum = 1000/g_com_map[COM_INTERVAL]; |
| | | nomovesleeptime = g_com_map[NOMOVESLEEP_TIME]; |
| | | if(active_flag==0) |
| | |
| | | #ifdef DEBUG_MODE |
| | | // g_com_map[DEV_ROLE]=1; |
| | | // g_com_map[DEV_ID]=1; |
| | | g_com_map[COM_INTERVAL]=100; |
| | | // g_com_map[COM_INTERVAL]=100; |
| | | // g_com_map[MAX_REPORT_ANC_NUM]=1; |
| | | g_com_map[NOMOVESLEEP_TIME]=10; |
| | | // g_com_map[NOMOVESLEEP_TIME]=10; |
| | | #endif |
| | | if(g_com_map[COM_INTERVAL]==0) |
| | | { |
| | | g_com_map[COM_INTERVAL]=100; |
| | | } |
| | | if(module_power>67) |
| | | {module_power=67;} |
| | | { |
| | | module_power=67; |
| | | } |
| | | if(module_power<0) |
| | | {module_power=0;} |
| | | { |
| | | module_power=0; |
| | | } |
| | | if(g_com_map[ANT_LENGTH]>10000) |
| | | { |
| | | g_com_map[ANT_LENGTH] = 0; |
| | |
| | | i++; |
| | | g_start_send_flag=1; |
| | | current_slotnum++; |
| | | SetNextPollTime(tyncpoll_time); |
| | | // SetNextPollTime(tyncpoll_time); |
| | | nomove_count+=(float)g_com_map[COM_INTERVAL]/1000; |
| | | if(motor_keeptime>0) |
| | | { |