|
@@ -203,7 +203,7 @@ void power_voPowerManagement( _Bool ParaSaveEEFlg, _Bool PowerSleepFlg)
|
|
|
////////////////////////////////////////////////// on and standby ////////////////
|
|
|
if( power_stPowStateOut.uwPowerKeyMode ==1)
|
|
|
{
|
|
|
- if (((power_stPowStateOut.powerstate == POWER_START)||(power_stPowStateOut.powerstate == POWER_OFF_END))
|
|
|
+ if (((power_stPowStateOut.powerstate == POWER_START)||(power_stPowStateOut.blPowerShutdownFlg==TRUE) )
|
|
|
&& power_stPowStateOut.uwPowerKeySta != 0)
|
|
|
// if (power_stPowStateOut.powerstate == POWER_START )
|
|
|
{
|
|
@@ -225,6 +225,7 @@ if( power_stPowStateOut.uwPowerKeyMode ==1)
|
|
|
power_stPowStateOut.blPowerStartupFlg = TRUE;
|
|
|
power_stPowStateOut.uwPowerStartupCnt = 0;
|
|
|
power_stPowStateOut.uwPowerOn2OffCnt = 0;
|
|
|
+ power_stPowStateOut.blPowerShutdownFlg = FALSE;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -269,12 +270,13 @@ if( power_stPowStateOut.uwPowerKeyMode ==1)
|
|
|
&& (cp_stFlg.ParaHistorySaveEEFinishFlg == TRUE)
|
|
|
&& (ParaSaveEEFlg == FALSE))
|
|
|
{
|
|
|
- power_stPowStateOut.blPowerShutdownFlg = TRUE;
|
|
|
+
|
|
|
power_stPowStateOut.uwPowerShutdnCnt = 0;
|
|
|
Reset_POWER_LOCK_PORT();// GPIO_ResetBits(POWER_LOCK_PORT,POWER_LOCK_PIN);// iGpio_Write(HW_GPIO_POWERLOCK_PIN,ApiGpio_LowLevel);
|
|
|
- DL_WWDT_disablePower(WWDT0_INST);
|
|
|
- NVIC_SystemReset();
|
|
|
+ // DL_WWDT_disablePower(WWDT0_INST);
|
|
|
+ // NVIC_SystemReset();
|
|
|
//Power_KeyChangeHandle();
|
|
|
+ power_stPowStateOut.uwPowershutDownSta=1;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -305,6 +307,7 @@ else if(power_stPowStateOut.uwPowerKeyMode==2)
|
|
|
power_stPowStateOut.blPowerStartupFlg = TRUE;
|
|
|
power_stPowStateOut.uwPowerStartupCnt = 0;
|
|
|
power_stPowStateOut.uwPowerOn2OffCnt = 0;
|
|
|
+ power_stPowStateOut.blPowerShutdownFlg = FALSE;
|
|
|
}
|
|
|
}
|
|
|
else if (power_stPowStateOut.powerstate == POWER_ON_END)
|
|
@@ -352,19 +355,22 @@ else if(power_stPowStateOut.uwPowerKeyMode==2)
|
|
|
power_stPowStateOut.uwPowerShutdnCnt++;
|
|
|
if (power_stPowStateOut.uwPowerShutdnCnt >= power_stPowStateCof.uwPowerShutEndCnt && cp_stFlg.ParaHistorySaveEEFinishFlg == TRUE && ParaSaveEEFlg == FALSE)
|
|
|
{
|
|
|
- power_stPowStateOut.blPowerShutdownFlg = TRUE;
|
|
|
+
|
|
|
power_stPowStateOut.uwPowerShutdnCnt = 0;
|
|
|
Reset_POWER_LOCK_PORT();
|
|
|
- Power_KeyChangeHandle();
|
|
|
+ // Power_KeyChangeHandle();
|
|
|
+ if(power_stPowStateOut.uwPowerKeySta==0) //松开按键
|
|
|
+ power_stPowStateOut.uwPowershutDownSta=1;
|
|
|
}
|
|
|
if(power_stPowStateOut.uwPowerKeySta != 0)
|
|
|
{
|
|
|
if(++power_stPowStateOut.uwPOwerForceShutdnCnt>(power_stPowStateCof.uwPowerShutEndCnt+50))
|
|
|
{
|
|
|
- power_stPowStateOut.blPowerShutdownFlg = TRUE;
|
|
|
+
|
|
|
power_stPowStateOut.uwPowerShutdnCnt = 0;
|
|
|
Reset_POWER_LOCK_PORT();
|
|
|
- Power_KeyChangeHandle();
|
|
|
+ // Power_KeyChangeHandle();
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -385,6 +391,25 @@ else if(power_stPowStateOut.uwPowerKeyMode==2)
|
|
|
power_stPowStateOut.uwPowerShutdnCnt = 0;
|
|
|
}
|
|
|
|
|
|
+ }
|
|
|
+//--------------------------解决开机异常------
|
|
|
+if((power_stPowStateOut.powerstate == POWER_START) && (power_stPowStateOut.uwPowerKeySta == 0)) //供电下没有按下开机键
|
|
|
+{
|
|
|
+ if(++power_stPowStateOut.uwNulltime>500)
|
|
|
+ {
|
|
|
+ power_stPowStateOut.uwNulltime=0;
|
|
|
+ power_stPowStateOut.uwPowershutDownSta=1;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+else
|
|
|
+{
|
|
|
+ power_stPowStateOut.uwNulltime=0;
|
|
|
+}
|
|
|
+
|
|
|
+if(power_stPowStateOut.uwPowershutDownSta!=0)
|
|
|
+{
|
|
|
+ Power_KeyChangeHandle();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -394,7 +419,7 @@ void Power_KeyChangeHandle(void)
|
|
|
{
|
|
|
static UWORD uWPtime=0;
|
|
|
|
|
|
-if(uWPtime<=5000)
|
|
|
+if(uWPtime<=200)
|
|
|
{
|
|
|
uWPtime++;
|
|
|
DL_GPIO_initDigitalOutput(IOMUX_PINCM60);
|
|
@@ -404,10 +429,14 @@ if(uWPtime<=5000)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if(uWPtime<5002)
|
|
|
+ //if(uWPtime<50)
|
|
|
{
|
|
|
- uWPtime=5005;
|
|
|
+ uWPtime=0;
|
|
|
SYSCFG_DL_ADC12_0_init();
|
|
|
+ DL_WWDT_disablePower(WWDT0_INST);
|
|
|
+ NVIC_SystemReset();
|
|
|
+ power_stPowStateOut.uwPowershutDownSta=0;
|
|
|
+ power_stPowStateOut.blPowerShutdownFlg = TRUE;
|
|
|
}
|
|
|
|
|
|
}
|