|
@@ -2164,15 +2164,15 @@ int presentChargedEnergyUpdate(unsigned char gun_index)
|
|
|
if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount==1)
|
|
|
{
|
|
|
// Resolution: 0.01 kwh
|
|
|
- ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod[tm->tm_hour] += (((float)(ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption - ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption_at_start))/1000.0) - presentChargedEnergyTotal(gun_index);
|
|
|
+ ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod[tm->tm_hour] += (((float)(ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption - ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption_at_start))/10.0) - presentChargedEnergyTotal(gun_index);
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
// Resolution: 0.01 kwh
|
|
|
- ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod[tm->tm_hour] += ((((float)(ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption - ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption_at_start))/1000.0) +
|
|
|
- (((float)(ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption - ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption_at_start))/1000.0) +
|
|
|
- (((float)(ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption - ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption_at_start))/1000.0))
|
|
|
+ ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod[tm->tm_hour] += ((((float)(ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption - ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption_at_start))/10.0) +
|
|
|
+ (((float)(ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption - ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption_at_start))/10.0) +
|
|
|
+ (((float)(ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption - ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption_at_start))/10.0))
|
|
|
- presentChargedEnergyTotal(gun_index);
|
|
|
}
|
|
|
|
|
@@ -3746,12 +3746,31 @@ int main(void)
|
|
|
* TODO:
|
|
|
* 1. Power saving logic
|
|
|
*/
|
|
|
- if(ShmCharger->gun_info[gun_index].GPIO_Input.Button_Mode_Switch == ON)
|
|
|
+
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A)
|
|
|
+ {
|
|
|
+ ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_STATE_B]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_CHARGING) ||
|
|
|
+ (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_TERMINATING))
|
|
|
{
|
|
|
ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_LCD]);
|
|
|
ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_RFID]);
|
|
|
ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_METER]);
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if((ShmCharger->gun_info[gun_index].GPIO_Input.Button_Mode_Switch == ON) ||
|
|
|
+ (((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_IDLE) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_PREPARING)) &&
|
|
|
+ (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B) &&
|
|
|
+ (DiffTimebWithNow(startTime[gun_index][TMR_IDX_POWERSAVING_STATE_B]) < 10000)))
|
|
|
+ {
|
|
|
+ ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_LCD]);
|
|
|
+ ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_RFID]);
|
|
|
+ ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_METER]);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_POWERSAVING_LCD]) > TIMEOUT_SPEC_POWERSAVING_LCD)
|
|
|
{
|
|
@@ -3892,6 +3911,7 @@ int main(void)
|
|
|
ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_LCD]);
|
|
|
ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_RFID]);
|
|
|
ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_METER]);
|
|
|
+ ftime(&startTime[gun_index][TMR_IDX_POWERSAVING_STATE_B]);
|
|
|
}
|
|
|
|
|
|
if(ShmCharger->gun_info[gun_index].mcuFlag.isReadFwVerPass &&
|