电机下压

This commit is contained in:
ranchuan
2023-06-25 18:04:09 +08:00
parent 7619a0804a
commit cfda1c461b
11 changed files with 497 additions and 14 deletions

View File

@@ -9,6 +9,7 @@
#include "handle_for_checker.h"
#include "compiler_info.h"
#include "dev_backup.h"
#include "moter.h"
@@ -81,10 +82,29 @@ static void check_end(ucport_def *u,port_mcu *src,void *data,int ack,char *err_s
arr_append(a,0);
arr_appends(a,w->ack,w->ack_size);
emit tran_send_signal(w->u.p,0x31,arr_temp(a));
// 把命令字改为0x31用于接收主机应答
w->u.cmd=0x31;
tran_set_busy(w->u.p,0);
}
}
// 电机上升之后解除忙状态
static void check_when_moter_up(void *t)
{
ucport_def *u=t;
tran_set_busy(u->p,0);
}
static int check_dolater(ucport_def *u,uint8_t cmd,array_def *data,char *err_str)
{
if(cmd==0x31)
{
moter_up(check_when_moter_up,u);
}
return 0;
}
static void check_del(ucport_def *u)
{
@@ -92,6 +112,23 @@ static void check_del(ucport_def *u)
}
// 电机下降之后开始检测
static void check_when_moter_down(void *t)
{
ucport_def *u=t;
for(int i=0;i<20;i++)
{
port_mcu *mcu=tran_get_portm(u->p,i);
// 这里打开检测
if(mcu){
port_start(mcu,check_creat(check_scheme()));
}
}
}
static ucport_def *check(tran_def *t, uint8_t cmd,array_def *data)
{
int return_size=(check_scheme()->range_num*2+8+(check_scheme()->range_num+7)/8);
@@ -100,18 +137,11 @@ static ucport_def *check(tran_def *t, uint8_t cmd,array_def *data)
u->ack_size=return_size*20;
u->u.p=t;
u->u.del=check_del;
u->u.dolater=check_dolater;
u->u.doend=check_end;
DBG_LOG("check: skip=%d",u->ret_skip);
tran_set_busy(t,1);
for(int i=0;i<20;i++)
{
port_mcu *mcu=tran_get_portm(u->u.p,i);
// 这里打开检测
if(mcu){
port_start(mcu,check_creat(check_scheme()));
}
}
moter_down(check_when_moter_down,u);
array_def *a=arr_creat();
arr_append(a,0);
emit tran_reply_signal(u->u.p,arr_temp(a));