|
@@ -98,7 +98,7 @@ static void MainTask(void* arg)
|
|
|
int32_t inParam = 0xAABBCCDD;
|
|
|
UINT32 param;
|
|
|
UINT32 adcValue;
|
|
|
- UINT8 i=0;
|
|
|
+ UINT8 Adcindex=0;
|
|
|
slpManSetPmuSleepMode(true,SLP_HIB_STATE,false);
|
|
|
slpManApplyPlatVoteHandle("MainSlp",&MainSlpHandler);
|
|
|
slpManPlatVoteDisableSleep(MainSlpHandler, SLP_SLP1_STATE);
|
|
@@ -227,6 +227,16 @@ static void MainTask(void* arg)
|
|
|
}
|
|
|
osMutexRelease(Error_Mutex);
|
|
|
}
|
|
|
+ if(Timer_count%(10*60)==0)
|
|
|
+ {
|
|
|
+ #ifdef USING_PRINTF
|
|
|
+ printf("[%d]\n",__LINE__);
|
|
|
+ #endif
|
|
|
+ BattLockFunc();
|
|
|
+ #ifdef USING_PRINTF
|
|
|
+ printf("[%d]\n",__LINE__);
|
|
|
+ #endif
|
|
|
+ }
|
|
|
}
|
|
|
if(Work_timer_end)
|
|
|
{
|
|
@@ -236,7 +246,7 @@ static void MainTask(void* arg)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- switch (i)
|
|
|
+ switch (Adcindex)
|
|
|
{
|
|
|
case FAST_CHARGE_TEMP:
|
|
|
NB_ADC_Get(&adcValue,FAST_CHARGE_TEMP);
|
|
@@ -256,13 +266,13 @@ static void MainTask(void* arg)
|
|
|
break;
|
|
|
case VBAT:
|
|
|
NB_ADC_Get(&adcValue,VBAT);
|
|
|
- i = 0;
|
|
|
+ Adcindex = 0;
|
|
|
break;
|
|
|
default:
|
|
|
- i=0;
|
|
|
+ Adcindex=0;
|
|
|
break;
|
|
|
}
|
|
|
- i++;
|
|
|
+ Adcindex++;
|
|
|
}
|
|
|
#ifdef USING_PRINTF1
|
|
|
printf("TcpService:%d,UDSSwitch:%d,BMS_Fota_update_flag:%d,battWorkState:%d,Can_Msg_Enble:%d\r\n",TcpService,UDSSwitch,BMS_Fota_update_flag,battWorkState,Can_Msg_Enble);
|
|
@@ -867,7 +877,7 @@ void BattWorkStateDelayFunc(UINT8 battWorkCurrentState)
|
|
|
BattWorkStateDelay = battWorkCurrentState;
|
|
|
}
|
|
|
}
|
|
|
- else if(battWorkCurrentState==BATT_CHARGE_SYM)//从 放电或者静置 转充电 1min延时
|
|
|
+ else if(battWorkCurrentState==BATT_CHARGE_SYM)//从 放电或者静置 转充电30s延时
|
|
|
{
|
|
|
workDelayCounter++;
|
|
|
if(workDelayCounter>=30)
|
|
@@ -888,32 +898,34 @@ INT8 rentalEndDetectFunc(void)
|
|
|
UTC8TimeType UTC8Time,ExpiryTime;
|
|
|
UINT16 year;
|
|
|
UINT8 month,day,hour,minute,sec;
|
|
|
- INT8 readRet;
|
|
|
- readRet = appGetSystemTimeUtcSync(&TimeStracture);
|
|
|
- if(readRet==0)
|
|
|
+ appGetSystemTimeUtcSync(&TimeStracture);
|
|
|
+ year=(TimeStracture.UTCtimer1&0xffff0000)>>16;
|
|
|
+ month=(TimeStracture.UTCtimer1&0xff00)>>8;
|
|
|
+ day=TimeStracture.UTCtimer1&0xff;
|
|
|
+ hour=(TimeStracture.UTCtimer2&0xff000000)>>24;
|
|
|
+ minute=(TimeStracture.UTCtimer2&0xff0000)>>16;
|
|
|
+ sec=(TimeStracture.UTCtimer2&0xff00)>>8;
|
|
|
+ UTCToBeijing((UTC8TimeType *)&UTC8Time,year,month,day,hour,minute,sec);
|
|
|
+ if(UTC8Time.year>2000)
|
|
|
{
|
|
|
- year=(TimeStracture.UTCtimer1&0xffff0000)>>16;
|
|
|
- month=(TimeStracture.UTCtimer1&0xff00)>>8;
|
|
|
- day=TimeStracture.UTCtimer1&0xff;
|
|
|
- hour=(TimeStracture.UTCtimer2&0xff000000)>>24;
|
|
|
- minute=(TimeStracture.UTCtimer2&0xff0000)>>16;
|
|
|
- sec=(TimeStracture.UTCtimer2&0xff00)>>8;
|
|
|
- UTCToBeijing((UTC8TimeType *)&UTC8Time,year,month,day,hour,minute,sec);
|
|
|
-
|
|
|
+ #ifdef USING_PRINTF
|
|
|
+ printf("retal Jug:%d %d %d %d,%d %d %d %d\n",UTC8Time.year,UTC8Time.month,UTC8Time.day,UTC8Time.hour,AppDataInfo.ExpiryTimeArray[0],AppDataInfo.ExpiryTimeArray[1],AppDataInfo.ExpiryTimeArray[2],AppDataInfo.ExpiryTimeArray[3]);
|
|
|
+ #endif
|
|
|
if(((UTC8Time.year - 0x07D0) & 0xFF)==AppDataInfo.ExpiryTimeArray[0])//年份相等判定月份
|
|
|
{
|
|
|
if(UTC8Time.month==AppDataInfo.ExpiryTimeArray[1])//月份相等判定日期
|
|
|
{
|
|
|
if(UTC8Time.day==AppDataInfo.ExpiryTimeArray[2])//日期相等判定小时
|
|
|
{
|
|
|
- if(UTC8Time.hour<=AppDataInfo.ExpiryTimeArray[3])//小时相等不锁定,小时超出锁定
|
|
|
- {
|
|
|
- return 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return 1;
|
|
|
- }
|
|
|
+ // if(UTC8Time.hour<=AppDataInfo.ExpiryTimeArray[3])//小时相等不锁定,小时超出锁定
|
|
|
+ // {
|
|
|
+ // return 0;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // return 1;
|
|
|
+ // }
|
|
|
+ return 0;
|
|
|
}
|
|
|
else if(UTC8Time.day>AppDataInfo.ExpiryTimeArray[2])
|
|
|
{
|
|
@@ -944,7 +956,7 @@ INT8 rentalEndDetectFunc(void)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- return 0;//没有获取到时间返回
|
|
|
+ return -1;//没有获取到时间返回
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -965,13 +977,21 @@ void BattLockFunc(void)
|
|
|
}
|
|
|
else if(AppDataInfo.rentaltype==2)// 租赁模式
|
|
|
{
|
|
|
- if(rentalEndDetectFunc()==1 && AppDataInfo.rentalLock==FALSE)//租期判定是否超期函数
|
|
|
+ INT8 ret = -1;
|
|
|
+ ret = rentalEndDetectFunc();
|
|
|
+ if(ret==1 && AppDataInfo.rentalLock==FALSE)//租期判定是否超期函数
|
|
|
{
|
|
|
+ #ifdef USING_PRINTF
|
|
|
+ printf("retal lock,%d\n",ret);
|
|
|
+ #endif
|
|
|
AppDataInfo.rentalLock=TRUE;
|
|
|
AppDataInfo.appDataModify=TRUE;
|
|
|
}
|
|
|
- else if(rentalEndDetectFunc()==0 && AppDataInfo.rentalLock==TRUE)
|
|
|
+ else if(ret==0 && AppDataInfo.rentalLock==TRUE)
|
|
|
{
|
|
|
+ #ifdef USING_PRINTF
|
|
|
+ printf("retal unlock,%d\n",ret);
|
|
|
+ #endif
|
|
|
AppDataInfo.rentalLock=FALSE;
|
|
|
AppDataInfo.appDataModify=TRUE;
|
|
|
AppDataInfo.userLock = FALSE;
|
|
@@ -988,4 +1008,6 @@ void BattLockFunc(void)
|
|
|
AppNVMData.isBattLocked = TRUE;
|
|
|
AppNVMData.appDataModify = TRUE;
|
|
|
}
|
|
|
+
|
|
|
+ return;
|
|
|
}
|