You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
1.9 KiB
81 lines
1.9 KiB
4 years ago
|
#include "app_task_tcp_control.h"
|
||
|
#include "../msp/uart0.h"
|
||
|
#include "../app/task_w600.h"
|
||
|
#include "../app/app_task_tcp.h"
|
||
|
|
||
|
TS_tcp_control ts_tcp_control;
|
||
|
|
||
|
void L3_task_tcp_control_init(void)
|
||
|
{
|
||
|
L1_task_init(&ts_tcp_control.task);
|
||
|
L3_task_s_go(ts_tcp_control,D_task_init);
|
||
|
ts_tcp_control.conn_ok_pool = 0;
|
||
|
ts_tcp_control.tcp_send_stmp = 0;
|
||
|
}
|
||
|
|
||
|
#define D_task_tcp_control_01 0x51
|
||
|
#define D_task_tcp_control_02 0x52
|
||
|
#define D_task_tcp_control_03 0x53
|
||
|
|
||
|
|
||
|
void L3_task_tcp_control_handle(TS_tcp_control *s)//判定是否抬笔/缓冲区满,调用读函数读取一段,从G->R, R.extra num 动态修改数量
|
||
|
|
||
|
{
|
||
|
TTSS_Task_init()
|
||
|
L2_task_go(D_task_tcp_control_01);
|
||
|
TTSS_Task_step(D_task_tcp_control_01)
|
||
|
if(s->conn_ok_pool != s_task_gm35_flow.conn_ok)
|
||
|
{
|
||
|
G.authed = 0;
|
||
|
s->conn_ok_pool =s_task_gm35_flow.conn_ok;
|
||
|
}
|
||
|
L2_task_go(D_task_tcp_control_02);
|
||
|
TTSS_Task_step(D_task_tcp_control_02)//是否发认证包
|
||
|
if(s_task_gm35_flow.conn_ok)
|
||
|
{
|
||
|
//3s一次发送数据包
|
||
|
if(s_nos_tick.t_1s - ts_tcp_control.tcp_send_stmp >= 3)
|
||
|
{
|
||
|
if(!G.authed)
|
||
|
{
|
||
|
//L0_uart0_sendstr("111");
|
||
|
//发送认证包
|
||
|
G.ccmd_slaver_info[0].mask = 1;
|
||
|
L2_task_go(D_task_tcp_control_01);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
L2_task_go(D_task_tcp_control_03);
|
||
|
}
|
||
|
ts_tcp_control.tcp_send_stmp = s_nos_tick.t_1s;
|
||
|
}
|
||
|
else if(s_nos_tick.t_1s - ts_tcp_control.tcp_send_stmp >= 60)
|
||
|
{
|
||
|
G.ccmd_slaver_info[1].mask = 1;
|
||
|
L2_task_go(D_task_tcp_control_01);
|
||
|
ts_tcp_control.tcp_send_stmp = s_nos_tick.t_1s;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
TTSS_Task_step(D_task_tcp_control_03)
|
||
|
if(wr_buf.full == 1)
|
||
|
{
|
||
|
wr_buf.full = 0;
|
||
|
Lc_read_cyc_buf(&R.points ,&wr_buf ,POINT_LEN);
|
||
|
G.ccmd_slaver_info[2].mask = 1;
|
||
|
L2_task_go(D_task_tcp_control_01);
|
||
|
}
|
||
|
else if(G.pen_up == 1)
|
||
|
{
|
||
|
Lc_read_cyc_buf(&R.points ,&wr_buf ,sizeof(wr_buf.buf)/2);
|
||
|
G.ccmd_slaver_info[2].mask = 1;
|
||
|
L2_task_go(D_task_tcp_control_01);
|
||
|
}
|
||
|
TTSS_Task_end();
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|