|
@@ -245,7 +245,8 @@ static void _Task_KeyScan(void)
|
|
|
//Key_Up按键处理
|
|
|
if(Key_Up.KeyStatus != Key_Status_NoPress )
|
|
|
{
|
|
|
- if(Key_Up.KeyStatus == Key_Status_ShortPress)//短按
|
|
|
+ #if 0 //长按进入SMART,短按退出
|
|
|
+ if(Key_Up.KeyStatus == Key_Status_ShortPress)//短按
|
|
|
{
|
|
|
Key_Up.KeyStatus = Key_Status_NoPress;
|
|
|
//按键测试模式,按键置位
|
|
@@ -288,6 +289,40 @@ static void _Task_KeyScan(void)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ #else //短按进入SMART
|
|
|
+ if(Key_Up.KeyStatus == Key_Status_ShortPress)//短按
|
|
|
+ {
|
|
|
+ Key_Up.KeyStatus = Key_Status_NoPress;
|
|
|
+ //按键测试模式,按键置位
|
|
|
+ if(PBU_RunMode == PBU_RunMode_CDL_KeyTest)
|
|
|
+ {
|
|
|
+ PBU_Test_Process.KeyTest_Status.Status_Bit.Add = 1;
|
|
|
+ }
|
|
|
+ //助力控制模式,调节档位
|
|
|
+ else if(PBU_RunMode == PBU_RunMode_MC_AssisitCtrl)
|
|
|
+ {
|
|
|
+ if(PBU_AssitMode_Status.PBU_AssistMode_Flag == PBU_AssistMode_Flag_Gear)
|
|
|
+ {
|
|
|
+ if(ControlCode.GearSt < PBU_ConfigParam.GearsNum) //0~4档
|
|
|
+ {
|
|
|
+ ControlCode.GearSt++;
|
|
|
+ PBU_AssitMode_Status.GearStBak_Smart++;
|
|
|
+ PBU_AssitMode_Status.GearStBak_Walk++;
|
|
|
+ }
|
|
|
+ else //到达4档后再次按下,会一直停留在SMART
|
|
|
+ {
|
|
|
+ PBU_AssitMode_Status.PBU_AssistMode_Flag = PBU_AssistMode_Flag_Smart;
|
|
|
+ PBU_AssitMode_Status.GearStBak_Smart = ControlCode.GearSt;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(Key_Up.KeyStatus == Key_Status_LongPress)//长按
|
|
|
+ {
|
|
|
+ Key_Up.KeyStatus = Key_Status_NoPress;
|
|
|
+ //...
|
|
|
+ }
|
|
|
+ #endif
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -372,6 +407,7 @@ void HAL_SYSTICK_Callback(void)
|
|
|
static uint16_t TimeCnt_50ms = 0;
|
|
|
// static uint16_t TimeCnt_100ms = 0;
|
|
|
static uint16_t TimeCnt_1000ms = 0;
|
|
|
+ static uint16_t TimeCnt_60000ms = 0;
|
|
|
|
|
|
Scan_Key_ADC_Error();
|
|
|
// Vin_test_Check();
|
|
@@ -422,7 +458,7 @@ void HAL_SYSTICK_Callback(void)
|
|
|
TimeCnt_1000ms = 0;
|
|
|
//更新ADC转换结果
|
|
|
// _Task_ADC_Update();
|
|
|
- HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_9);
|
|
|
+ HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_9);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -430,6 +466,15 @@ void HAL_SYSTICK_Callback(void)
|
|
|
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_9,GPIO_PIN_SET);
|
|
|
}
|
|
|
|
|
|
+ //60s任务
|
|
|
+ TimeCnt_60000ms++;
|
|
|
+ if(TimeCnt_60000ms >= 60000)
|
|
|
+ {
|
|
|
+ TimeCnt_60000ms = 0;
|
|
|
+ //运行时间记录
|
|
|
+ PBU_RunLog.RunTime++;
|
|
|
+ }
|
|
|
+
|
|
|
MC_error_cnt++;
|
|
|
if(MC_error_cnt >= 3000)
|
|
|
{
|
|
@@ -460,7 +505,7 @@ void PBU_RunMode_Process(PBU_RunMode_t RunMode)
|
|
|
else
|
|
|
{
|
|
|
// ControlCode.GearSt = 0x00;
|
|
|
- if(TimeCntDiff_5ms(PBU_AssitMode_Status.WalkDelayTimeCnt) > 600)//³¬Ê±600 * 5 = 3s£¬»Ö¸´ÖúÁ¦µµÎ»
|
|
|
+ if(TimeCntDiff_5ms(PBU_AssitMode_Status.WalkDelayTimeCnt) > 2000) //超时2000 * 500 = 10s自动退出Walk等待
|
|
|
{
|
|
|
ControlCode.GearSt = PBU_AssitMode_Status.GearStBak_Walk;
|
|
|
if(PBU_AssitMode_Status.IsSmartEtrWalk_Flag == TRUE)
|
|
@@ -785,8 +830,8 @@ void PBU_Error_Process(void)
|
|
|
static uint32_t SendCodeTimeCnt = 0;
|
|
|
|
|
|
if(PBU_RunMode != PBU_RunMode_Updating)
|
|
|
- {
|
|
|
- PBU_ErrorCode.Code=(PBU_ErrorCode.Code|PBU_hardwareErrorCode.Code|PBU_commErrorCode.Code);//|PBU_TE_ErrorCode.Code);
|
|
|
+ {
|
|
|
+ PBU_ErrorCode.Code = PBU_hardwareErrorCode.Code | PBU_commErrorCode.Code;
|
|
|
PBU_Error_senddata=PBU_ErrorCode.Code;
|
|
|
if(PBU_Error_senddata != 0)
|
|
|
{
|