Commit d966adf5 authored by 梁百峰's avatar 梁百峰

feat:16843最终版(可能是)

parent 437e8804
......@@ -2,6 +2,7 @@
#include "api_RS485.h"
#include "string.h"
#include "init.h"
#include "Display_Info.h"
#include "R485_Communication_Matrix.h"
#define UART_RX_MAX_DEPTH (1024) // 4K
......@@ -45,7 +46,7 @@ uint8_t line_stdio = 2;
uint8_t powerstdio = 0;
uint8_t get_num_buf[34];
uint8_t comparestart;
uint8_t blename[4];
uint8_t blename[5];
void get_key(void)
{
key_array[0] = seed_value[0] | seed_value[3];
......@@ -112,13 +113,19 @@ void datacheck(void)
checknumwrong = 1;
}
break;
case 0x4D:
memcpy(R485_ID4Dh.Msg,RS485_data,64);
break;
case 0x81:
{
blename[0] = RS485_data[6];
blename[1] = RS485_data[7];
blename[2] = RS485_data[8];
blename[3] = RS485_data[9];
blename[4] = 0xff;
recvflag111 = 1;
RS485_TX_finish = 0;
// General_Number_Disp(blename, 3, 165);
}
break;
case 0x4F:
......@@ -252,10 +259,15 @@ void datacheck(void)
zhenduansendStep++;
RS485_TX_finish = 0;
}
else
else if(BarCode[4] != 0x67)
{
zhenduansendStep = 0;
RS485_TX_finish = 0;
}
else
{
;
}
}
break;
case 3:
......@@ -266,16 +278,20 @@ void datacheck(void)
zhenduansendStep++;
RS485_TX_finish = 0;
}
if(BarCode[4] == 0x7F)
if(BarCode[4] == 0x7F && BarCode[5] == 0x2E && BarCode[6] == 0x78 )
{
// wait_write_flag = 1;
RS485_TX_finish = 1;
// zhenduansendStep = 0;
// ;
}
if(BarCode[4] == 0x7F && BarCode[5] == 0x2E && BarCode[6] == 0x31 )
{
RS485_TX_finish = 0;
}
}
else
{
RS485_TX_finish = 0;
// RS485_TX_finish = 0;
}
break;
default:
......@@ -285,7 +301,7 @@ void datacheck(void)
}
else
{
RS485_TX_finish = 0x0;
// RS485_TX_finish = 0x0;
}
}
}
......@@ -326,6 +342,7 @@ void BarCodeDataGet(void)
else
{
memcpy(barcode_Msg1,&mDataBufPtr1[6],34);
memset(barcode_Msg,0,34);
}
}
uint8_t GetDataCompare(void)
......@@ -370,6 +387,7 @@ void UART_Put(uint32_t Value)
// LINE_OUT_NEG_09 = 1;
// RS485_TX_finish = 0;
// RS485_send_time = 0;
RS485_send_time = 0;
return;
}
void UART_Put1(uint32_t Value)
......@@ -493,10 +511,10 @@ void Recv_Byte1(void)
int j = 0;
uint32_t len;
readNum1 = Protocol_UartRead1(mDataBufPtr1 + mDataBufLen1, 1024 - mDataBufLen1);
if (readNum1 > 0)
{
BarCodeDataGet();
}
// if (readNum1 > 0)
// {
// BarCodeDataGet();
// }
if (readNum1 > 0)
{
mDataBufLen1 += readNum1;
......
......@@ -31,6 +31,6 @@ extern uint8_t Auto_ONOFF;
extern uint8_t comparestart;
extern uint8_t connectbleFlag;
extern uint8_t get_num_buf[34];
extern uint8_t blename[4];
extern uint8_t blename[5];
extern uint8_t recvflag111;
#endif
\ No newline at end of file
......@@ -535,6 +535,7 @@ void Read_IPK_Session_Type(void)//请求仪表发送 软硬件版本号 等数
}
}
uint8_t LED_Waring = 0;
uint8_t ABStime = 0;
void Function_Check_Ctrl(uint32_t cmd)
{
uint8_t p [ 20 ];
......@@ -588,7 +589,7 @@ void Function_Check_Ctrl(uint32_t cmd)
LED3 = 0; //右转
LED4 = 0;
LINE_OUT_NEG_05 = 0;
LINE_OUT_NEG_06 = 0;
LINE_OUT_NEG_06 = 1;
LINE_jinguang = 0;
POWER_CTRL_KL30_Current = 0;
if(Auto_ONOFF == 0)
......@@ -599,6 +600,7 @@ void Function_Check_Ctrl(uint32_t cmd)
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
LINE_OUT_NEG_04 = 1;
POWER_CTRL_KL30 = 0;
break;
}
......@@ -609,7 +611,8 @@ void Function_Check_Ctrl(uint32_t cmd)
LINE_OUT_NEG_05 = 1;
LINE_OUT_NEG_06 = 0;
POWER_CTRL_KL30_Current = 0;
LINE_jinguang = 1;
LINE_jinguang = 1;
POWER_CTRL_KL30 = 0;
break;
}
case 2:
......@@ -630,11 +633,12 @@ void Function_Check_Ctrl(uint32_t cmd)
case 3:
{
LED3 = 1;
LINE_OUT_NEG_06 = 1;
LINE_OUT_NEG_06 = 0;
LINE_OUT_NEG_05 = 1;
LINE_jinguang = 0;
POWER_CTRL_KL30_Current = 0;
LED4 = 0;
POWER_CTRL_KL30 = 0;
break;
}
case 4:
......@@ -644,7 +648,8 @@ void Function_Check_Ctrl(uint32_t cmd)
LINE_OUT_NEG_05 = 1;
LINE_jinguang = 0;
POWER_CTRL_KL30_Current = 0;
LED4 = 0;
LED4 = 0;
POWER_CTRL_KL30 = 0;
break;
}
......@@ -655,7 +660,10 @@ void Function_Check_Ctrl(uint32_t cmd)
LINE_OUT_NEG_05 = 1;
LINE_jinguang = 0;
POWER_CTRL_KL30_Current = 0;
LED4 = 0;
LED4 = 0;
POWER_CTRL_KL30 = 0;
queren = 0 ;
// ABStime = 0;
break;
}
case 6:
......@@ -665,17 +673,31 @@ void Function_Check_Ctrl(uint32_t cmd)
LINE_OUT_NEG_05 = 1;
LINE_jinguang = 0;
POWER_CTRL_KL30_Current = 0;
LED4 = 0;
LED4 = 0;
POWER_CTRL_KL30 = 0;
if(ABStime < 30)
{
ABStime++;
}
else
{
queren = 1;
ABStime = 0;
}
break;
}
case 7:
{
LED3 = 0;
LED3 = 0;
LINE_OUT_NEG_06 = 0;
LINE_OUT_NEG_05 = 0;
LINE_jinguang = 0;
POWER_CTRL_KL30_Current = 0;
LED4 = 0;
LED4 = 0;
POWER_CTRL_KL30 = 0;
queren = 0;
// ABStime = 0;
break;
}
case 8:
......@@ -685,7 +707,8 @@ void Function_Check_Ctrl(uint32_t cmd)
LINE_OUT_NEG_05 = 1;
LINE_jinguang = 0;
LED4 = 0;
POWER_CTRL_KL30_Current = 1;
POWER_CTRL_KL30_Current = 1;
POWER_CTRL_KL30 = 0;
break;
}
case 9:
......@@ -696,6 +719,7 @@ void Function_Check_Ctrl(uint32_t cmd)
LINE_jinguang = 0;
LED4 = 0;
POWER_CTRL_KL30_Current = 0;
POWER_CTRL_KL30 = 0;
break;
}
case 10:
......@@ -705,7 +729,8 @@ void Function_Check_Ctrl(uint32_t cmd)
LINE_OUT_NEG_05 = 0;
LINE_OUT_NEG_06 = 1;
LINE_jinguang = 1;
POWER_CTRL_KL30_Current = 1;
POWER_CTRL_KL30_Current = 1;
POWER_CTRL_KL30 = 1;
break;
}
case 11:
......@@ -722,6 +747,7 @@ void Function_Check_Ctrl(uint32_t cmd)
LINE_OUT_NEG_05 = 0;
LINE_OUT_NEG_06 = 1;
LINE_jinguang = 1;
POWER_CTRL_KL30 = 1;
POWER_CTRL_KL30_Current = 1;
break;
}
......
......@@ -336,7 +336,7 @@ void Key_Operation_SW10(Key_Event_en_t enKeyEvent)
/*清零ODO*/
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{
Display_TFT_Clear();
if(connectbleFlag == 0)
{
connectbleFlag = 1;
......@@ -345,6 +345,7 @@ void Key_Operation_SW10(Key_Event_en_t enKeyEvent)
}
else
{
Display_TFT_Clear();
name1= (devicename) & 0xFF;
name2 = (devicename >> 8) & 0xFF;
startONfalg = 0;
......@@ -359,7 +360,7 @@ void Key_Operation_SW10(Key_Event_en_t enKeyEvent)
}
else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS )
{
connectbleFlag = 0;
}
else
{
......
......@@ -881,7 +881,7 @@ typedef union
uint8_t : 8; /* 37预留 */
uint8_t : 4; /* 38预留 */
uint8_t nenglainhuishou :4; /* 38预留 */
uint8_t Shoppingmode : 2; /*导购模式*/
uint8_t : 2; /* 38预留 */
......@@ -1074,14 +1074,14 @@ typedef union
uint8_t : 8; /* 48预留 */
uint8_t : 8; /* 49预留 */
/* Byte 50-51 */
uint8_t : 8; /* 50预留 */
uint8_t : 8; /* 51预留 */
uint8_t ESP321 :8; /* 50预留 */
uint8_t ESP322: 8; /* 51预留 */
/* Byte 52-53 */
uint8_t : 8; /* 52预留 */
uint8_t : 8; /* 53预留 */
/* Byte 54-55 */
uint8_t : 8; /* 54预留 */
uint8_t : 8; /* 55预留 */
uint8_t G0311 :8; /* 54预留 */
uint8_t G0312 :8; /* 55预留 */
/* Byte 56-57 */
uint8_t : 8; /* 56预留 */
uint8_t : 8; /* 57预留 */
......@@ -1139,6 +1139,7 @@ extern uint32_t R485_Send_clear(void);
extern uint32_t R485_Sendcheck_0x47(void);
extern uint32_t R485_Send_0x80(void);
extern uint32_t R485_Send_0x45(void);
extern uint32_t R485_Send_ble0x42(void);
extern uint8_t barcode_Msg[64];
......
......@@ -101,10 +101,11 @@ void RTE_GPIO_Init(void)
gpio_temp.enGPIODir = GPIO_DIR_IN;
gpio_temp.enGPIOAltFun = GPIO_ALTER_FUN_1;
GPIO_Config(&gpio_temp);
// LINE_OUT_NEG_01 = 1;
// LINE_OUT_NEG_02 = 1;
// LINE_OUT_NEG_03 = 1;
// LINE_OUT_NEG_04 = 1;
LINE_OUT_NEG_01 = 1;
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
LINE_OUT_NEG_04 = 1;
queren = 0;
#if(0)
gpio_temp.enGPIOPort = GPIO_PORT_GROUP_0;
......
......@@ -148,6 +148,8 @@ void Sys_Run_Mode_10ms_Tasks_Group(void)
// {
// bleOFFtoONtime++;
// }
if(RS485_TX_finish == 0)
{
if(startONfalg == 0)
{
if(send0x42time<130)
......@@ -168,7 +170,7 @@ void Sys_Run_Mode_10ms_Tasks_Group(void)
}
else
{
if(startIGONtime >= 50)
if(startIGONtime >= 50)
{
LINE_OUT_NEG_01 = 1;
LINE_OUT_NEG_02 = 1;
......@@ -176,15 +178,13 @@ void Sys_Run_Mode_10ms_Tasks_Group(void)
LINE_OUT_NEG_04 = 1;
R485_Send_0x80();
blename[4] = 0xFF;
if(recvflag111 == 1)
{
General_Number_Disp(blename, 3, 165);
recvflag111 = 0;
}
}
}
RS485_send_time = 0;
RS485_TX_finish = 1;
RS485_TX_finish = 1;
}
}
......@@ -197,8 +197,13 @@ void Sys_Run_Mode_10ms_Tasks_Group(void)
}
else
{
// backsend();
LINE_OUT_NEG_09 = 0;
Recv_Byte();
if(LINE_OUT_NEG_09 == 0)
{
Recv_Byte();
}
}
......@@ -316,6 +321,7 @@ uint32_t AutoTime = 160;
uint32_t ONOFFtime;
uint8_t compareresult;
uint8_t flashtime = 0;
uint8_t showtime = 0;
void Sys_Run_Mode_100ms_Tasks_Group(void)
{
static uint32_t loc_timer = 0;
......@@ -402,7 +408,7 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
// comparestart = 2;
}
comparestart = 0;
Display_TFT_Clear();
// Display_TFT_Clear();
}
else if(comparestart == 0)
{
......@@ -430,7 +436,13 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
}
flashtime = 0;
}
if(recvflag111 == 1)
{
blename[4] = 0xff;
General_Number_Disp(blename, 3, 165);
recvflag111 = 0;
}
//u16LJSText = TFT_LCD_REQ_FIFO_MAX_DEPTH;
}
......
......@@ -492,18 +492,18 @@ void RS485_User_Tx_Data(void)
}
}
break;
// case 3:
// sendfinishflag = R485_Send_0x80();
// if(sendfinishflag == 0)
// {
// RS485_send_time = 0;
// RS485_TX_finish = 1;
// if(RS485_TX_finish == 1)
// {
// RS485_send_num++;
// }
// }
// break;
case 3:
sendfinishflag = R485_Send_0x45();
if(sendfinishflag == 0)
{
RS485_send_time = 0;
RS485_TX_finish = 1;
if(RS485_TX_finish == 1)
{
RS485_send_num = 0;
}
}
break;
default:
flag = 1;
RS485_send_time = 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