diff --git a/checher_slave.uvoptx b/checher_slave.uvoptx
index e3b5cec..1d7aac3 100644
--- a/checher_slave.uvoptx
+++ b/checher_slave.uvoptx
@@ -299,7 +299,7 @@
1
0
- 1
+ 0
18
@@ -476,6 +476,16 @@
+
+
+ System Viewer\TIM4
+ 35905
+
+
+ System Viewer\TIM5
+ 35904
+
+
1
1
@@ -540,7 +550,7 @@
1
0
- 0
+ 1
18
diff --git a/source/ReadMe.txt b/source/ReadMe.txt
index e81eb39..f959a0b 100644
--- a/source/ReadMe.txt
+++ b/source/ReadMe.txt
@@ -333,4 +333,5 @@
调试版本不弹出上传提示框
2024.1.10
在槽任务失败且异常代码不为0时才会导致 CheckerExt_Slot 任务失败
-
+2024.1.12
+ 添加发送失败信息记录
diff --git a/source/interface/if_timer.c b/source/interface/if_timer.c
index 32bfb16..f89dd05 100644
--- a/source/interface/if_timer.c
+++ b/source/interface/if_timer.c
@@ -8,7 +8,7 @@
static int init(timer_def *t){
static int inited=0;
- // if(inited!=0) return 0;
+ if(inited!=0) return 0;
inited=1;
TIM_TimeBaseInitTypeDef timer;
@@ -24,7 +24,7 @@ static int init(timer_def *t){
TIM_SetCounter(TIM4,0);
TIM_ARRPreloadConfig(TIM4, ENABLE);
TIM_SelectOutputTrigger(TIM4,TIM_TRGOSource_Update);
- TIM_Cmd(TIM4, ENABLE);
+ // TIM_Cmd(TIM4, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM5, ENABLE );
NVIC_DisableIRQ(TIM5_IRQn);
@@ -38,7 +38,7 @@ static int init(timer_def *t){
TIM_SetCounter(TIM5,0);
TIM_ARRPreloadConfig(TIM5, ENABLE);
TIM_ITRxExternalClockConfig(TIM5, TIM_TS_ITR2);
- TIM_Cmd(TIM5, ENABLE);
+ // TIM_Cmd(TIM5, ENABLE);
return 0;
@@ -75,9 +75,19 @@ static int write(timer_def *t,const uint32_t value)
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,0);
+timer_init_export(timer,init,deinit,read,write,stop,start,0);
diff --git a/source/main/compiler_info.h b/source/main/compiler_info.h
index a4090be..34b5f4a 100644
--- a/source/main/compiler_info.h
+++ b/source/main/compiler_info.h
@@ -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"
diff --git a/source/rt_thread/board.h b/source/rt_thread/board.h
index feba108..fee678c 100644
--- a/source/rt_thread/board.h
+++ b/source/rt_thread/board.h
@@ -64,6 +64,8 @@ typedef struct __timer_def{
int (*deinit)(struct __timer_def *u);
uint32_t (*read)(struct __timer_def *u);
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;
}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_; \
RT_USED static timer_def _timer_##name_={\
.name=__dev_##name_##_name,\
@@ -158,6 +160,8 @@ typedef struct __timer_def{
.deinit=deinit_,\
.read=read_,\
.write=write_,\
+ .stop=stop_,\
+ .start=start_,\
.private_data=priv_,\
};\
RT_USED static const struct dev_struct __dev_##name_ SECTION("devstruct")= \
diff --git a/source/task/prot_uc.c b/source/task/prot_uc.c
index 9a2f0fe..0cae1c6 100644
--- a/source/task/prot_uc.c
+++ b/source/task/prot_uc.c
@@ -281,8 +281,13 @@ int protu_send(protu_def *p,array_def *data,int timeout_ms)
typedef struct{
-protu_def *p;
-array_def *t;
+ protu_def *p;
+ 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;
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 delay=tick%(wnd_tick*(p->num));
int gap=p->rank*wnd_tick;
+ int ret=0;
if(delay<=gap){
delay=gap-delay;
}else{
@@ -317,10 +323,14 @@ static int protu_send_ontime(protu_def *p,send_pkt_def *s)
if(p->silent!=0){
// 广播命令在指定时间窗口发送
//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));
// 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{
// 单播命令直接发送
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)
{
// 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){
break;
}else{
- g_send_failed_times++;
+ g_send_pkt.send_failed_times++;
}
}
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)
{
- 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;
}
-commend_export(send_failed,send_failed,"print send_failed times")
+commend_export(send_failed,send_failed,"print send_pkt info")