ancsync_time=((sync_timer+0)*1000+tmp_time); current_count=HAL_LPTIM_ReadCounter(&hlptim1); // count_offset=sync_count-current_count-143; // current_slottimes=(ancsync_time-10000)/(g_com_map[COM_INTERVAL]*1000); nextpoll_delaytime=tyncpoll_time*1000+g_com_map[COM_INTERVAL]*1000-((ancsync_time-10000)%(g_com_map[COM_INTERVAL]*1000))-5150; if(abs(ancsync_time-910000)<1000) { nextpoll_delaytime+=10000; } if(nextpoll_delaytime<2000) { nextpoll_delaytime+=g_com_map[COM_INTERVAL]*1000; } lastpoll_count= current_count+(nextpoll_delaytime)/LPTIMER_LSB; if(lastpoll_count>LPTIMER_1S_COUNT) lastpoll_count-=LPTIMER_1S_COUNT; __HAL_LPTIM_COMPARE_SET(&hlptim1, lastpoll_count);