#include "app_common.h" #include "../clib/md5.h" #include "../msp/uart0.h" #include "../msp/uart2.h" #include "../app/app_task_gm35.h" #include "../app/app_paraid.h" #include "../app/app_task_relay.h" struct printer_maintenance_global G; U8 ccmodbus_len = 0; void L2_register_init() { U8 i = 0; G.p.slaverId = 0x10; G.p.wisdom_car_no = 0x92; //第一台车91,第二台车92 G.p.thrombolytic_ratio = 9; //0.9 G.p.bolus_ratio = 1; //0.9 G.p.hold_ratio = 9; //0.1 G.total_weight = 0; G.pi_weight = 0; G.jing_weight = 0; G.thrombolytic_val = G.bolus_val = G.hold_val = 0; G.asga.xaxis = G.asga.yaxis = G.asga.zaxis = 0; G.rfid = 0; for(i=0;i<4;i++) { G.weight[i] = 0; } for(i=0;i无效 1:暂时有效 2->永久有效 G.md_slaver_info[1].slaver = SLAVER_ASGA03_ID; //倾角XYZ G.md_slaver_info[1].oper = MODBUS_OPER_READ; G.md_slaver_info[1].reg = 0x04; G.md_slaver_info[1].regnum = 0x03; G.md_slaver_info[1].mask = 2; G.md_slaver_info[2].slaver = SLAVER_SHOW01_ID; //重量2,溶栓,团注,维? G.md_slaver_info[2].oper = MODBUS_OPER_WRITE_M; G.md_slaver_info[2].reg = 0x02; G.md_slaver_info[2].regnum = 0x05; G.md_slaver_info[2].bytes = G.md_slaver_info[2].regnum * 2; G.md_slaver_info[2].buf = (U8*)&G.jing_weight; G.md_slaver_info[2].mask = 0; G.md_slaver_info[3].slaver = SLAVER_SHOW01_ID; //RFID G.md_slaver_info[3].oper = MODBUS_OPER_WRITE_M; G.md_slaver_info[3].reg = 0x07; G.md_slaver_info[3].regnum = 0x01; G.md_slaver_info[3].bytes = G.md_slaver_info[3].regnum * 2; G.md_slaver_info[3].buf = (U8*)&G.rfid; G.md_slaver_info[3].mask = 0; G.md_slaver_info[4].slaver = SLAVER_SHOW01_ID; //显示板按键 G.md_slaver_info[4].oper = MODBUS_OPER_READ; G.md_slaver_info[4].reg = 0x08; G.md_slaver_info[4].regnum = 0x01; G.md_slaver_info[4].mask = 2; G.md_slaver_info[5].slaver = SLAVER_ASGA03_UPDOWN_ID; //升降倾角 G.md_slaver_info[5].oper = MODBUS_OPER_READ; G.md_slaver_info[5].reg = 0x04; G.md_slaver_info[5].regnum = 0x03; G.md_slaver_info[5].mask = 2; for(i=0;ioper) { case OPER_SET_DEBUG: G.debug = ccmodbus->buf[0]; break; } } void L3_protocol_handler_uart4_fun(U8 *pPara) { #if 0 if(g_at_send_status.module_ok == 0) { if(StrStartsWith(pPara,"OK")) //module ok { g_at_send_status.module_ok = 1; } } else if(g_at_send_status.sim_ok == 0) { if(StrStartsWith(pPara,"+CCID")) //sim ok { L0_uart0_uc('s'); libc_memcpy(G.ccid,pPara+7,20); g_at_send_status.sim_ok = 1; } } else if(g_at_send_status.net_ok == 0) { if(StrStartsWith(pPara,"+CREG: 1,1")) //net ok { L0_uart0_uc('n'); g_at_send_status.net_ok = 1; } } else if(g_at_send_status.gprs_ok == 0) { if(StrStartsWith(pPara,"+CGATT:1")) //gprs ok { L0_uart0_uc('g'); g_at_send_status.gprs_ok = 1; } } else if(g_at_send_status.conn_ok == 0) { if(StrStartsWith(pPara,"ALREAY") || StrStartsWith(pPara,"CONNECT OK") /*|| StrStartsWith(pPara,"STATE:CONNECT OK")*/) //conn ok { //ALREAY CONNECT????????????????????????????????????????????????????????????????? L0_uart0_uc('c'); g_at_send_status.conn_ok = 1; } } else if(g_at_send_status.conn_ok == 1) { if(StrStartsWith(pPara,"CLOSE") || StrStartsWith(pPara,"STATE:CLOSED")) //conn close //CLOSE OK / CLOSED { L0_uart0_uc('d'); g_at_send_status.conn_ok = 0; g_at_send_status.tcp_close_stmp = s_nos_tick.t_1s; } } #else if(g_at_send_status.conn_ok == 0) { if(StrStartsWith(pPara,"CONNECT OK") || StrStartsWith(pPara,"STATE:CONNECT OK") /*|| StrStartsWith(pPara,"ALREAY")*/ ) //conn ok { //ALREAY CONNECT不需要判断了,使用AT+CTPSTATUS指令进行查询连接状态 L0_uart0_uc('c'); g_at_send_status.conn_ok = 1; } else if(g_at_send_status.module_ok == 0) { if(StrStartsWith(pPara,"OK")) //module ok { g_at_send_status.module_ok = 1; } } else if(g_at_send_status.sim_ok == 0) { if(StrStartsWith(pPara,"+CCID")) //sim ok { L0_uart0_uc('s'); libc_memcpy(G.ccid,pPara+7,20); getPwd(G.ccid, G.ccid_passwd); g_at_send_status.sim_ok = 1; } } else if(g_at_send_status.net_ok == 0) { if(StrStartsWith(pPara,"+CREG: 1,1")) //net ok { L0_uart0_uc('n'); g_at_send_status.net_ok = 1; } } else if(g_at_send_status.gprs_ok == 0) { if(StrStartsWith(pPara,"+CGATT:1")) //gprs ok { L0_uart0_uc('g'); g_at_send_status.gprs_ok = 1; } } } else { if(StrStartsWith(pPara,"CLOSE") || StrStartsWith(pPara,"STATE:CLOSED")) //conn close //CLOSE OK / CLOSED { L0_uart0_uc('d'); g_at_send_status.conn_ok = 0; } } #endif } void L2_do_board_reset(void) { G.reset = 1; //wdt stop feed GM35_DISABLE(); //gm35 poweroff } void L2_do_gm35_reset(void) { GM35_DISABLE(); //gm35 poweroff Lc_delay_ms(5000); GM35_ENABLE(); }