Commit 98b525f4 authored by 何锐's avatar 何锐

feat:海外检测台增加写码功能

parent ea3ba641
...@@ -17,7 +17,7 @@ static UARTRxBuf_t UARTRxBuf; ...@@ -17,7 +17,7 @@ static UARTRxBuf_t UARTRxBuf;
static UARTRxBuf_t UARTRxBuf1; static UARTRxBuf_t UARTRxBuf1;
static uint8_t mDataBufPtr[1024] = {0}; static uint8_t mDataBufPtr[1024] = {0};
static uint32_t mDataBufLen = 0; static uint32_t mDataBufLen = 0;
static uint8_t mDataBufPtr1[1024] = {0}; uint8_t mDataBufPtr1[1024] = {0};
static uint32_t mDataBufLen1 = 0; static uint32_t mDataBufLen1 = 0;
uint8_t BarCode[256] = {0}; uint8_t BarCode[256] = {0};
uint8_t BarCode1[256] = {0}; uint8_t BarCode1[256] = {0};
...@@ -261,6 +261,11 @@ void datacheck(void) ...@@ -261,6 +261,11 @@ void datacheck(void)
{ {
writeflag = BarCode[16]; writeflag = BarCode[16];
RS485_TX_finish = 0; RS485_TX_finish = 0;
for(int i = 0; i<32; i++)
{
uidread[i] = BarCode[i+17];
}
uidread[32] = 0xFF;
} }
switch (zhenduansendStep) switch (zhenduansendStep)
{ {
...@@ -383,15 +388,16 @@ uint8_t cmpresult = 3; ...@@ -383,15 +388,16 @@ uint8_t cmpresult = 3;
void BarCodeDataGet(void) void BarCodeDataGet(void)
{ {
if((mDataBufPtr1[0] == 0x59) && (mDataBufPtr1[1] == 0x59)&&(mDataBufPtr1[39] != 0x0)) if((mDataBufPtr1[0] == 0x33) && (mDataBufPtr1[1] == 0x37) && (mDataBufPtr1[2] == 0x31))
{ {
memcpy(barcode_Msg,&mDataBufPtr1[6],34); memcpy(barcode_Msg,&mDataBufPtr1[0],32);
memcpy(barcode_Msg1,&mDataBufPtr1[6],34); memcpy(barcode_Msg1,&mDataBufPtr1[0],32);
Display_TFT_Clear();
} }
else else
{ {
memcpy(barcode_Msg1,&mDataBufPtr1[6],34); memcpy(barcode_Msg1,&mDataBufPtr1[0],32);
memset(barcode_Msg,0,34); memset(barcode_Msg,0,32);
} }
} }
uint8_t GetDataCompare(void) uint8_t GetDataCompare(void)
......
...@@ -40,4 +40,5 @@ extern uint16_t lightnumber; ...@@ -40,4 +40,5 @@ extern uint16_t lightnumber;
extern uint8_t btmac[6]; extern uint8_t btmac[6];
extern uint8_t uidread[33]; extern uint8_t uidread[33];
extern uint8_t writeflag; extern uint8_t writeflag;
extern uint8_t mDataBufPtr1[1024];
#endif #endif
\ No newline at end of file
...@@ -210,9 +210,9 @@ uint8_t Type_Clear = 0; ...@@ -210,9 +210,9 @@ uint8_t Type_Clear = 0;
extern uint8_t BCM_FLAG_2014 = 0; extern uint8_t BCM_FLAG_2014 = 0;
uint32_t loc_Type = 0; uint32_t loc_Type = 0;
uint8_t erweima[64] ;
void Total_Check(void) void Total_Check(void)
{ {
uint8_t erweima[64] ;
uint8_t cmperweima[34]; uint8_t cmperweima[34];
uint8_t yibiaoshuju[34]; uint8_t yibiaoshuju[34];
...@@ -240,8 +240,8 @@ uint8_t yibiaoshuju[34]; ...@@ -240,8 +240,8 @@ uint8_t yibiaoshuju[34];
// { // {
// erweima[i] = barcode_Msg[i]; // erweima[i] = barcode_Msg[i];
// } // }
memcpy(erweima,barcode_Msg,34); memcpy(erweima,barcode_Msg,32);
erweima[34] = 0xFF; erweima[32] = 0xFF;
General_Number_Disp(erweima, 3, 90); General_Number_Disp(erweima, 3, 90);
if(writeflag == 1 || writeflag == 3) if(writeflag == 1 || writeflag == 3)
{ {
...@@ -251,11 +251,13 @@ uint8_t yibiaoshuju[34]; ...@@ -251,11 +251,13 @@ uint8_t yibiaoshuju[34];
{ {
TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_cuo12 ); TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_cuo12 );
} }
General_Number_Disp(uidread, 3, 180);
break; break;
case 1: case 1:
// Buzzer_Warning(); // Buzzer_Warning();
memcpy(cmperweima,barcode_Msg1,34); memcpy(cmperweima,barcode_Msg1,32);
// for(int i =0;i<34;i++) // for(int i =0;i<34;i++)
......
...@@ -45,7 +45,7 @@ extern unsigned char KEYBUFFER [ 4 ]; ...@@ -45,7 +45,7 @@ extern unsigned char KEYBUFFER [ 4 ];
extern unsigned int CAN_Msg_Tx_Enable; extern unsigned int CAN_Msg_Tx_Enable;
extern uint8_t loc_Type_back; extern uint8_t loc_Type_back;
extern uint8_t LED_Waring ; extern uint8_t LED_Waring ;
extern uint8_t erweima[64];
void SET_IPK_NONE(void); void SET_IPK_NONE(void);
void Clear_IPK_NONE(void); void Clear_IPK_NONE(void);
void CHECK_IPK_COUNT(void); void CHECK_IPK_COUNT(void);
......
...@@ -3692,24 +3692,33 @@ uint8_t uuidnumber2[UUID2_EFFECT_LEN + 1] = {0x30,0x33,0x39,0x33,0x32,0x33,0x31, ...@@ -3692,24 +3692,33 @@ uint8_t uuidnumber2[UUID2_EFFECT_LEN + 1] = {0x30,0x33,0x39,0x33,0x32,0x33,0x31,
uint8_t uuidmodel = 0; uint8_t uuidmodel = 0;
void UUID_Write(void) void UUID_Write(void)
{ {
uint16_t uuidcrc = 0; // uint16_t uuidcrc = 0;
uint8_t i; // uint8_t i;
memcpy(&R485_0x80_msg[UUID1_MSG_START], uuidnumber1, UUID1_EFFECT_LEN); // memcpy(&R485_0x80_msg[UUID1_MSG_START], uuidnumber1, UUID1_EFFECT_LEN);
memcpy(&R485_0x80_msg[UUID2_MSG_START], uuidnumber2, UUID2_EFFECT_LEN); // memcpy(&R485_0x80_msg[UUID2_MSG_START], uuidnumber2, UUID2_EFFECT_LEN);
for (i = 0; i < UUID1_EFFECT_LEN; i++) // for (i = 0; i < UUID1_EFFECT_LEN; i++)
{ // {
uuidcrc += uuidnumber1[i]; // uuidcrc += uuidnumber1[i];
} // }
for (i = 0; i < UUID2_EFFECT_LEN; i++) // for (i = 0; i < UUID2_EFFECT_LEN; i++)
// {
// uuidcrc += uuidnumber2[i];
// }
// R485_0x80_msg[CRC_MSG_POS] = uuidcrc & 0xFF;
// uuidnumber2_increment_with_carry();
uint16_t uuidcrc = 0;
for (int i = 0; i < UUID1_EFFECT_LEN + UUID2_EFFECT_LEN; i++)
{ {
uuidcrc += uuidnumber2[i]; uuidcrc += erweima[i];
} }
R485_0x80_msg[CRC_MSG_POS] = uuidcrc & 0xFF; R485_0x80_msg[CRC_MSG_POS] = uuidcrc & 0xFF;
uuidnumber2_increment_with_carry(); memcpy(&R485_0x80_msg[UUID1_MSG_START], erweima, UUID1_EFFECT_LEN + UUID2_EFFECT_LEN);
} }
uint8_t UUIDX = 193; uint8_t UUIDX = 193;
uint8_t change = 19; uint8_t change = 19;
......
...@@ -123,13 +123,14 @@ void Sys_Run_Mode_10ms_Tasks_Group(void) ...@@ -123,13 +123,14 @@ void Sys_Run_Mode_10ms_Tasks_Group(void)
{ {
if(writeflag == 1 || writeflag ==3) if(writeflag == 1 || writeflag ==3)
{ {
R485_Send_0x47(); // R485_Send_0x47();
UUID_Write();
} }
else else
{ {
R485_Send_0x80(); ;
} }
R485_Send_0x80();
comparestart = 0; comparestart = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment