Commit 060a98d8 authored by 何锐's avatar 何锐

feat:初版程序基本完成

parent 8e3d105a
...@@ -402,9 +402,16 @@ INT16U time_3s = 0; ...@@ -402,9 +402,16 @@ INT16U time_3s = 0;
if((Key.Time_1 > T_50ms)&&( Key.Time_1 < T_1s)) if((Key.Time_1 > T_50ms)&&( Key.Time_1 < T_1s))
{ {
if(Key_Dodging_flag) if(Key_Dodging_flag)
{
if(Key.CAN_Step < 10)
{ {
Key.CAN_Step++; Key.CAN_Step++;
} }
else
{
Key.CAN_Step = 1;
}
}
} }
else if(Key.Time_1 > T_2s) else if(Key.Time_1 > T_2s)
{ {
...@@ -421,10 +428,13 @@ INT16U time_3s = 0; ...@@ -421,10 +428,13 @@ INT16U time_3s = 0;
if((Key.Time_2 > T_50ms)&&( Key.Time_2 < T_1s)) if((Key.Time_2 > T_50ms)&&( Key.Time_2 < T_1s))
{ {
if(Key_Dodging_flag) if(Key_Dodging_flag)
{
if(Key.CAN_Step > 0)
{ {
Key.CAN_Step--; Key.CAN_Step--;
} }
} }
}
else if(Key.Time_2 > T_2s) else if(Key.Time_2 > T_2s)
{ {
Key.Flag_2 = 1; Key.Flag_2 = 1;
...@@ -456,10 +466,10 @@ INT16U time_3s = 0; ...@@ -456,10 +466,10 @@ INT16U time_3s = 0;
} }
if(RT_10ms >= 10){ if(RT_10ms >= 10){
if(Key.CAN_Step>12||Key.CAN_Step<1) // if(Key.CAN_Step>10||Key.CAN_Step<1)
{ // {
Key.CAN_Step = 1; // Key.CAN_Step = 1;
} // }
RT_10ms_En = 1; RT_10ms_En = 1;
RT_10ms = null; RT_10ms = null;
} }
...@@ -509,9 +519,16 @@ INT16U time_3s = 0; ...@@ -509,9 +519,16 @@ INT16U time_3s = 0;
if(time_3s>2) if(time_3s>2)
{ {
time_3s = 0; time_3s = 0;
if(Key.CAN_Step > 10)
{
Key.CAN_Step = 1;
}
else
{
Key.CAN_Step++; Key.CAN_Step++;
} }
} }
}
RT_1s = null; RT_1s = null;
} }
......
...@@ -107,7 +107,17 @@ void Format_CAN_Msg() ...@@ -107,7 +107,17 @@ void Format_CAN_Msg()
CanMsg_042.ID = 0x042; CanMsg_042.ID = 0x042;
CanMsg_480.ID = 0x480; CanMsg_480.ID = 0x480;
CanMsg_021.ID = 0x021; CanMsg_021.ID = 0x021;
CanMsg_001.ID = 0x001; CanMsg_0A33FFE3.ID = 0x0A33FFE3;
CanMsg_0A10FFE0.ID = 0x0A10FFE0;
CanMsg_0A10FFE1.ID = 0x0A10FFE1;
CanMsg_0A20FFE2.ID = 0x0A20FFE2;
CanMsg_0A30FFE8.ID = 0x0A30FFE8;
CanMsg_0A31FFE3.ID = 0x0A31FFE3;
CanMsg_0A30FFE3.ID = 0x0A30FFE3;
CanMsg_0A32FFE4.ID = 0x0A32FFE4;
CanMsg_0A37FFE3.ID = 0x0A37FFE3;
CanMsg_0A18FFE0.ID = 0x0A18FFE0;
CanMsg_0A40FFE2.ID = 0x0A40FFE2;
CanMsg_101.Length = 8; CanMsg_101.Length = 8;
CanMsg_067.Length = 8; CanMsg_067.Length = 8;
...@@ -122,8 +132,17 @@ void Format_CAN_Msg() ...@@ -122,8 +132,17 @@ void Format_CAN_Msg()
CanMsg_042.Length = 8; CanMsg_042.Length = 8;
CanMsg_480.Length = 8; CanMsg_480.Length = 8;
CanMsg_021.Length = 8; CanMsg_021.Length = 8;
CanMsg_001.Length = 8; CanMsg_0A33FFE3.Length = 8;
CanMsg_0A10FFE0.Length = 8;
CanMsg_0A10FFE1.Length = 8;
CanMsg_0A20FFE2.Length = 8;
CanMsg_0A30FFE8.Length = 8;
CanMsg_0A31FFE3.Length = 8;
CanMsg_0A30FFE3.Length = 8;
CanMsg_0A32FFE4.Length = 8;
CanMsg_0A37FFE3.Length = 8;
CanMsg_0A18FFE0.Length = 8;
CanMsg_0A40FFE2.Length = 8;
CanMsg_101.ID_EN = 1; CanMsg_101.ID_EN = 1;
...@@ -139,7 +158,17 @@ void Format_CAN_Msg() ...@@ -139,7 +158,17 @@ void Format_CAN_Msg()
CanMsg_042.ID_EN = 1; CanMsg_042.ID_EN = 1;
CanMsg_480.ID_EN = 1; CanMsg_480.ID_EN = 1;
CanMsg_021.ID_EN = 1; CanMsg_021.ID_EN = 1;
CanMsg_001.ID_EN = 1; CanMsg_0A33FFE3.ID_EN = 1;
CanMsg_0A10FFE0.ID_EN = 1;
CanMsg_0A10FFE1.ID_EN = 1;
CanMsg_0A20FFE2.ID_EN = 1;
CanMsg_0A30FFE8.ID_EN = 1;
CanMsg_0A31FFE3.ID_EN = 1;
CanMsg_0A30FFE3.ID_EN = 1;
CanMsg_0A32FFE4.ID_EN = 1;
CanMsg_0A37FFE3.ID_EN = 1;
CanMsg_0A18FFE0.ID_EN = 1;
CanMsg_0A40FFE2.ID_EN = 1;
} }
void Disable_CAN_Tx(void) void Disable_CAN_Tx(void)
...@@ -157,7 +186,7 @@ void Disable_CAN_Tx(void) ...@@ -157,7 +186,7 @@ void Disable_CAN_Tx(void)
CanMsg_042.ID_EN = 0; CanMsg_042.ID_EN = 0;
CanMsg_480.ID_EN = 0; CanMsg_480.ID_EN = 0;
CanMsg_021.ID_EN = 0; CanMsg_021.ID_EN = 0;
CanMsg_001.ID_EN = 0; CanMsg_0A33FFE3.ID_EN = 0;
} }
void Set_Pin(INT16U pin) void Set_Pin(INT16U pin)
...@@ -184,13 +213,11 @@ void App_Can_Proc(void) ...@@ -184,13 +213,11 @@ void App_Can_Proc(void)
Message_Value_Calculate(CAN_List[i]); Message_Value_Calculate(CAN_List[i]);
} }
if(GetCtrlTime(CANMsgSend_10ms) >= 10)
if(GetCtrlTime(CANMsgSend_10ms) >= 10){ {
ClearCtrlTime(CANMsgSend_10ms); ClearCtrlTime(CANMsgSend_10ms);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_042); bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_0A30FFE8);
Clear_CAN_Msg((CAN_message *)&CanMsg_042); Clear_CAN_Msg((CAN_message *)&CanMsg_0A30FFE8);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_001);
Clear_CAN_Msg((CAN_message *)&CanMsg_001);
} }
if(GetCtrlTime(CANMsgSend_20ms) >= 20){ if(GetCtrlTime(CANMsgSend_20ms) >= 20){
...@@ -205,14 +232,25 @@ void App_Can_Proc(void) ...@@ -205,14 +232,25 @@ void App_Can_Proc(void)
if(GetCtrlTime(CANMsgSend_50ms) >= 50){ if(GetCtrlTime(CANMsgSend_50ms) >= 50){
ClearCtrlTime(CANMsgSend_50ms); ClearCtrlTime(CANMsgSend_50ms);
if(Key.CAN_Step != 0)
{
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_0A10FFE0);
Clear_CAN_Msg((CAN_message *)&CanMsg_0A10FFE0);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_0A10FFE1);
Clear_CAN_Msg((CAN_message *)&CanMsg_0A10FFE1);
}
} }
if(GetCtrlTime(CANMsgSend_100ms) >= 100){ if(GetCtrlTime(CANMsgSend_100ms) >= 100){
ClearCtrlTime(CANMsgSend_100ms); ClearCtrlTime(CANMsgSend_100ms);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_600); bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_0A31FFE3);
Clear_CAN_Msg((CAN_message *)&CanMsg_600); Clear_CAN_Msg((CAN_message *)&CanMsg_0A31FFE3);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_200); bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_0A30FFE3);
Clear_CAN_Msg((CAN_message *)&CanMsg_200); Clear_CAN_Msg((CAN_message *)&CanMsg_0A30FFE3);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_0A33FFE3);
Clear_CAN_Msg((CAN_message *)&CanMsg_0A33FFE3);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_0A20FFE2);
Clear_CAN_Msg((CAN_message *)&CanMsg_0A20FFE2);
if(electricityclose == 0) if(electricityclose == 0)
{ {
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_020); bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_020);
...@@ -228,13 +266,18 @@ void App_Can_Proc(void) ...@@ -228,13 +266,18 @@ void App_Can_Proc(void)
if(GetCtrlTime(CANMsgSend_200ms) >= 200){ if(GetCtrlTime(CANMsgSend_200ms) >= 200){
ClearCtrlTime(CANMsgSend_200ms); ClearCtrlTime(CANMsgSend_200ms);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_0A32FFE4);
Clear_CAN_Msg((CAN_message *)&CanMsg_0A32FFE4);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_0A37FFE3);
Clear_CAN_Msg((CAN_message *)&CanMsg_0A37FFE3);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_0A18FFE0);
Clear_CAN_Msg((CAN_message *)&CanMsg_0A18FFE0);
} }
if(GetCtrlTime(CANMsgSend_500ms) >= 500){ if(GetCtrlTime(CANMsgSend_500ms) >= 500){
flash_1Hz_process(); flash_1Hz_process();
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_611); bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_0A40FFE2);
Clear_CAN_Msg((CAN_message *)&CanMsg_611); Clear_CAN_Msg((CAN_message *)&CanMsg_0A40FFE2);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_481); bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_481);
Clear_CAN_Msg((CAN_message *)&CanMsg_481); Clear_CAN_Msg((CAN_message *)&CanMsg_481);
bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_480); bReturn = Api_CANSendFrame((CAN_message *)&CanMsg_480);
...@@ -300,6 +343,8 @@ void App_Can_Proc(void) ...@@ -300,6 +343,8 @@ void App_Can_Proc(void)
CurValueStr[Gear ].val = 0; CurValueStr[Gear ].val = 0;
CurValueStr[Bluetooth_phone ].val = 0; CurValueStr[Bluetooth_phone ].val = 0;
CurValueStr[year ].val = 0; CurValueStr[year ].val = 0;
CurValueStr[Vvspeed_H ].val = 0;
CurValueStr[Vvspeed_L ].val = 0;
CurValueStr[ENUM_VSpeed ].fval = Value_Plus; CurValueStr[ENUM_VSpeed ].fval = Value_Plus;
CurValueStr[ECM_FaultIndicator ].fval = Value_Plus; CurValueStr[ECM_FaultIndicator ].fval = Value_Plus;
...@@ -337,6 +382,8 @@ void App_Can_Proc(void) ...@@ -337,6 +382,8 @@ void App_Can_Proc(void)
CurValueStr[Gear ].fval = Value_Plus; CurValueStr[Gear ].fval = Value_Plus;
CurValueStr[Bluetooth_phone ].fval = Value_Plus; CurValueStr[Bluetooth_phone ].fval = Value_Plus;
CurValueStr[year ].fval = Value_Plus; CurValueStr[year ].fval = Value_Plus;
CurValueStr[Vvspeed_H ].fval = Value_Plus;
CurValueStr[Vvspeed_L ].fval = Value_Plus;
// CurVehSpeed = 0; // CurVehSpeed = 0;
//LDW Open //LDW Open
......
This diff is collapsed.
...@@ -71,7 +71,6 @@ enum ...@@ -71,7 +71,6 @@ enum
TCS_crotrul, TCS_crotrul,
TCS_mode, TCS_mode,
TCS_light, TCS_light,
GPS,
signal_4G, signal_4G,
Battery_over, Battery_over,
Motor_overheating, Motor_overheating,
...@@ -79,7 +78,24 @@ enum ...@@ -79,7 +78,24 @@ enum
Gear, Gear,
Bluetooth_phone, Bluetooth_phone,
year, year,
Vvspeed_H,
Vvspeed_L,
Electricity_H,
Electricity_L,
Electricity_h,
Electricity_l,
Sidebrace, //侧撑
cruise, //巡航
ABS,
TCS,
Tire_pressure,
Bluetooth,
GPS,
Callalert, //来电提醒
GMS, //来电提醒
Parallelsignals, //并联信号
Enginefailure, //发动机故障
P_dang,
CAN_List_Num, CAN_List_Num,
}; };
...@@ -120,12 +136,37 @@ static const s_CAN_List CAN_List[] = ...@@ -120,12 +136,37 @@ static const s_CAN_List CAN_List[] =
{&CanMsg_480, 1, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[GPS ], Motorola}, {&CanMsg_480, 1, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[GPS ], Motorola},
{&CanMsg_480, 0, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[signal_4G ], Motorola}, {&CanMsg_480, 0, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[signal_4G ], Motorola},
{&CanMsg_021, 5, 7, 1, 0, Offset_Plus, 1, 1, &CurValueStr[Battery_over ], Motorola}, {&CanMsg_021, 5, 7, 1, 0, Offset_Plus, 1, 1, &CurValueStr[Battery_over ], Motorola},
{&CanMsg_001, 2, 4, 1, 0, Offset_Plus, 1, 1, &CurValueStr[Motor_overheating ], Motorola},
{&CanMsg_202, 1, 6, 1, 0, Offset_Plus, 1, 1, &CurValueStr[Cruise_control ], Motorola}, {&CanMsg_202, 1, 6, 1, 0, Offset_Plus, 1, 1, &CurValueStr[Cruise_control ], Motorola},
{&CanMsg_202, 0, 2, 2, 0, Offset_Plus, 1, 1, &CurValueStr[Gear ], Motorola}, {&CanMsg_202, 0, 2, 2, 0, Offset_Plus, 1, 1, &CurValueStr[Gear ], Motorola},
{&CanMsg_480, 2, 6, 1, 0, Offset_Plus, 1, 1, &CurValueStr[Bluetooth_phone ], Motorola}, {&CanMsg_480, 2, 6, 1, 0, Offset_Plus, 1, 1, &CurValueStr[Bluetooth_phone ], Motorola},
{&CanMsg_481, 0, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[year ], Motorola}, {&CanMsg_481, 0, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[year ], Motorola},
{&CanMsg_0A33FFE3, 0, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[Vvspeed_L ], Motorola},
{&CanMsg_0A33FFE3, 1, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[Vvspeed_H ], Motorola},
{&CanMsg_0A10FFE0, 3, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[Electricity_H ], Motorola},
{&CanMsg_0A10FFE0, 2, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[Electricity_L ], Motorola},
{&CanMsg_0A10FFE1, 3, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[Electricity_h ], Motorola},
{&CanMsg_0A10FFE1, 2, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[Electricity_l ], Motorola},
{&CanMsg_0A20FFE2, 1, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[Sidebrace ], Motorola},
{&CanMsg_0A20FFE2, 4, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[cruise ], Motorola},
{&CanMsg_0A30FFE8, 0, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[ABS ], Motorola},
{&CanMsg_0A31FFE3, 4, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[Tire_pressure ], Motorola},
{&CanMsg_0A30FFE3, 7, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[Bluetooth ], Motorola},
{&CanMsg_0A32FFE4, 0, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[GPS ], Motorola},
{&CanMsg_0A37FFE3, 7, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[Callalert ], Motorola},
{&CanMsg_0A18FFE0, 0, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[Parallelsignals ], Motorola},
{&CanMsg_0A40FFE2, 0, 0, 8, 0, Offset_Plus, 1, 1, &CurValueStr[Enginefailure ], Motorola},
{&CanMsg_0A20FFE2, 0, 4, 2, 0, Offset_Plus, 1, 1, &CurValueStr[P_dang ], Motorola},
}; };
extern unsigned int Key_Dodging_flag; extern unsigned int Key_Dodging_flag;
......
...@@ -121,7 +121,17 @@ ...@@ -121,7 +121,17 @@
EXTERN_VAR CAN_message CanMsg_042; EXTERN_VAR CAN_message CanMsg_042;
EXTERN_VAR CAN_message CanMsg_480; EXTERN_VAR CAN_message CanMsg_480;
EXTERN_VAR CAN_message CanMsg_021; EXTERN_VAR CAN_message CanMsg_021;
EXTERN_VAR CAN_message CanMsg_001; EXTERN_VAR CAN_message CanMsg_0A33FFE3;
EXTERN_VAR CAN_message CanMsg_0A10FFE0;
EXTERN_VAR CAN_message CanMsg_0A10FFE1;
EXTERN_VAR CAN_message CanMsg_0A20FFE2;
EXTERN_VAR CAN_message CanMsg_0A30FFE8;
EXTERN_VAR CAN_message CanMsg_0A31FFE3;
EXTERN_VAR CAN_message CanMsg_0A30FFE3;
EXTERN_VAR CAN_message CanMsg_0A32FFE4;
EXTERN_VAR CAN_message CanMsg_0A37FFE3;
EXTERN_VAR CAN_message CanMsg_0A18FFE0;
EXTERN_VAR CAN_message CanMsg_0A40FFE2;
extern CAN_message CanMsg_101; extern CAN_message CanMsg_101;
extern CAN_message CanMsg_067; extern CAN_message CanMsg_067;
...@@ -136,7 +146,17 @@ ...@@ -136,7 +146,17 @@
extern CAN_message CanMsg_042; extern CAN_message CanMsg_042;
extern CAN_message CanMsg_480; extern CAN_message CanMsg_480;
extern CAN_message CanMsg_021; extern CAN_message CanMsg_021;
extern CAN_message CanMsg_001; extern CAN_message CanMsg_0A33FFE3;
extern CAN_message CanMsg_0A10FFE0;
extern CAN_message CanMsg_0A10FFE1;
extern CAN_message CanMsg_0A20FFE2;
extern CAN_message CanMsg_0A30FFE8;
extern CAN_message CanMsg_0A31FFE3;
extern CAN_message CanMsg_0A30FFE3;
extern CAN_message CanMsg_0A32FFE4;
extern CAN_message CanMsg_0A37FFE3;
extern CAN_message CanMsg_0A18FFE0;
extern CAN_message CanMsg_0A40FFE2;
/**/ /**/
/*:zh*/ /*:zh*/
......
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