V2.13 使用新的can帧回复数据
解决ew自检模式 8导致小板死机的bug,自检返回值除以400,单位0.1ms
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "dev_flash.h"
|
||||
#include "mymisc.h"
|
||||
#include "elec_det.h"
|
||||
#include "commend.h"
|
||||
|
||||
|
||||
|
||||
@@ -251,7 +252,7 @@ protu_def *protu_creat(uart_def *uart)
|
||||
p->cmd=0xff;// 命令字不可能是0xff
|
||||
protu_set_endecode_fun(p);
|
||||
sprintf(name,"protu_t#%d",count);
|
||||
rt_thread_t rt_t=rt_thread_create(name,protu_run,p,1024,5,20);
|
||||
rt_thread_t rt_t=rt_thread_create(name,protu_run,p,1024,6,20);
|
||||
rt_thread_startup(rt_t);
|
||||
int bsp=sys_param()->uartbsp;
|
||||
if(bsp==9600)
|
||||
@@ -287,8 +288,8 @@ array_def *t;
|
||||
static void protu_send_later(void *ptr)
|
||||
{
|
||||
send_pkt_def *s=ptr;
|
||||
protu_send(s->p,s->t,50);
|
||||
arr_delete(s->t);
|
||||
protu_send(s->p,s->t,1000);
|
||||
// arr_delete(s->t);
|
||||
}
|
||||
|
||||
static send_pkt_def g_send_pkt;
|
||||
@@ -318,7 +319,7 @@ static int protu_send_ontime(protu_def *p,send_pkt_def *s)
|
||||
//later_execute(protu_send_later,s,delay);
|
||||
while(p->timer->read(p->timer)<(tick+delay));
|
||||
// protu_send_later(s);
|
||||
return protu_send(s->p,s->t,wnd_tick-2);
|
||||
return protu_send(s->p,s->t,wnd_tick-1);
|
||||
|
||||
}else{
|
||||
// 单播命令直接发送
|
||||
@@ -327,12 +328,29 @@ static int protu_send_ontime(protu_def *p,send_pkt_def *s)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int protu_send_ontime_loop(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)
|
||||
{
|
||||
while(protu_send_ontime(p,s)==0);
|
||||
// g_send_failed_times=0;
|
||||
for(int i=0;i<retry;i++)
|
||||
{
|
||||
if(protu_send_ontime(p,s)!=0){
|
||||
break;
|
||||
}else{
|
||||
g_send_failed_times++;
|
||||
}
|
||||
}
|
||||
arr_delete(s->t);
|
||||
return 0;
|
||||
}
|
||||
static int send_failed(list_def *argv)
|
||||
{
|
||||
cmd_print("send failed times=%d",g_send_failed_times);
|
||||
return 0;
|
||||
}
|
||||
|
||||
commend_export(send_failed,send_failed,"print send_failed times")
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -348,7 +366,7 @@ void protu_reply_call(protu_def *p,array_def *data)
|
||||
if(t){
|
||||
g_send_pkt.p=p;
|
||||
g_send_pkt.t=t;
|
||||
protu_send_ontime_loop(p,&g_send_pkt);
|
||||
protu_send_ontime_loop(p,&g_send_pkt,3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,7 +389,7 @@ void protu_send_call(protu_def *p,uint8_t cmd,array_def *data)
|
||||
if(t){
|
||||
g_send_pkt.p=p;
|
||||
g_send_pkt.t=t;
|
||||
protu_send_ontime_loop(p,&g_send_pkt);
|
||||
protu_send_ontime_loop(p,&g_send_pkt,3);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user