添加发送失败信息记录
This commit is contained in:
@@ -299,7 +299,7 @@
|
|||||||
<OPTFL>
|
<OPTFL>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>1</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<IsCurrentTarget>1</IsCurrentTarget>
|
<IsCurrentTarget>0</IsCurrentTarget>
|
||||||
</OPTFL>
|
</OPTFL>
|
||||||
<CpuCode>18</CpuCode>
|
<CpuCode>18</CpuCode>
|
||||||
<DebugOpt>
|
<DebugOpt>
|
||||||
@@ -476,6 +476,16 @@
|
|||||||
<pszMrulep></pszMrulep>
|
<pszMrulep></pszMrulep>
|
||||||
<pSingCmdsp></pSingCmdsp>
|
<pSingCmdsp></pSingCmdsp>
|
||||||
<pMultCmdsp></pMultCmdsp>
|
<pMultCmdsp></pMultCmdsp>
|
||||||
|
<SystemViewers>
|
||||||
|
<Entry>
|
||||||
|
<Name>System Viewer\TIM4</Name>
|
||||||
|
<WinId>35905</WinId>
|
||||||
|
</Entry>
|
||||||
|
<Entry>
|
||||||
|
<Name>System Viewer\TIM5</Name>
|
||||||
|
<WinId>35904</WinId>
|
||||||
|
</Entry>
|
||||||
|
</SystemViewers>
|
||||||
<DebugDescription>
|
<DebugDescription>
|
||||||
<Enable>1</Enable>
|
<Enable>1</Enable>
|
||||||
<EnableFlashSeq>1</EnableFlashSeq>
|
<EnableFlashSeq>1</EnableFlashSeq>
|
||||||
@@ -540,7 +550,7 @@
|
|||||||
<OPTFL>
|
<OPTFL>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>1</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<IsCurrentTarget>0</IsCurrentTarget>
|
<IsCurrentTarget>1</IsCurrentTarget>
|
||||||
</OPTFL>
|
</OPTFL>
|
||||||
<CpuCode>18</CpuCode>
|
<CpuCode>18</CpuCode>
|
||||||
<DebugOpt>
|
<DebugOpt>
|
||||||
|
@@ -333,4 +333,5 @@
|
|||||||
调试版本不弹出上传提示框
|
调试版本不弹出上传提示框
|
||||||
2024.1.10
|
2024.1.10
|
||||||
在槽任务失败且异常代码不为0时才会导致 CheckerExt_Slot 任务失败
|
在槽任务失败且异常代码不为0时才会导致 CheckerExt_Slot 任务失败
|
||||||
|
2024.1.12
|
||||||
|
添加发送失败信息记录
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
static int init(timer_def *t){
|
static int init(timer_def *t){
|
||||||
static int inited=0;
|
static int inited=0;
|
||||||
// if(inited!=0) return 0;
|
if(inited!=0) return 0;
|
||||||
inited=1;
|
inited=1;
|
||||||
TIM_TimeBaseInitTypeDef timer;
|
TIM_TimeBaseInitTypeDef timer;
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ static int init(timer_def *t){
|
|||||||
TIM_SetCounter(TIM4,0);
|
TIM_SetCounter(TIM4,0);
|
||||||
TIM_ARRPreloadConfig(TIM4, ENABLE);
|
TIM_ARRPreloadConfig(TIM4, ENABLE);
|
||||||
TIM_SelectOutputTrigger(TIM4,TIM_TRGOSource_Update);
|
TIM_SelectOutputTrigger(TIM4,TIM_TRGOSource_Update);
|
||||||
TIM_Cmd(TIM4, ENABLE);
|
// TIM_Cmd(TIM4, ENABLE);
|
||||||
|
|
||||||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM5, ENABLE );
|
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM5, ENABLE );
|
||||||
NVIC_DisableIRQ(TIM5_IRQn);
|
NVIC_DisableIRQ(TIM5_IRQn);
|
||||||
@@ -38,7 +38,7 @@ static int init(timer_def *t){
|
|||||||
TIM_SetCounter(TIM5,0);
|
TIM_SetCounter(TIM5,0);
|
||||||
TIM_ARRPreloadConfig(TIM5, ENABLE);
|
TIM_ARRPreloadConfig(TIM5, ENABLE);
|
||||||
TIM_ITRxExternalClockConfig(TIM5, TIM_TS_ITR2);
|
TIM_ITRxExternalClockConfig(TIM5, TIM_TS_ITR2);
|
||||||
TIM_Cmd(TIM5, ENABLE);
|
// TIM_Cmd(TIM5, ENABLE);
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -75,9 +75,19 @@ static int write(timer_def *t,const uint32_t value)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int start(timer_def *t)
|
||||||
|
{
|
||||||
|
TIM_Cmd(TIM4,ENABLE);
|
||||||
|
TIM_Cmd(TIM5,ENABLE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int stop(timer_def *t)
|
||||||
|
{
|
||||||
|
TIM_Cmd(TIM4,DISABLE);
|
||||||
|
TIM_Cmd(TIM5,DISABLE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
timer_init_export(timer,init,deinit,read,write,stop,start,0);
|
||||||
|
|
||||||
timer_init_export(timer,init,deinit,read,write,0);
|
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define BUILD_DATE "2024-01-10 17:56:38"
|
#define BUILD_DATE "2024-01-12 15:13:50"
|
||||||
#define SOFT_VERSION "2.13"
|
#define SOFT_VERSION "2.13"
|
||||||
|
|
||||||
|
|
||||||
|
@@ -64,6 +64,8 @@ typedef struct __timer_def{
|
|||||||
int (*deinit)(struct __timer_def *u);
|
int (*deinit)(struct __timer_def *u);
|
||||||
uint32_t (*read)(struct __timer_def *u);
|
uint32_t (*read)(struct __timer_def *u);
|
||||||
int (*write)(struct __timer_def *u,const uint32_t value);
|
int (*write)(struct __timer_def *u,const uint32_t value);
|
||||||
|
int (*stop)(struct __timer_def *u);
|
||||||
|
int (*start)(struct __timer_def *u);
|
||||||
void *private_data;
|
void *private_data;
|
||||||
}timer_def;
|
}timer_def;
|
||||||
|
|
||||||
@@ -150,7 +152,7 @@ typedef struct __timer_def{
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define timer_init_export(name_,init_,deinit_,read_,write_,priv_) \
|
#define timer_init_export(name_,init_,deinit_,read_,write_,stop_,start_,priv_) \
|
||||||
const static char __dev_##name_##_name[] SECTION(".rodata.devstr") = #name_; \
|
const static char __dev_##name_##_name[] SECTION(".rodata.devstr") = #name_; \
|
||||||
RT_USED static timer_def _timer_##name_={\
|
RT_USED static timer_def _timer_##name_={\
|
||||||
.name=__dev_##name_##_name,\
|
.name=__dev_##name_##_name,\
|
||||||
@@ -158,6 +160,8 @@ typedef struct __timer_def{
|
|||||||
.deinit=deinit_,\
|
.deinit=deinit_,\
|
||||||
.read=read_,\
|
.read=read_,\
|
||||||
.write=write_,\
|
.write=write_,\
|
||||||
|
.stop=stop_,\
|
||||||
|
.start=start_,\
|
||||||
.private_data=priv_,\
|
.private_data=priv_,\
|
||||||
};\
|
};\
|
||||||
RT_USED static const struct dev_struct __dev_##name_ SECTION("devstruct")= \
|
RT_USED static const struct dev_struct __dev_##name_ SECTION("devstruct")= \
|
||||||
|
@@ -281,8 +281,13 @@ int protu_send(protu_def *p,array_def *data,int timeout_ms)
|
|||||||
|
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
protu_def *p;
|
protu_def *p;
|
||||||
array_def *t;
|
array_def *t;
|
||||||
|
int wnd_tick;// 窗口时间
|
||||||
|
int gap;// 发送循环时间
|
||||||
|
int send_failed_times;// 失败次数
|
||||||
|
uint32_t send_tick_ms;// 发送时的定时器值
|
||||||
|
uint32_t send_end_tick_ms;// 发送时的定时器值
|
||||||
}send_pkt_def;
|
}send_pkt_def;
|
||||||
|
|
||||||
static void protu_send_later(void *ptr)
|
static void protu_send_later(void *ptr)
|
||||||
@@ -309,6 +314,7 @@ static int protu_send_ontime(protu_def *p,send_pkt_def *s)
|
|||||||
int wnd_tick=((arr_length(s->t)+4)/5+2);
|
int wnd_tick=((arr_length(s->t)+4)/5+2);
|
||||||
int delay=tick%(wnd_tick*(p->num));
|
int delay=tick%(wnd_tick*(p->num));
|
||||||
int gap=p->rank*wnd_tick;
|
int gap=p->rank*wnd_tick;
|
||||||
|
int ret=0;
|
||||||
if(delay<=gap){
|
if(delay<=gap){
|
||||||
delay=gap-delay;
|
delay=gap-delay;
|
||||||
}else{
|
}else{
|
||||||
@@ -317,10 +323,14 @@ static int protu_send_ontime(protu_def *p,send_pkt_def *s)
|
|||||||
if(p->silent!=0){
|
if(p->silent!=0){
|
||||||
// 广播命令在指定时间窗口发送
|
// 广播命令在指定时间窗口发送
|
||||||
//later_execute(protu_send_later,s,delay);
|
//later_execute(protu_send_later,s,delay);
|
||||||
|
g_send_pkt.wnd_tick=wnd_tick;
|
||||||
|
g_send_pkt.gap=gap;
|
||||||
while(p->timer->read(p->timer)<(tick+delay));
|
while(p->timer->read(p->timer)<(tick+delay));
|
||||||
// protu_send_later(s);
|
// protu_send_later(s);
|
||||||
return protu_send(s->p,s->t,wnd_tick-1);
|
g_send_pkt.send_tick_ms=p->timer->read(p->timer);
|
||||||
|
ret= protu_send(s->p,s->t,wnd_tick-1);
|
||||||
|
g_send_pkt.send_end_tick_ms=p->timer->read(p->timer);
|
||||||
|
return ret;
|
||||||
}else{
|
}else{
|
||||||
// 单播命令直接发送
|
// 单播命令直接发送
|
||||||
protu_send_later(s);
|
protu_send_later(s);
|
||||||
@@ -328,7 +338,6 @@ static int protu_send_ontime(protu_def *p,send_pkt_def *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int g_send_failed_times;
|
|
||||||
static int protu_send_ontime_loop(protu_def *p,send_pkt_def *s,int retry)
|
static int protu_send_ontime_loop(protu_def *p,send_pkt_def *s,int retry)
|
||||||
{
|
{
|
||||||
// g_send_failed_times=0;
|
// g_send_failed_times=0;
|
||||||
@@ -337,7 +346,7 @@ static int protu_send_ontime_loop(protu_def *p,send_pkt_def *s,int retry)
|
|||||||
if(protu_send_ontime(p,s)!=0){
|
if(protu_send_ontime(p,s)!=0){
|
||||||
break;
|
break;
|
||||||
}else{
|
}else{
|
||||||
g_send_failed_times++;
|
g_send_pkt.send_failed_times++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
arr_delete(s->t);
|
arr_delete(s->t);
|
||||||
@@ -345,11 +354,15 @@ static int protu_send_ontime_loop(protu_def *p,send_pkt_def *s,int retry)
|
|||||||
}
|
}
|
||||||
static int send_failed(list_def *argv)
|
static int send_failed(list_def *argv)
|
||||||
{
|
{
|
||||||
cmd_print("send failed times=%d",g_send_failed_times);
|
cmd_print("send failed times=%d",g_send_pkt.send_failed_times);
|
||||||
|
cmd_print("send_start_tick_ms=%d",g_send_pkt.send_tick_ms);
|
||||||
|
cmd_print("send_end_tick_ms=%d",g_send_pkt.send_end_tick_ms);
|
||||||
|
cmd_print("send_wnd_tick_ms=%d",g_send_pkt.wnd_tick);
|
||||||
|
cmd_print("send_gap_ms=%d",g_send_pkt.gap);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
commend_export(send_failed,send_failed,"print send_failed times")
|
commend_export(send_failed,send_failed,"print send_pkt info")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user