Commit 9741bdae authored by 李梓源's avatar 李梓源

feat:换高电平触发

parent a26f5d54
......@@ -4445,7 +4445,7 @@ void Display_Send_Vspead(uint8_t menu)
case 4:
break;
case 5:
if(ZXSW_AD == 0)
if(ZXSW_AD == 1)
{
TFT_LCD_Draw_Bmp(51,261,( uint8_t * )gImage_Alarm_11_Word0X51_Y261);
}
......@@ -4455,7 +4455,7 @@ void Display_Send_Vspead(uint8_t menu)
}
break;
case 6:
if(ZXSW_AD == 0)
if(ZXSW_AD == 1)
{
TFT_LCD_Draw_Bmp(51,261,( uint8_t * )gImage_Alarm_11_Word0X51_Y261);
}
......@@ -4465,7 +4465,7 @@ void Display_Send_Vspead(uint8_t menu)
}
break;
case 7:
if(Light_control_headlights == 0)
if(Light_control_headlights == 1)
{
TFT_LCD_Draw_Bmp(51,261,( uint8_t * )gImage_Alarm_06_Word0X51_Y261);
}
......@@ -4496,7 +4496,7 @@ void Display_Send_Vspead(uint8_t menu)
}
break;
case 10:
if(WYTY_AD == 0)
if(WYTY_AD == 1)
{
TFT_LCD_Draw_Bmp(51,200,( uint8_t * )gImage_Alarm_12_Word0X51_Y261);
}
......@@ -4504,7 +4504,7 @@ void Display_Send_Vspead(uint8_t menu)
{
TFT_LCD_Draw_Box(0, 200, 239, 261, TFT_LCD_FILL_FULL, TFT_LCD_TYPE_CLR);
}
if(LOGOTY_AD == 0)
if(LOGOTY_AD == 1)
{
TFT_LCD_Draw_Bmp(51,261,( uint8_t * )gImage_Alarm_13_Word0X51_Y261);
}
......
......@@ -478,8 +478,83 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
/*==============================================================================
��ȷ��50us��ʱ���� ��ֹ�����޸��б��е�����
------------------------------------------------------------------------------*/
uint8_t flag_1;
uint8_t flag_0;
uint8_t flag_fin;
void Sys_Exact_50us_Tasks(void)
{
static uint8_t flag1_count = 0;
static uint8_t flag1_flag = 0;
static uint8_t flag0_count = 0;
static uint8_t flag0_flag = 0;
static uint32_t flag_fin_count = 0;
if(flag_1 == 1)
{
if(flag1_count < 40)
{
flag1_count++;
}
else
{
flag1_count = 0;
flag_1 = 0;
}
if(flag1_count < 30)
{
// set_pin_high();
}
else if (flag1_count < 40)
{
// set_pin_low();
}
}
if(flag_0 == 1)
{
if(flag0_count < 40)
{
flag0_count++;
}
else
{
flag0_count = 0;
flag_0 = 0;
}
if(flag0_count < 10)
{
// set_pin_high();
}
else if (flag0_count < 40)
{
// set_pin_low();
}
}
if(flag_fin == 1)
{
if(flag_fin_count < 100)
{
flag_fin_count++;
}
else
{
flag_fin_count = 0;
flag_fin = 0;
}
if(flag_fin_count < 10)
{
// set_pin_high();
}
else if (flag_fin_count < 40)
{
// set_pin_low();
}
}
GenDelay_Tick( );
DoCAN_Timer_Update(50u);
}
......
......@@ -167,148 +167,7 @@ void R485_RX_task(void* pvParameters)
static void RS485_Receive_Data_Analysis(void)
{
// if ((u32RS485DataBufLen + stRS485DataRx.length) >= RS485_RX_BUF_LEN)
// {
// u32RS485DataBufLen = 0;
// RS485DataBuf[0] = 0;
// }
// else
// {
// memcpy(&RS485DataBuf[u32RS485DataBufLen], stRS485DataRx.RS485Data, stRS485DataRx.length);
// u32RS485DataBufLen += stRS485DataRx.length;
// }
// if (u32RS485DataBufLen > 4)
// {
// u32RS485RxDataBegin = 0;
// while (u32RS485RxDataBegin < (u32RS485DataBufLen - 4))
// {
// if ((RS485DataBuf[0 + u32RS485RxDataBegin] != 'Y') ||
// (RS485DataBuf[1 + u32RS485RxDataBegin] != 'D') ||
// ((RS485DataBuf[2 + u32RS485RxDataBegin] != RS485_RECEIVE_ID_0X40) &&
// (RS485DataBuf[2 + u32RS485RxDataBegin] != RS485_RECEIVE_ID_0X41) &&
// (RS485DataBuf[2 + u32RS485RxDataBegin] != RS485_RECEIVE_ID_0X42) &&
// (RS485DataBuf[2 + u32RS485RxDataBegin] != RS485_RECEIVE_ID_0X45) &&
// (RS485DataBuf[2 + u32RS485RxDataBegin] != OTA_MODE_RX_ID)))
// {
// u32RS485RxDataBegin++;
// continue;
// }
// u32RS485RxDataValidLenTem = RS485DataBuf[3 + u32RS485RxDataBegin];
// if (u32RS485RxDataValidLenTem != RS485_RX_DATA_LEN)
// {
// if (RS485DataBuf[2 + u32RS485RxDataBegin] != OTA_MODE_RX_ID)
// {
// u32RS485RxDataBegin++;
// continue;
// }
// }
// u32RS485RxDataRe = u32RS485DataBufLen - u32RS485RxDataBegin;
// if (u32RS485RxDataRe >= (u32RS485RxDataValidLenTem + 5))
// {
// uint8_t u8YadiDataSum = 0;
// u8YadiDataSum = Yadi_CAL_Data_Sum(&RS485DataBuf[2 + u32RS485RxDataBegin], (u32RS485RxDataValidLenTem + 2));
// if (u8YadiDataSum != RS485DataBuf[u32RS485RxDataValidLenTem + 4 + u32RS485RxDataBegin])
// {
// u32RS485RxDataBegin++;
// continue;
// }
// }
// else
// {
// break;
// }
// u32RS485RxDataRe = u32RS485DataBufLen - u32RS485RxDataBegin;
// if (u32RS485RxDataRe >= (u32RS485RxDataValidLenTem + 7))
// {
// if ((RS485DataBuf[u32RS485RxDataValidLenTem + 5 + u32RS485RxDataBegin] != 0x4B) ||
// (RS485DataBuf[u32RS485RxDataValidLenTem + 6 + u32RS485RxDataBegin] != 0x4A))
// {
// u32RS485RxDataBegin++;
// continue;
// }
// else
// {
// switch (RS485DataBuf[2 + u32RS485RxDataBegin])
// {
// case RS485_RECEIVE_ID_0X40:
// {
// if (stRS485RxVldData[RS485_Rx_ID40_Idx].u8Received == 0)
// {
// memcpy(stRS485RxVldData[RS485_Rx_ID40_Idx].u8RecVal, &RS485DataBuf[4 + u32RS485RxDataBegin], u32RS485RxDataValidLenTem);
// stRS485RxVldData[RS485_Rx_ID40_Idx].u8Received = 1;
// stRS485TxData[RS485_Tx_ID48_Idx].u8TxTime = 10; //ms
// stRS485TxData[RS485_Tx_ID48_Idx].u8TxEnable = 1;
// }
// break;
// }
// case RS485_RECEIVE_ID_0X41:
// {
// if (stRS485RxVldData[RS485_Rx_ID41_Idx].u8Received == 0)
// {
// memcpy(stRS485RxVldData[RS485_Rx_ID41_Idx].u8RecVal, &RS485DataBuf[4 + u32RS485RxDataBegin], u32RS485RxDataValidLenTem);
// stRS485RxVldData[RS485_Rx_ID41_Idx].u8Received = 1;
// stRS485TxData[RS485_Tx_ID49_Idx].u8TxTime = 10; //ms
// stRS485TxData[RS485_Tx_ID49_Idx].u8TxEnable = 1;
// }
// break;
// }
// case RS485_RECEIVE_ID_0X42:
// {
// if (stRS485RxVldData[RS485_Rx_ID42_Idx].u8Received == 0)
// {
// memcpy(stRS485RxVldData[RS485_Rx_ID42_Idx].u8RecVal, &RS485DataBuf[4 + u32RS485RxDataBegin], u32RS485RxDataValidLenTem);
// stRS485RxVldData[RS485_Rx_ID42_Idx].u8Received = 1;
// stRS485TxData[RS485_Tx_ID4A_Idx].u8TxTime = 10; //ms
// stRS485TxData[RS485_Tx_ID4A_Idx].u8TxEnable = 1;
// }
// break;
// }
// case RS485_RECEIVE_ID_0X45:
// {
// {
// stRS485RxVldData[RS485_Rx_ID45_Idx].u8Received = 1;
// stRS485TxData[RS485_Tx_ID4D_Idx].u8TxTime = 10; //ms
// stRS485TxData[RS485_Tx_ID4D_Idx].u8TxEnable = 1;
// }
// break;
// }
// case OTA_MODE_RX_ID:
// ota_message_init(&stRS485DataRx.RS485Data[4], u32RS485RxDataValidLenTem);
// break;
// default:
// {
// break;
// }
// }
// u32RS485RxDataValidLen = u32RS485RxDataValidLenTem;
// u32RS485RxDataBegin += (u32RS485RxDataValidLenTem + 7);
// continue;
// }
// }
// else
// {
// break;
// }
// }
// if (u32RS485RxDataBegin > 0)
// {
// memcpy(RS485DataBuf, &RS485DataBuf[u32RS485RxDataBegin], (u32RS485DataBufLen - u32RS485RxDataBegin));
// u32RS485DataBufLen -= u32RS485RxDataBegin;
// }
// }
}
......@@ -568,37 +427,28 @@ void backsend(void)
*/
void R485_Timer_Handel(void)
{
// for (uint8_t i = 0; i < RS485_Rx_ID_Idx_Max; i++)
// {
// if (stRS485RxVldData[i].u8Status != R485_Lost)
// {
// if (stRS485RxVldData[i].u16LostTime <= R485_LOST_TIEMR_VAL)
// {
// stRS485RxVldData[i].u16LostTime++;
// }
// else
// {
// stRS485RxVldData[i].u8Status = R485_Lost;
// memset(stRS485RxVldData[i].u8RecVal, 0, RS485_RX_DATA_LEN);
// switch (i)
// {
// case RS485_Rx_ID40_Idx:
// memset(R485_ID40h.Msg, 0, RS485_RX_DATA_LEN);
// break;
// case RS485_Rx_ID41_Idx:
// memset(R485_ID41h.Msg, 0, RS485_RX_DATA_LEN);
// break;
// case RS485_Rx_ID42_Idx:
// memset(R485_ID42h.Msg, 0, RS485_RX_DATA_LEN);
// break;
// default:
// break;
// }
// }
// }
// }
}
}
// void send_bit(uint8_t bit)
// {
// if (bit)
// {
// set_pin_high();
// if(Delay_1500us_Flag ==1)
// {
// set_pin_low();
// } // 高电平1.5ms (逻辑"1"的T6)
// Delay_500us_Flag == 1;
// // 低电平0.5ms (逻辑"1"的T5)
// }
// else
// {
// set_pin_high();
// delay_ms(0.5); // 高电平0.5ms (逻辑"0"的T8)
// set_pin_low();
// delay_ms(1.5); // 低电平1.5ms (逻辑"0"的T7)
// }
// }
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