Commit a842a1bb authored by 王佳伟's avatar 王佳伟

feat:291D老化台新增按键消抖

parent aff013f0
......@@ -46,65 +46,62 @@ void Api_LCD_Init(void)
--------------------------------------------------------------------------*/
void Api_LCD_Display(void)
{
LCDFP11BP = Matrix1[(Key.CAN_Step / 10) %10]>>4;
LCDFP12BP = Matrix1[(Key.CAN_Step / 10) %10];
LCDFP13BP = Matrix1[(Key.CAN_Step % 10)]>>4;
LCDFP14BP = Matrix1[(Key.CAN_Step % 10)];
LCDFP11BP = Matrix1[Key_Dodging_flag]>>4;
LCDFP12BP = Matrix1[Key_Dodging_flag];
if(RunStep > 23)
{
LCDFP19BP = Matrix1[((Key.CAN_Step -24) / 10) %10]>>4;
LCDFP20BP = Matrix1[((Key.CAN_Step -24) / 10) %10];
// if(RunStep > 23)
// {
// LCDFP19BP = Matrix1[((Key.CAN_Step -24) / 10) %10]>>4;
// LCDFP20BP = Matrix1[((Key.CAN_Step -24) / 10) %10];
LCDFP21BP = Matrix1[((Key.CAN_Step -24) % 10)]>>4;
LCDFP22BP = Matrix1[((Key.CAN_Step -24) % 10)];
}
else
{
LCDFP19BP = Matrix1[0]>>4;
LCDFP20BP = Matrix1[0];
// LCDFP21BP = Matrix1[((Key.CAN_Step -24) % 10)]>>4;
// LCDFP22BP = Matrix1[((Key.CAN_Step -24) % 10)];
// }
// else
// {
// LCDFP19BP = Matrix1[0]>>4;
// LCDFP20BP = Matrix1[0];
LCDFP21BP = Matrix1[0]>>4;
LCDFP22BP = Matrix1[0];
}
//L
LCDFP18BP |= 0x08;
LCDFP20BP |= 0x08;
LCDFP22BP |= 0x08;
//E
LCDFP5BP |= 0x0f;
LCDFP6BP |= 0x01;
//D
LCDFP7BP |= 0x0d;
LCDFP8BP |= 0x07;
//-
LCDFP9BP |= 0x02;
//Z
LCDFP15BP |= Matrix1[2]>>4;
LCDFP16BP |= Matrix1[2];
//H
LCDFP17BP |= 0x07;
LCDFP18BP |= 0x0e;
// LCDFP21BP = Matrix1[0]>>4;
// LCDFP22BP = Matrix1[0];
// }
// //L
// LCDFP18BP |= 0x08;
// LCDFP20BP |= 0x08;
// LCDFP22BP |= 0x08;
// //E
// LCDFP5BP |= 0x0f;
// LCDFP6BP |= 0x01;
// //D
// LCDFP7BP |= 0x0d;
// LCDFP8BP |= 0x07;
// //-
// LCDFP9BP |= 0x02;
// //Z
// LCDFP15BP |= Matrix1[2]>>4;
// LCDFP16BP |= Matrix1[2];
// //H
// LCDFP17BP |= 0x07;
// LCDFP18BP |= 0x0e;
LCDRAM2_FP4BP = LCDFP4BP;
LCDRAM2_FP5BP = LCDFP5BP;
LCDRAM3_FP6BP = LCDFP6BP;
LCDRAM3_FP7BP = LCDFP7BP;
LCDRAM4_FP8BP = LCDFP8BP;
LCDRAM4_FP9BP = LCDFP9BP;
LCDRAM5_FP10BP = LCDFP10BP;
LCDRAM5_FP11BP = LCDFP11BP;
LCDRAM6_FP12BP = LCDFP12BP;
LCDRAM6_FP13BP = LCDFP13BP;
LCDRAM7_FP14BP = LCDFP14BP;
LCDRAM7_FP15BP = LCDFP15BP;
LCDRAM8_FP16BP = LCDFP16BP;
LCDRAM8_FP17BP = LCDFP17BP;
LCDRAM9_FP18BP = LCDFP18BP;
LCDRAM9_FP19BP = LCDFP19BP;
LCDRAM10_FP20BP = LCDFP20BP;
LCDRAM10_FP21BP = LCDFP21BP;
LCDRAM11_FP22BP = LCDFP22BP;
// LCDRAM2_FP4BP = LCDFP4BP;
// LCDRAM2_FP5BP = LCDFP5BP;
// LCDRAM3_FP6BP = LCDFP6BP;
// LCDRAM3_FP7BP = LCDFP7BP;
// LCDRAM4_FP8BP = LCDFP8BP;
// LCDRAM4_FP9BP = LCDFP9BP;
// LCDRAM5_FP10BP = LCDFP10BP;
LCDRAM5_FP11BP = LCDFP11BP;
LCDRAM6_FP12BP = LCDFP12BP;
// LCDRAM6_FP13BP = LCDFP13BP;
// LCDRAM7_FP14BP = LCDFP14BP;
// LCDRAM7_FP15BP = LCDFP15BP;
// LCDRAM8_FP16BP = LCDFP16BP;
// LCDRAM8_FP17BP = LCDFP17BP;
// LCDRAM9_FP18BP = LCDFP18BP;
// LCDRAM9_FP19BP = LCDFP19BP;
// LCDRAM10_FP20BP = LCDFP20BP;
// LCDRAM10_FP21BP = LCDFP21BP;
// LCDRAM11_FP22BP = LCDFP22BP;
}
\ No newline at end of file
......@@ -364,12 +364,97 @@ INT16U time_3s = 0;
RT_2s++;
if(pSB1 == 0){
Key.PushTime_1++;
}
Key.PushTime_1++;
Key.PullTime_1 = 0;
Key.Status_1 = 1;
}else
{
Key.PullTime_1++;
if((Key.PullTime_1 >20))
{
Key.Time_1 = Key.PushTime_1;
Key.Status_1 = 0;
Key.PullTime_1 = 0;
Key.PushTime_1 = 0;
}
}
if(pSB2 == 0){
Key.PushTime_2++;
Key.PullTime_2 = 0;
Key.Status_2 = 1;
}else
{
Key.PullTime_2 ++;
if((Key.PullTime_2 >20))
{
Key.Time_2 = Key.PushTime_2;
Key.Status_2 = 0;
Key.PullTime_2 = 0;
Key.PushTime_2 = 0;
}
}
if(Key.Last_Status_1 != Key.Status_1)
{
if((Key.Last_Status_1 == 1)&&(Key.Status_1 ==0))
{
if((Key.Time_1 > T_50ms)&&( Key.Time_1 < T_1s))
{
if(Key_Dodging_flag)
{
Key.CAN_Step++;
}
}
else if(Key.Time_1 > T_2s)
{
Key.Flag_1 = 1;
}
}
Key.Time_1 =0;
Key.Last_Status_1 = Key.Status_1;
}
if(Key.Last_Status_2 != Key.Status_2)
{
if((Key.Last_Status_2 == 1)&&(Key.Status_2 ==0))
{
if((Key.Time_2 > T_50ms)&&( Key.Time_2 < T_1s))
{
if(Key_Dodging_flag)
{
Key.CAN_Step--;
}
}
else if(Key.Time_2 > T_2s)
{
Key.Flag_2 = 1;
}
}
Key.Time_2 =0;
Key.Last_Status_2 = Key.Status_2;
}
if((Key.Flag_1 == 1)&&(Key.Flag_2 == 1))
{
Key.Flag_1 = 0;
Key.Flag_2 = 0;
if(Key_Dodging_flag == 0)
{
Key_Dodging_flag = 1;
}
else
{
Key_Dodging_flag = 0;
}
}
if((Key.Flag_1 == 1)&&(Key.PullTime_1 >T_1s))
{
Key.Flag_1 = 0;
}
if((Key.Flag_2 == 1)&&(Key.PullTime_2 >T_1s))
{
Key.Flag_2 = 0;
}
if(RT_10ms >= 10){
if(Key.CAN_Step>12||Key.CAN_Step<1)
{
......
......@@ -38,50 +38,7 @@ unsigned int Self_propelled_flag = 0;//
unsigned int Key_Dodging_flag = 1;//
unsigned int speed_value = 0;
void APP_Button_Proc(void){
/*if(Key.PushTime_1 > T_3s){
Key.StepAuto = 1;
}
if(Key.PushTime_2 > T_3s){
Key.StepAuto = 2;
}*/
if((Key.PushTime_2 > T_2s) && (Key.PushTime_1 > T_2s)){
if(Key_Dodging_flag)
{
Key_Dodging_flag = 0;
}
else
{
Key_Dodging_flag = 1;
}
}
if(pSB1 == 1){
if(Key.PushTime_1 > T_50ms){
if(Key_Dodging_flag)
{
Key.CAN_Step++;
}
// Key.CAN_Step++;
// if(Key.CAN_Step > STEP_MAX){
// Key.CAN_Step = 0;
// }
}
Key.PushTime_1 = null;
}
if(pSB2 == 1){
if(Key.PushTime_2 > T_50ms){
if(Key_Dodging_flag==1)
{
Key.CAN_Step--;
}
}
Key.PushTime_2 = null;
}
;
}
......@@ -333,28 +290,27 @@ void APP_ICM_Proc(void) /*zh321*/ /*FS04*/
CurValueStr[Battery_Current ].val = -100;
CurValueStr[Battery_SOC ].val = 100;
}break;
#if 0
case 12:
{
CurValueStr[ENUM_VSpeed ].val = 1840;
CurValueStr[ECM_FaultIndicator ].val = 0;
CurValueStr[ECM_FaultIndicator ].val = 1;
CurValueStr[ECM_StautsInvalid ].val = 0;
CurValueStr[ECM_MotorOver ].val = 0;
CurValueStr[ECM_ReadyIndicator ].val = 0;
CurValueStr[ECM_ChargeStatus ].val = 0;
CurValueStr[ECM_CruiseStatus ].val = 0;
CurValueStr[ECM_GearPositionStatus ].val = 2;
CurValueStr[ECM_ReadyIndicator ].val = 1;
CurValueStr[ECM_ChargeStatus ].val = 1;
CurValueStr[ECM_CruiseStatus ].val = 1;
CurValueStr[ECM_GearPositionStatus ].val = 3;
CurValueStr[PFC_Relag ].val = 0;
CurValueStr[LLC_UnderOutput ].val = 0;
CurValueStr[LLC_OverOutput ].val = 0;
CurValueStr[LLC_OutPut ].val = 0;
CurValueStr[PFC_LLC_Interal_Communication].val = 0;
CurValueStr[LLC_Temp ].val = 0;
CurValueStr[Battery_status ].val = 0;
CurValueStr[Battery_status ].val = 0x10;
CurValueStr[Battery_Current ].val = -100;
CurValueStr[Battery_SOC ].val = 100;
CurValueStr[Battery_SOC ].val = 0;
}break;
#if 0
case 12:
{
CurValueStr[ENUM_VSpeed ].val = speed_value;//
......
......@@ -223,8 +223,18 @@
typedef struct
{
INT16U Time_1;
INT16U Flag_1;
INT16U Time_2;
INT16U Flag_2;
INT16U Status_1;
INT16U Last_Status_1;
INT16U Status_2;
INT16U Last_Status_2;
INT16U PushTime_1;
INT16U PushTime_2;
INT16U PullTime_1;
INT16U PullTime_2;
INT8U CAN_Step;
INT8U StepAuto;
INT8U CheckDispOk;
......
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