|
@@ -46,14 +46,32 @@ int StoreLogMsg(const char *fmt, ...);
|
|
|
#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
|
|
|
#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
|
|
|
|
|
|
-unsigned long GetTimeoutValue(struct timeval _sour_time);
|
|
|
+int GetTimeoutValue(struct timespec *startTime);
|
|
|
|
|
|
-unsigned long GetTimeoutValue(struct timeval _sour_time)
|
|
|
+long int GetTimeoutMValue(struct timespec *startTime)
|
|
|
{
|
|
|
- struct timeval _end_time;
|
|
|
- gettimeofday(&_end_time, NULL);
|
|
|
+ struct timespec endTime;
|
|
|
|
|
|
- return 1000000 * (_end_time.tv_sec - _sour_time.tv_sec) + _end_time.tv_usec - _sour_time.tv_usec;
|
|
|
+ clock_gettime(CLOCK_MONOTONIC, &endTime);
|
|
|
+ return 1000 * (endTime.tv_sec - startTime->tv_sec) + (endTime.tv_nsec - startTime->tv_nsec) / 1000000;
|
|
|
+}
|
|
|
+
|
|
|
+void GetTimespecMFunc(struct timespec *time)
|
|
|
+{
|
|
|
+ clock_gettime(CLOCK_MONOTONIC, time);
|
|
|
+}
|
|
|
+
|
|
|
+int GetTimeoutValue(struct timespec *startTime)
|
|
|
+{
|
|
|
+ struct timespec endTime;
|
|
|
+
|
|
|
+ clock_gettime(CLOCK_MONOTONIC_COARSE, &endTime);
|
|
|
+ return endTime.tv_sec - startTime->tv_sec;
|
|
|
+}
|
|
|
+
|
|
|
+void GetTimespecFunc(struct timespec *time)
|
|
|
+{
|
|
|
+ clock_gettime(CLOCK_MONOTONIC_COARSE, time);
|
|
|
}
|
|
|
|
|
|
int StoreLogMsg(const char *fmt, ...)
|
|
@@ -121,10 +139,10 @@ byte FindTargetGroup(byte address)
|
|
|
_group = 0;
|
|
|
else
|
|
|
{
|
|
|
- _group = FindIndex(connector_1, ShmPsuData->PsuGroup[0].GroupPresentPsuQuantity, address, 0);
|
|
|
+ _group = FindIndex(ShmDcCommonData->connector[0], ShmPsuData->PsuGroup[0].GroupPresentPsuQuantity, address, 0);
|
|
|
|
|
|
if (_group == ELEMENT_NOT_FIND)
|
|
|
- _group = FindIndex(connector_2, ShmPsuData->PsuGroup[1].GroupPresentPsuQuantity, address, 1);
|
|
|
+ _group = FindIndex(ShmDcCommonData->connector[1], ShmPsuData->PsuGroup[1].GroupPresentPsuQuantity, address, 1);
|
|
|
}
|
|
|
|
|
|
return _group;
|
|
@@ -322,13 +340,13 @@ void GetStatusCallback(byte group, byte SN, byte temp, int alarm)
|
|
|
{
|
|
|
bool isFind = false;
|
|
|
|
|
|
- if ((conn_1_count + conn_2_count) != ShmPsuData->SystemPresentPsuQuantity)
|
|
|
+ if ((ShmDcCommonData->conn_1_count + ShmDcCommonData->conn_2_count) != ShmPsuData->SystemPresentPsuQuantity)
|
|
|
{
|
|
|
if (group == 0)
|
|
|
{
|
|
|
- for(byte psuIndex = 0; psuIndex < conn_1_count; psuIndex++)
|
|
|
+ for(byte psuIndex = 0; psuIndex < ShmDcCommonData->conn_1_count; psuIndex++)
|
|
|
{
|
|
|
- if (connector_1[psuIndex] == SN)
|
|
|
+ if (ShmDcCommonData->connector[0][psuIndex] == SN)
|
|
|
{
|
|
|
isFind = true;
|
|
|
break;
|
|
@@ -337,15 +355,15 @@ void GetStatusCallback(byte group, byte SN, byte temp, int alarm)
|
|
|
|
|
|
if(!isFind)
|
|
|
{
|
|
|
- connector_1[conn_1_count] = SN;
|
|
|
- conn_1_count++;
|
|
|
+ ShmDcCommonData->connector[0][ShmDcCommonData->conn_1_count] = SN;
|
|
|
+ ShmDcCommonData->conn_1_count++;
|
|
|
}
|
|
|
}
|
|
|
else if (group == 1)
|
|
|
{
|
|
|
- for(byte psuIndex = 0; psuIndex < conn_2_count; psuIndex++)
|
|
|
+ for(byte psuIndex = 0; psuIndex < ShmDcCommonData->conn_2_count; psuIndex++)
|
|
|
{
|
|
|
- if (connector_2[psuIndex] == SN)
|
|
|
+ if (ShmDcCommonData->connector[1][psuIndex] == SN)
|
|
|
{
|
|
|
isFind = true;
|
|
|
break;
|
|
@@ -354,30 +372,30 @@ void GetStatusCallback(byte group, byte SN, byte temp, int alarm)
|
|
|
|
|
|
if(!isFind)
|
|
|
{
|
|
|
- connector_2[conn_2_count] = SN;
|
|
|
- conn_2_count++;
|
|
|
+ ShmDcCommonData->connector[1][ShmDcCommonData->conn_2_count] = SN;
|
|
|
+ ShmDcCommonData->conn_2_count++;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if ((conn_1_count + conn_2_count) == ShmPsuData->SystemPresentPsuQuantity)
|
|
|
+ if ((ShmDcCommonData->conn_1_count + ShmDcCommonData->conn_2_count) == ShmPsuData->SystemPresentPsuQuantity)
|
|
|
{
|
|
|
// Arrangment
|
|
|
- for(byte psuIndex = 0; psuIndex < conn_1_count; psuIndex++)
|
|
|
+ for(byte psuIndex = 0; psuIndex < ShmDcCommonData->conn_1_count; psuIndex++)
|
|
|
{
|
|
|
- connector_1[psuIndex] = psuIndex;
|
|
|
+ ShmDcCommonData->connector[0][psuIndex] = psuIndex;
|
|
|
}
|
|
|
|
|
|
- for(byte psuIndex = 0; psuIndex < conn_2_count; psuIndex++)
|
|
|
+ for(byte psuIndex = 0; psuIndex < ShmDcCommonData->conn_2_count; psuIndex++)
|
|
|
{
|
|
|
- connector_2[psuIndex] = conn_1_count + psuIndex;
|
|
|
+ ShmDcCommonData->connector[1][psuIndex] = ShmDcCommonData->conn_1_count + psuIndex;
|
|
|
}
|
|
|
|
|
|
- for(byte psuIndex = 0; psuIndex < conn_1_count; psuIndex++)
|
|
|
- PRINTF_FUNC("DC Left Gun - PSU Number = %d \n", connector_1[psuIndex]);
|
|
|
+ for(byte psuIndex = 0; psuIndex < ShmDcCommonData->conn_1_count; psuIndex++)
|
|
|
+ PRINTF_FUNC("DC Left Gun - PSU Number = %d \n", ShmDcCommonData->connector[0][psuIndex]);
|
|
|
|
|
|
- for(byte psuIndex = 0; psuIndex < conn_2_count; psuIndex++)
|
|
|
- PRINTF_FUNC("DC Right Gun - PSU Number = %d \n", connector_2[psuIndex]);
|
|
|
+ for(byte psuIndex = 0; psuIndex < ShmDcCommonData->conn_2_count; psuIndex++)
|
|
|
+ PRINTF_FUNC("DC Right Gun - PSU Number = %d \n", ShmDcCommonData->connector[1][psuIndex]);
|
|
|
|
|
|
if (ShmSysConfigAndInfo->SysConfig.TotalConnectorCount > 1 &&
|
|
|
ShmDcCommonData->chargerType == CHARGER_TYPE_STANDARD)
|
|
@@ -400,8 +418,8 @@ void GetStatusCallback(byte group, byte SN, byte temp, int alarm)
|
|
|
|
|
|
maxCount = ((power / 30) + 1) / 2;
|
|
|
|
|
|
- if (conn_1_count > maxCount ||
|
|
|
- conn_2_count > maxCount)
|
|
|
+ if (ShmDcCommonData->conn_1_count > maxCount ||
|
|
|
+ ShmDcCommonData->conn_2_count > maxCount)
|
|
|
{
|
|
|
ShmStatusCodeData->AlarmCode.AlarmEvents.bits.PsuDipSwitchStestFail = YES;
|
|
|
}
|
|
@@ -447,6 +465,10 @@ void GetMaxPowerAndCur(unsigned char mode, int ratingCur, int *pow, int *cur)
|
|
|
maxPower /= 2;
|
|
|
}
|
|
|
|
|
|
+ if (ShmSysConfigAndInfo->SysInfo.MaxChargingProfilePower >= 0 &&
|
|
|
+ maxPower > ShmSysConfigAndInfo->SysInfo.MaxChargingProfilePower)
|
|
|
+ maxPower = ShmSysConfigAndInfo->SysInfo.MaxChargingProfilePower;
|
|
|
+
|
|
|
if (maxPower != 0 && maxPower <= *pow)
|
|
|
*pow = maxPower;
|
|
|
|
|
@@ -759,8 +781,8 @@ void GetPresentOutputCallback(byte group, unsigned short outVol, unsigned short
|
|
|
// }
|
|
|
// }
|
|
|
//
|
|
|
-// if ((chargingInfo[group]->SystemStatus >= S_PREPARING_FOR_EVSE && chargingInfo[group]->SystemStatus <= S_COMPLETE) ||
|
|
|
-// (chargingInfo[group]->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingInfo[group]->SystemStatus <= S_CCS_PRECHARGE_ST1))
|
|
|
+// if ((chargingInfo[group]->SystemStatus >= SYS_MODE_PREPARE_FOR_EVSE && chargingInfo[group]->SystemStatus <= SYS_MODE_COMPLETE) ||
|
|
|
+// (chargingInfo[group]->SystemStatus >= SYS_MODE_CCS_PRECHARGE_STEP0 && chargingInfo[group]->SystemStatus <= SYS_MODE_CCS_PRECHARGE_STEP1))
|
|
|
// {
|
|
|
// float _vol_buf = outputVol;
|
|
|
// float _cur_buf = outputCur;
|
|
@@ -965,9 +987,9 @@ void GetPresentOutputFCallback(byte group, float outVol, float outCur)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if ((chargingInfo[group]->SystemStatus >= S_PREPARING_FOR_EVSE && chargingInfo[group]->SystemStatus <= S_COMPLETE) ||
|
|
|
- (chargingInfo[group]->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingInfo[group]->SystemStatus <= S_CCS_PRECHARGE_ST1) ||
|
|
|
- chargingInfo[group]->SystemStatus == S_ALARM)
|
|
|
+ if ((chargingInfo[group]->SystemStatus >= SYS_MODE_PREPARE_FOR_EVSE && chargingInfo[group]->SystemStatus <= SYS_MODE_COMPLETE) ||
|
|
|
+ (chargingInfo[group]->SystemStatus >= SYS_MODE_CCS_PRECHARGE_STEP0 && chargingInfo[group]->SystemStatus <= SYS_MODE_CCS_PRECHARGE_STEP1) ||
|
|
|
+ chargingInfo[group]->SystemStatus == SYS_MODE_ALARM)
|
|
|
{
|
|
|
float _vol_buf = outputVol;
|
|
|
float _cur_buf = outputCur;
|
|
@@ -1003,9 +1025,6 @@ void GetOutputAndTempCallback(byte address, unsigned short outputVol_s,
|
|
|
if (ShmPsuData->Work_Step < GET_SYS_CAP)
|
|
|
return;
|
|
|
|
|
|
- //unsigned short outVol = outputVol_s;
|
|
|
- //unsigned short outCur = outputCur_s;
|
|
|
-
|
|
|
if (IsOverModuleCount(address))
|
|
|
return;
|
|
|
|
|
@@ -1014,98 +1033,6 @@ void GetOutputAndTempCallback(byte address, unsigned short outputVol_s,
|
|
|
if (group == 1)
|
|
|
address -= ShmPsuData->PsuGroup[group - 1].GroupPresentPsuQuantity;
|
|
|
|
|
|
-// // PSU Group - 電壓
|
|
|
-// ShmPsuData->PsuGroup[group].GroupPresentOutputVoltage = outVol;
|
|
|
-// // PSU Group - 電流
|
|
|
-// ShmPsuData->PsuGroup[group].GroupPresentOutputCurrent = outCur;
|
|
|
-// // PSU Group - 能量
|
|
|
-// ShmPsuData->PsuGroup[group].GroupPresentOutputPower = outVol * outCur;
|
|
|
-//
|
|
|
-// if (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_MAX ||
|
|
|
-// (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_AVER &&
|
|
|
-// (ShmSysConfigAndInfo->SysInfo.ReAssignedFlag >= _REASSIGNED_WAITING &&
|
|
|
-// ShmSysConfigAndInfo->SysInfo.ReAssignedFlag <= _REASSIGNED_COMP))
|
|
|
-// )
|
|
|
-// {
|
|
|
-// unsigned short outputVol = 0;
|
|
|
-// unsigned short outputCur = 0;
|
|
|
-// unsigned char _maxTOaver = 0;
|
|
|
-//
|
|
|
-// for (byte index = 0; index < ShmPsuData->GroupCount; index++)
|
|
|
-// {
|
|
|
-// bool needtoAdd = true;
|
|
|
-//
|
|
|
-// if (ShmPsuData->PsuGroup[index].GroupPresentOutputVoltage > outputVol)
|
|
|
-// outputVol = ShmPsuData->PsuGroup[index].GroupPresentOutputVoltage;
|
|
|
-//
|
|
|
-//// if (ShmSysConfigAndInfo->SysInfo.ReAssignedFlag >= _REASSIGNED_ADJUST_M_TO_A &&
|
|
|
-//// ShmSysConfigAndInfo->SysInfo.ReAssignedFlag <= _REASSIGNED_RELAY_M_TO_A)
|
|
|
-//// {
|
|
|
-//// if (chargingInfo[index]->DividChargingCurrent == 0)
|
|
|
-//// needtoAdd = false;
|
|
|
-//// else
|
|
|
-//// _maxTOaver = index;
|
|
|
-//// }
|
|
|
-//
|
|
|
-// if (needtoAdd)
|
|
|
-// outputCur += ShmPsuData->PsuGroup[index].GroupPresentOutputCurrent;
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (ShmSysConfigAndInfo->SysInfo.ReAssignedFlag >= _REASSIGNED_ADJUST_M_TO_A &&
|
|
|
-// ShmSysConfigAndInfo->SysInfo.ReAssignedFlag <= _REASSIGNED_RELAY_M_TO_A)
|
|
|
-// {
|
|
|
-// if (chargingInfo[_maxTOaver]->DividChargingCurrent != 0)
|
|
|
-// {
|
|
|
-// float _cur_buf = outputCur;
|
|
|
-// _cur_buf /= 10;
|
|
|
-// chargingInfo[_maxTOaver]->PresentChargingCurrent = _cur_buf;
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 黑白機
|
|
|
-// if (ShmSysConfigAndInfo->SysInfo.IsAlternatvieConf == YES)
|
|
|
-// {
|
|
|
-// for (byte count = 0; count < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; count++)
|
|
|
-// {
|
|
|
-// float _vol_buf = outputVol;
|
|
|
-// float _cur_buf = outputCur;
|
|
|
-//
|
|
|
-// // EVSE - 電壓
|
|
|
-// _vol_buf /= 10;
|
|
|
-// chargingInfo[count]->PresentChargingVoltage = _vol_buf;
|
|
|
-//
|
|
|
-// _cur_buf /= 10;
|
|
|
-// chargingInfo[count]->PresentChargingCurrent = _cur_buf;
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// if ((chargingInfo[group]->SystemStatus >= S_PREPARING_FOR_EVSE && chargingInfo[group]->SystemStatus <= S_COMPLETE) ||
|
|
|
-// (chargingInfo[group]->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingInfo[group]->SystemStatus <= S_CCS_PRECHARGE_ST1))
|
|
|
-// {
|
|
|
-// float _vol_buf = outputVol;
|
|
|
-// float _cur_buf = outputCur;
|
|
|
-//
|
|
|
-// // EVSE - 電壓
|
|
|
-// _vol_buf /= 10;
|
|
|
-// chargingInfo[group]->PresentChargingVoltage = _vol_buf;
|
|
|
-//
|
|
|
-// _cur_buf /= 10;
|
|
|
-// chargingInfo[group]->PresentChargingCurrent = _cur_buf;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// else
|
|
|
-// {
|
|
|
-// float _vol_buf = ShmPsuData->PsuGroup[group].GroupPresentOutputVoltage;
|
|
|
-// float _cur_buf = ShmPsuData->PsuGroup[group].GroupPresentOutputCurrent;
|
|
|
-//
|
|
|
-// // EVSE - 電壓
|
|
|
-// _vol_buf /= 10;
|
|
|
-// chargingInfo[group]->PresentChargingVoltage = _vol_buf;
|
|
|
-//
|
|
|
-// _cur_buf /= 10;
|
|
|
-// chargingInfo[group]->PresentChargingCurrent = _cur_buf;
|
|
|
-// }
|
|
|
-
|
|
|
ShmPsuData->PsuGroup[group].PsuModule[address].CriticalTemp1 = Temperature;
|
|
|
ShmPsuData->PsuGroup[group].PsuModule[address].CriticalTemp2 = Temperature;
|
|
|
ShmPsuData->PsuGroup[group].PsuModule[address].CriticalTemp3 = Temperature;
|
|
@@ -1119,6 +1046,13 @@ void GetModuleStatusCallback(byte address, unsigned char isErr, unsigned char st
|
|
|
unsigned char err1, unsigned char err2, unsigned char err3, unsigned char err4)
|
|
|
{
|
|
|
ShmDcCommonData->psuKeepCommunication = ShmDcCommonData->acContactSwitch;
|
|
|
+ int _timebuf = GetTimeoutValue(&ShmDcCommonData->_psuComm_time);
|
|
|
+
|
|
|
+ if (_timebuf > 1 ||
|
|
|
+ _timebuf < 0)
|
|
|
+ {
|
|
|
+ GetTimespecFunc(&ShmDcCommonData->_psuComm_time);
|
|
|
+ }
|
|
|
|
|
|
if (ShmPsuData->Work_Step < GET_SYS_CAP)
|
|
|
return;
|
|
@@ -1192,9 +1126,7 @@ int InitShareMemory()
|
|
|
DEBUG_ERROR("shmat ShmSysConfigAndInfo NG \n");
|
|
|
#endif
|
|
|
result = FAIL;
|
|
|
- }
|
|
|
- else
|
|
|
- {}
|
|
|
+ }
|
|
|
|
|
|
//creat ShmStatusCodeData
|
|
|
if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
|
|
@@ -1211,8 +1143,6 @@ int InitShareMemory()
|
|
|
#endif
|
|
|
result = FAIL;
|
|
|
}
|
|
|
- else
|
|
|
- {}
|
|
|
|
|
|
//creat ShmPsuData
|
|
|
if ((MeterSMId = shmget(ShmPsuKey, sizeof(struct PsuData), 0777)) < 0)
|
|
@@ -1323,6 +1253,8 @@ void Initialization()
|
|
|
|
|
|
ShmPsuData->SystemAvailableCurrent = 0;
|
|
|
ShmPsuData->SystemAvailablePower = 0;
|
|
|
+
|
|
|
+ GetTimespecFunc(&ShmDcCommonData->_psuComm_time);
|
|
|
}
|
|
|
|
|
|
void CheckSmartChargingStep(byte chargingStatus)
|
|
@@ -1357,7 +1289,7 @@ void CheckSmartChargingStep(byte chargingStatus)
|
|
|
{
|
|
|
PRINTF_FUNC("======= Aver -> Max : switch on the psu voltage. (Step 12) ======= \n");
|
|
|
preChargingCur = preChargingTarget = 0;
|
|
|
- gettimeofday(&_max_time, NULL);
|
|
|
+ GetTimespecMFunc(&_max_time);
|
|
|
ShmSysConfigAndInfo->SysInfo.ReAssignedFlag = _REASSIGNED_ADJUST_A_TO_M;
|
|
|
}
|
|
|
}
|
|
@@ -1427,23 +1359,23 @@ void PreCheckSmartChargingStep()
|
|
|
|
|
|
for (byte index = 0; index < ShmPsuData->GroupCount; index++)
|
|
|
{
|
|
|
- if ((chargingInfo[index]->SystemStatus >= S_PREPARING_FOR_EVSE && chargingInfo[index]->SystemStatus < S_CHARGING) ||
|
|
|
- (chargingInfo[index]->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingInfo[index]->SystemStatus <= S_CCS_PRECHARGE_ST1))
|
|
|
+ if ((chargingInfo[index]->SystemStatus >= SYS_MODE_PREPARE_FOR_EVSE && chargingInfo[index]->SystemStatus < SYS_MODE_CHARGING) ||
|
|
|
+ (chargingInfo[index]->SystemStatus >= SYS_MODE_CCS_PRECHARGE_STEP0 && chargingInfo[index]->SystemStatus <= SYS_MODE_CCS_PRECHARGE_STEP1))
|
|
|
{
|
|
|
_maxChargingStatus = _CHARGING_GUN_STATUS_COMM;
|
|
|
}
|
|
|
- else if (chargingInfo[index]->SystemStatus == S_CHARGING)
|
|
|
+ else if (chargingInfo[index]->SystemStatus == SYS_MODE_CHARGING)
|
|
|
{
|
|
|
_maxChargingStatus = _CHARGING_GUN_STATUS_CHARGING;
|
|
|
}
|
|
|
- else if (chargingInfo[index]->SystemStatus == S_COMPLETE ||
|
|
|
- chargingInfo[index]->SystemStatus == S_ALARM)
|
|
|
+ else if (chargingInfo[index]->SystemStatus == SYS_MODE_COMPLETE ||
|
|
|
+ chargingInfo[index]->SystemStatus == SYS_MODE_ALARM)
|
|
|
{
|
|
|
_maxChargingStatus = _CHARGING_GUN_STATUS_STOP;
|
|
|
}
|
|
|
|
|
|
- if ((chargingInfo[index]->SystemStatus >= S_PREPARING_FOR_EVSE && chargingInfo[index]->SystemStatus <= S_CHARGING) ||
|
|
|
- (chargingInfo[index]->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingInfo[index]->SystemStatus <= S_CCS_PRECHARGE_ST1))
|
|
|
+ if ((chargingInfo[index]->SystemStatus >= SYS_MODE_PREPARE_FOR_EVSE && chargingInfo[index]->SystemStatus <= SYS_MODE_CHARGING) ||
|
|
|
+ (chargingInfo[index]->SystemStatus >= SYS_MODE_CCS_PRECHARGE_STEP0 && chargingInfo[index]->SystemStatus <= SYS_MODE_CCS_PRECHARGE_STEP1))
|
|
|
{
|
|
|
isReadyToCharging = true;
|
|
|
}
|
|
@@ -1479,7 +1411,7 @@ bool MaxToAverChargingProc(byte groupIndex)
|
|
|
PRINTF_FUNC("Index = %d, newEvCurrent = %f \n", groupIndex, (chargingInfo[groupIndex]->EvBatterytargetCurrent * 10));
|
|
|
PRINTF_FUNC("======= Max -> Aver : wait the target current is down. (Step 3) ======= \n");
|
|
|
ShmSysConfigAndInfo->SysInfo.ReAssignedFlag = _REASSIGNED_ADJUST_M_TO_A;
|
|
|
- gettimeofday(&_derating_time, NULL);
|
|
|
+ GetTimespecMFunc(&_derating_time);
|
|
|
deratingKeepCount = 0;
|
|
|
}
|
|
|
else
|
|
@@ -1506,7 +1438,7 @@ bool MaxToAverChargingProc(byte groupIndex)
|
|
|
{
|
|
|
for (byte subIndex = 0; subIndex < ShmPsuData->GroupCount; subIndex++)
|
|
|
{
|
|
|
- if (chargingInfo[subIndex]->SystemStatus == S_REASSIGN)
|
|
|
+ if (chargingInfo[subIndex]->SystemStatus == SYS_MODE_REASSIGN)
|
|
|
{
|
|
|
// 當 B 模塊輸出電流小於 5A 及退開 relay
|
|
|
if ((ShmPsuData->PsuGroup[subIndex].GroupPresentOutputCurrent) <= 50)
|
|
@@ -1519,7 +1451,7 @@ bool MaxToAverChargingProc(byte groupIndex)
|
|
|
{
|
|
|
for (byte subIndex = 0; subIndex < ShmPsuData->GroupCount; subIndex++)
|
|
|
{
|
|
|
- if (chargingInfo[subIndex]->SystemStatus == S_REASSIGN)
|
|
|
+ if (chargingInfo[subIndex]->SystemStatus == SYS_MODE_REASSIGN)
|
|
|
{
|
|
|
if ((ShmPsuData->PsuGroup[subIndex].GroupPresentOutputCurrent) <= CHK_CUR_RANGE)
|
|
|
isChanged = true;
|
|
@@ -1540,9 +1472,9 @@ bool MaxToAverChargingProc(byte groupIndex)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- int _t = GetTimeoutValue(_derating_time);
|
|
|
+ int _t = GetTimeoutMValue(&_derating_time);
|
|
|
|
|
|
- if ((_t / 1000) > 1000 || _t < 0)
|
|
|
+ if (_t > 1000 || _t < 0)
|
|
|
{
|
|
|
PRINTF_FUNC("Max To Ava mode (3-1) : Gun_%d, AvailableChargingCurrent = %f, EvBatterytargetCurrent = %f \n",
|
|
|
groupIndex,
|
|
@@ -1555,7 +1487,7 @@ bool MaxToAverChargingProc(byte groupIndex)
|
|
|
ShmPsuData->PsuGroup[groupIndex].GroupPresentOutputCurrent,
|
|
|
ShmPsuData->GroupCount);
|
|
|
|
|
|
- gettimeofday(&_derating_time, NULL);
|
|
|
+ GetTimespecMFunc(&_derating_time);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1579,7 +1511,7 @@ bool MaxToAverChargingProc(byte groupIndex)
|
|
|
// 找到等待分配的槍
|
|
|
for (byte subIndex = 0; subIndex < ShmPsuData->GroupCount; subIndex++)
|
|
|
{
|
|
|
- if (chargingInfo[subIndex]->SystemStatus == S_REASSIGN)
|
|
|
+ if (chargingInfo[subIndex]->SystemStatus == SYS_MODE_REASSIGN)
|
|
|
{
|
|
|
reassignIndex = subIndex;
|
|
|
break;
|
|
@@ -1588,7 +1520,7 @@ bool MaxToAverChargingProc(byte groupIndex)
|
|
|
|
|
|
if (reassignIndex != ELEMENT_NOT_FIND)
|
|
|
{
|
|
|
- if ((GetTimeoutValue(_derating_time) / 1000) <= 150 ||
|
|
|
+ if (GetTimeoutMValue(&_derating_time) <= 150 ||
|
|
|
chargingInfo[groupIndex]->MaxChargingToAverPassFlag == 0)
|
|
|
{
|
|
|
chargingInfo[groupIndex]->MaxChargingToAverPassFlag = 1;
|
|
@@ -1647,12 +1579,12 @@ bool AverToMaxChargingProc(byte groupIndex)
|
|
|
|
|
|
for (byte subIndex = 0; subIndex < ShmPsuData->GroupCount; subIndex++)
|
|
|
{
|
|
|
- if (chargingInfo[subIndex]->SystemStatus == S_IDLE ||
|
|
|
- chargingInfo[subIndex]->SystemStatus == S_RESERVATION ||
|
|
|
- chargingInfo[subIndex]->SystemStatus == S_FAULT ||
|
|
|
- chargingInfo[subIndex]->SystemStatus == S_REASSIGN_CHECK ||
|
|
|
- chargingInfo[subIndex]->SystemStatus == S_COMPLETE ||
|
|
|
- chargingInfo[subIndex]->SystemStatus == S_ALARM)
|
|
|
+ if (chargingInfo[subIndex]->SystemStatus == SYS_MODE_IDLE ||
|
|
|
+ chargingInfo[subIndex]->SystemStatus == SYS_MODE_RESERVATION ||
|
|
|
+ chargingInfo[subIndex]->SystemStatus == SYS_MODE_FAULT ||
|
|
|
+ chargingInfo[subIndex]->SystemStatus == SYS_MODE_MODE_REASSIGN_CHECK ||
|
|
|
+ chargingInfo[subIndex]->SystemStatus == SYS_MODE_COMPLETE ||
|
|
|
+ chargingInfo[subIndex]->SystemStatus == SYS_MODE_ALARM)
|
|
|
{
|
|
|
reassignIndex = subIndex;
|
|
|
|
|
@@ -1676,7 +1608,7 @@ bool AverToMaxChargingProc(byte groupIndex)
|
|
|
|
|
|
if (reassignIndex != ELEMENT_NOT_FIND)
|
|
|
{
|
|
|
- if ((GetTimeoutValue(_max_time) / 1000) <= 150)
|
|
|
+ if (GetTimeoutMValue(&_max_time) <= 150)
|
|
|
{
|
|
|
//PRINTF_FUNC("set out (%d) value = %d******** 5 \n", reassignIndex, ZERO_CURRENT + preChargingTarget);
|
|
|
// 閒置模塊升壓,另對剛分配近來的模塊,預上升電流值 (preChargingCur)
|
|
@@ -1738,11 +1670,11 @@ bool AverToMaxChargingProc(byte groupIndex)
|
|
|
|
|
|
for (subIndex = 0; subIndex < ShmPsuData->GroupCount; subIndex++)
|
|
|
{
|
|
|
- if (chargingInfo[subIndex]->SystemStatus == S_IDLE ||
|
|
|
- chargingInfo[subIndex]->SystemStatus == S_FAULT ||
|
|
|
- chargingInfo[subIndex]->SystemStatus == S_RESERVATION ||
|
|
|
- chargingInfo[subIndex]->SystemStatus == S_COMPLETE ||
|
|
|
- chargingInfo[subIndex]->SystemStatus == S_ALARM)
|
|
|
+ if (chargingInfo[subIndex]->SystemStatus == SYS_MODE_IDLE ||
|
|
|
+ chargingInfo[subIndex]->SystemStatus == SYS_MODE_FAULT ||
|
|
|
+ chargingInfo[subIndex]->SystemStatus == SYS_MODE_RESERVATION ||
|
|
|
+ chargingInfo[subIndex]->SystemStatus == SYS_MODE_COMPLETE ||
|
|
|
+ chargingInfo[subIndex]->SystemStatus == SYS_MODE_ALARM)
|
|
|
{
|
|
|
// 各群電壓接近平衡
|
|
|
if (((chargingInfo[subIndex]->PresentChargingVoltage * 10) < (chargingInfo[groupIndex]->PresentChargingVoltage * 10) - ZERO_VOLTAGE) ||
|
|
@@ -1762,15 +1694,15 @@ bool AverToMaxChargingProc(byte groupIndex)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- int _tMax_1 = GetTimeoutValue(_max_time);
|
|
|
+ int _tMax_1 = GetTimeoutMValue(&_max_time);
|
|
|
|
|
|
- if ((_tMax_1 / 1000) > 500 || _tMax_1 < 0)
|
|
|
+ if (_tMax_1 > 500 || _tMax_1 < 0)
|
|
|
{
|
|
|
PRINTF_FUNC("Ava To Max mode (12) : Gun_%d, PresentChargingVoltage = %f, PresentChargingVoltage_V = %f, EvBatterytargetVoltage = %f \n", subIndex,
|
|
|
(chargingInfo[subIndex]->PresentChargingVoltage * 10),
|
|
|
((chargingInfo[groupIndex]->PresentChargingVoltage * 10) - ZERO_VOLTAGE),
|
|
|
((chargingInfo[groupIndex]->EvBatterytargetVoltage * 10) - CHK_VOL_RANGE));
|
|
|
- gettimeofday(&_max_time, NULL);
|
|
|
+ GetTimespecMFunc(&_max_time);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1781,10 +1713,10 @@ bool AverToMaxChargingProc(byte groupIndex)
|
|
|
|
|
|
for (byte subIndex = 0; subIndex < ShmPsuData->GroupCount; subIndex++)
|
|
|
{
|
|
|
- if (chargingInfo[subIndex]->SystemStatus == S_IDLE ||
|
|
|
- chargingInfo[subIndex]->SystemStatus == S_RESERVATION ||
|
|
|
- chargingInfo[subIndex]->SystemStatus == S_FAULT ||
|
|
|
- chargingInfo[subIndex]->SystemStatus == S_REASSIGN_CHECK)
|
|
|
+ if (chargingInfo[subIndex]->SystemStatus == SYS_MODE_IDLE ||
|
|
|
+ chargingInfo[subIndex]->SystemStatus == SYS_MODE_RESERVATION ||
|
|
|
+ chargingInfo[subIndex]->SystemStatus == SYS_MODE_FAULT ||
|
|
|
+ chargingInfo[subIndex]->SystemStatus == SYS_MODE_MODE_REASSIGN_CHECK)
|
|
|
idleCurrent = ShmPsuData->PsuGroup[subIndex].GroupPresentOutputCurrent;
|
|
|
else
|
|
|
{
|
|
@@ -1799,11 +1731,11 @@ bool AverToMaxChargingProc(byte groupIndex)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- int _tMax_2 = GetTimeoutValue(_max_time);
|
|
|
+ int _tMax_2 = GetTimeoutMValue(&_max_time);
|
|
|
|
|
|
- if ((_tMax_2 / 1000) > 300 || _tMax_2 < 0)
|
|
|
+ if (_tMax_2 > 300 || _tMax_2 < 0)
|
|
|
{
|
|
|
- gettimeofday(&_max_time, NULL);
|
|
|
+ GetTimespecMFunc(&_max_time);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1817,15 +1749,15 @@ bool AverToMaxChargingProc(byte groupIndex)
|
|
|
|
|
|
void SwitchOffPowerCheck(byte groupIndex)
|
|
|
{
|
|
|
- _maxChargingStatus = _CHARGING_GUN_STATUS_NONE;
|
|
|
+ _maxChargingStatus = _CHARGING_GUN_STATUS_STOP;
|
|
|
|
|
|
for (byte index = 0; index < ShmPsuData->GroupCount; index++)
|
|
|
{
|
|
|
// 判斷另一把槍的狀態
|
|
|
if (index != groupIndex)
|
|
|
{
|
|
|
- if ((chargingInfo[index]->SystemStatus >= S_PREPARING_FOR_EV && chargingInfo[index]->SystemStatus <= S_CHARGING) ||
|
|
|
- (chargingInfo[index]->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingInfo[index]->SystemStatus <= S_CCS_PRECHARGE_ST1))
|
|
|
+ if ((chargingInfo[index]->SystemStatus >= SYS_MODE_PREPARE_FOR_EV && chargingInfo[index]->SystemStatus <= SYS_MODE_CHARGING) ||
|
|
|
+ (chargingInfo[index]->SystemStatus >= SYS_MODE_CCS_PRECHARGE_STEP0 && chargingInfo[index]->SystemStatus <= SYS_MODE_CCS_PRECHARGE_STEP1))
|
|
|
_maxChargingStatus = _CHARGING_GUN_STATUS_CHARGING;
|
|
|
else
|
|
|
_maxChargingStatus = _CHARGING_GUN_STATUS_STOP;
|
|
@@ -1901,7 +1833,12 @@ int main(void)
|
|
|
continue;
|
|
|
}
|
|
|
else
|
|
|
+ {
|
|
|
+ if (isInitialComp)
|
|
|
+ GetTimespecFunc(&ShmDcCommonData->_psuComm_time);
|
|
|
+
|
|
|
isInitialComp = NO;
|
|
|
+ }
|
|
|
|
|
|
// 自檢失敗
|
|
|
if (ShmPsuData->Work_Step == _NO_WORKING)
|
|
@@ -1909,13 +1846,28 @@ int main(void)
|
|
|
PRINTF_FUNC("== PSU == self test fail. \n");
|
|
|
sleep(5);
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ int _time = GetTimeoutValue(&ShmDcCommonData->_psuComm_time);
|
|
|
+ if (_time < 0)
|
|
|
+ GetTimespecFunc(&ShmDcCommonData->_psuComm_time);
|
|
|
+
|
|
|
+ if (_time > 30)
|
|
|
+ {
|
|
|
+ if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.PsuFailureAlarm == NO)
|
|
|
+ {
|
|
|
+ ShmStatusCodeData->AlarmCode.AlarmEvents.bits.PsuFailureAlarm = YES;
|
|
|
+ PRINTF_FUNC("Psu is gone, reset one time. \n");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
switch(ShmPsuData->Work_Step)
|
|
|
{
|
|
|
case INITIAL_START:
|
|
|
{
|
|
|
PRINTF_FUNC("== PSU == INITIAL_START \n");
|
|
|
- gettimeofday(&_cmdSubPriority_time, NULL);
|
|
|
+ GetTimespecMFunc(&_cmdSubPsuPriority_time);
|
|
|
sleep(5);
|
|
|
SwitchPower(SYSTEM_CMD, PSU_POWER_OFF);
|
|
|
SetWalkInConfig(SYSTEM_CMD, NO, 0);
|
|
@@ -1926,11 +1878,11 @@ int main(void)
|
|
|
break;
|
|
|
case GET_PSU_COUNT:
|
|
|
{
|
|
|
- int time = GetTimeoutValue(_cmdSubPriority_time) / 1000;
|
|
|
+ int time = GetTimeoutMValue(&_cmdSubPsuPriority_time);
|
|
|
byte moduleCount = 0;
|
|
|
|
|
|
if (time < 0)
|
|
|
- gettimeofday(&_cmdSubPriority_time, NULL);
|
|
|
+ GetTimespecMFunc(&_cmdSubPsuPriority_time);
|
|
|
// 發送取得目前全部模組數量
|
|
|
GetModuleCount(SYSTEM_CMD);
|
|
|
|
|
@@ -1966,16 +1918,16 @@ int main(void)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- gettimeofday(&_cmdSubPriority_time, NULL);
|
|
|
+ GetTimespecMFunc(&_cmdSubPsuPriority_time);
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case GET_SYS_CAP:
|
|
|
{
|
|
|
- int time = GetTimeoutValue(_cmdSubPriority_time) / 1000;
|
|
|
+ int time = GetTimeoutMValue(&_cmdSubPsuPriority_time);
|
|
|
|
|
|
if (time < 0)
|
|
|
- gettimeofday(&_cmdSubPriority_time, NULL);
|
|
|
+ GetTimespecMFunc(&_cmdSubPsuPriority_time);
|
|
|
|
|
|
if (time > 500)
|
|
|
{
|
|
@@ -2028,8 +1980,8 @@ int main(void)
|
|
|
ShmPsuData->Work_Step = BOOTING_COMPLETE;
|
|
|
}
|
|
|
|
|
|
- gettimeofday(&_cmdSubPriority_time, NULL);
|
|
|
- gettimeofday(&_log_time, NULL);
|
|
|
+ GetTimespecMFunc(&_cmdSubPsuPriority_time);
|
|
|
+ GetTimespecFunc(&_log_time);
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
@@ -2038,7 +1990,7 @@ int main(void)
|
|
|
bool isSelfTestPass = true;
|
|
|
for (byte groupIndex = 0; groupIndex < _gunCount; groupIndex++)
|
|
|
{
|
|
|
- if (chargingInfo[groupIndex]->SystemStatus == S_BOOTING)
|
|
|
+ if (chargingInfo[groupIndex]->SystemStatus == SYS_MODE_BOOTING)
|
|
|
{
|
|
|
isSelfTestPass = false;
|
|
|
}
|
|
@@ -2051,18 +2003,18 @@ int main(void)
|
|
|
break;
|
|
|
case _WORK_CHARGING:
|
|
|
{
|
|
|
- int time = GetTimeoutValue(_cmdSubPriority_time) / 1000;
|
|
|
- unsigned long _timebuf = 0;
|
|
|
+ int time = GetTimeoutMValue(&_cmdSubPsuPriority_time);
|
|
|
+ int _timebuf = 0;
|
|
|
|
|
|
if (time < 0)
|
|
|
- gettimeofday(&_cmdSubPriority_time, NULL);
|
|
|
+ GetTimespecMFunc(&_cmdSubPsuPriority_time);
|
|
|
|
|
|
// 低 Priority 的指令
|
|
|
if (time > 1500)
|
|
|
{
|
|
|
PreCheckSmartChargingStep();
|
|
|
startModuleFlag = true;
|
|
|
- gettimeofday(&_cmdSubPriority_time, NULL);
|
|
|
+ GetTimespecMFunc(&_cmdSubPsuPriority_time);
|
|
|
}
|
|
|
|
|
|
for (byte groupIndex = 0; groupIndex < _gunCount; groupIndex++)
|
|
@@ -2103,18 +2055,18 @@ int main(void)
|
|
|
for (byte groupIndex = 0; groupIndex < _gunCount; groupIndex++)
|
|
|
{
|
|
|
// 針對各槍當前狀態,傳送需要回傳的資料指令
|
|
|
- if (((chargingInfo[groupIndex]->SystemStatus >= S_PREPARING_FOR_EVSE && chargingInfo[groupIndex]->SystemStatus <= S_CHARGING) && chargingInfo[groupIndex]->RelayK1K2Status) ||
|
|
|
- (chargingInfo[groupIndex]->SystemStatus >= S_PREPARING_FOR_EVSE && chargingInfo[groupIndex]->SystemStatus <= S_CHARGING && chargingInfo[groupIndex]->Type == _Type_GB) ||
|
|
|
- (chargingInfo[groupIndex]->SystemStatus >= S_CCS_PRECHARGE_ST0 && chargingInfo[groupIndex]->SystemStatus <= S_CCS_PRECHARGE_ST1))
|
|
|
+ if (((chargingInfo[groupIndex]->SystemStatus >= SYS_MODE_PREPARE_FOR_EVSE && chargingInfo[groupIndex]->SystemStatus <= SYS_MODE_CHARGING) && chargingInfo[groupIndex]->RelayK1K2Status) ||
|
|
|
+ (chargingInfo[groupIndex]->SystemStatus >= SYS_MODE_PREPARE_FOR_EVSE && chargingInfo[groupIndex]->SystemStatus <= SYS_MODE_CHARGING && chargingInfo[groupIndex]->Type == _Type_GB) ||
|
|
|
+ (chargingInfo[groupIndex]->SystemStatus >= SYS_MODE_CCS_PRECHARGE_STEP0 && chargingInfo[groupIndex]->SystemStatus <= SYS_MODE_CCS_PRECHARGE_STEP1))
|
|
|
{
|
|
|
- _timebuf = GetTimeoutValue(_log_time);
|
|
|
+ _timebuf = GetTimeoutValue(&_log_time);
|
|
|
if (_timebuf < 0)
|
|
|
- gettimeofday(&_log_time, NULL);
|
|
|
+ GetTimespecFunc(&_log_time);
|
|
|
|
|
|
- if (_timebuf / 1000 > 1000)
|
|
|
+ if (_timebuf > 1)
|
|
|
{
|
|
|
OutputChargingLogFuncion(groupIndex);
|
|
|
- gettimeofday(&_log_time, NULL);
|
|
|
+ GetTimespecFunc(&_log_time);
|
|
|
}
|
|
|
|
|
|
if (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_MAX)
|
|
@@ -2148,20 +2100,41 @@ int main(void)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- bool isNeedToOpenPower = false;
|
|
|
- for (byte index = 0; index < ShmPsuData->GroupCount; index++)
|
|
|
+ if (chargingInfo[groupIndex]->SystemStatus == SYS_MODE_PREPARE_FOR_EVSE)
|
|
|
{
|
|
|
- if (!isStartOutputSwitch[index])
|
|
|
+ if (startModuleFlag)
|
|
|
{
|
|
|
- isNeedToOpenPower = true;
|
|
|
+ if (ShmSysConfigAndInfo->SysInfo.IsAlternatvieConf == YES)
|
|
|
+ {
|
|
|
+ isStartOutputSwitch[0] = true;
|
|
|
+ SwitchSinglePower(ShmDcCommonData->connector[0][0], PSU_POWER_ON);
|
|
|
+ FlashSingleLed(ShmDcCommonData->connector[0][0], PSU_FLASH_ON);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isStartOutputSwitch[groupIndex] = true;
|
|
|
+ SwitchSinglePower(ShmDcCommonData->connector[groupIndex][0], PSU_POWER_ON);
|
|
|
+ FlashSingleLed(ShmDcCommonData->connector[groupIndex][0], PSU_FLASH_ON);
|
|
|
+ }
|
|
|
}
|
|
|
- isStartOutputSwitch[index] = true;
|
|
|
}
|
|
|
-
|
|
|
- if (isNeedToOpenPower || startModuleFlag)
|
|
|
+ else
|
|
|
{
|
|
|
- SwitchPower(SYSTEM_CMD, PSU_POWER_ON);
|
|
|
- FlashLed(SYSTEM_CMD, PSU_FLASH_ON);
|
|
|
+ bool isNeedToOpenPower = false;
|
|
|
+ for (byte index = 0; index < ShmPsuData->GroupCount; index++)
|
|
|
+ {
|
|
|
+ if (!isStartOutputSwitch[index])
|
|
|
+ {
|
|
|
+ isNeedToOpenPower = true;
|
|
|
+ }
|
|
|
+ isStartOutputSwitch[index] = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isNeedToOpenPower || startModuleFlag)
|
|
|
+ {
|
|
|
+ SwitchPower(SYSTEM_CMD, PSU_POWER_ON);
|
|
|
+ FlashLed(SYSTEM_CMD, PSU_FLASH_ON);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2191,19 +2164,31 @@ int main(void)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (!isStartOutputSwitch[groupIndex] || startModuleFlag)
|
|
|
+ if (chargingInfo[groupIndex]->SystemStatus == SYS_MODE_PREPARE_FOR_EVSE)
|
|
|
+ {
|
|
|
+ if (startModuleFlag)
|
|
|
+ {
|
|
|
+ isStartOutputSwitch[groupIndex] = true;
|
|
|
+ SwitchSinglePower(ShmDcCommonData->connector[groupIndex][0], PSU_POWER_ON);
|
|
|
+ FlashSingleLed(ShmDcCommonData->connector[groupIndex][0], PSU_FLASH_ON);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- isStartOutputSwitch[groupIndex] = true;
|
|
|
- SwitchPower(groupIndex, PSU_POWER_ON); Await();
|
|
|
- FlashLed(groupIndex, PSU_FLASH_ON); Await();
|
|
|
+ if (!isStartOutputSwitch[groupIndex] || startModuleFlag)
|
|
|
+ {
|
|
|
+ isStartOutputSwitch[groupIndex] = true;
|
|
|
+ SwitchPower(groupIndex, PSU_POWER_ON); Await();
|
|
|
+ FlashLed(groupIndex, PSU_FLASH_ON); Await();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else if (chargingInfo[groupIndex]->SystemStatus >= S_TERMINATING &&
|
|
|
- chargingInfo[groupIndex]->SystemStatus <= S_ALARM)
|
|
|
+ else if (chargingInfo[groupIndex]->SystemStatus >= SYS_MODE_TERMINATING &&
|
|
|
+ chargingInfo[groupIndex]->SystemStatus <= SYS_MODE_ALARM)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_MAX)
|
|
|
{
|
|
@@ -2226,8 +2211,8 @@ int main(void)
|
|
|
FlashLed(SYSTEM_CMD, PSU_FLASH_NORMAL);
|
|
|
}
|
|
|
|
|
|
- if (chargingInfo[groupIndex]->SystemStatus == S_COMPLETE ||
|
|
|
- chargingInfo[groupIndex]->SystemStatus == S_ALARM)
|
|
|
+ if (chargingInfo[groupIndex]->SystemStatus == SYS_MODE_COMPLETE ||
|
|
|
+ chargingInfo[groupIndex]->SystemStatus == SYS_MODE_ALARM)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysInfo.ReAssignedFlag >= _REASSIGNED_PREPARE_M_TO_A &&
|
|
|
ShmSysConfigAndInfo->SysInfo.ReAssignedFlag <= _REASSIGNED_RELAY_M_TO_A)
|
|
@@ -2238,7 +2223,7 @@ int main(void)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else if (chargingInfo[groupIndex]->SystemStatus == S_COMPLETE)
|
|
|
+ else if (chargingInfo[groupIndex]->SystemStatus == SYS_MODE_COMPLETE)
|
|
|
{
|
|
|
// 代表充電的槍依舊在充電,欲進入充電的槍取消充電了
|
|
|
if (ShmSysConfigAndInfo->SysInfo.ReAssignedFlag >= _REASSIGNED_PREPARE_M_TO_A &&
|
|
@@ -2283,7 +2268,7 @@ int main(void)
|
|
|
ShmSysConfigAndInfo->SysInfo.ReAssignedFlag = _REASSIGNED_COMP;
|
|
|
}
|
|
|
}
|
|
|
- else if ((chargingInfo[groupIndex]->SystemStatus >= S_PREPARNING && chargingInfo[groupIndex]->SystemStatus <= S_PREPARING_FOR_EV) &&
|
|
|
+ else if ((chargingInfo[groupIndex]->SystemStatus >= SYS_MODE_PREPARING && chargingInfo[groupIndex]->SystemStatus <= SYS_MODE_PREPARE_FOR_EV) &&
|
|
|
ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_AVER)
|
|
|
{
|
|
|
//PRINTF_FUNC("%d ******** 7 \n", groupIndex);
|
|
@@ -2302,10 +2287,10 @@ int main(void)
|
|
|
case _TEST_MODE:
|
|
|
{
|
|
|
// 在測試模式中,保持與模塊的通訊
|
|
|
- int time = GetTimeoutValue(_cmdSubPriority_time) / 1000;
|
|
|
+ int time = GetTimeoutMValue(&_cmdSubPsuPriority_time);
|
|
|
|
|
|
if (time < 0)
|
|
|
- gettimeofday(&_cmdSubPriority_time, NULL);
|
|
|
+ GetTimespecMFunc(&_cmdSubPsuPriority_time);
|
|
|
|
|
|
if (time > 1500)
|
|
|
{
|
|
@@ -2318,24 +2303,24 @@ int main(void)
|
|
|
GetModuleOutputF(index); Await();
|
|
|
}
|
|
|
|
|
|
- gettimeofday(&_cmdSubPriority_time, NULL);
|
|
|
+ GetTimespecMFunc(&_cmdSubPsuPriority_time);
|
|
|
}
|
|
|
|
|
|
byte _switch = 0x00;
|
|
|
if ((chargingInfo[0]->EvBatterytargetVoltage * 10) > 0 && (chargingInfo[0]->EvBatterytargetCurrent * 10) > 0)
|
|
|
_switch = 0x01;
|
|
|
|
|
|
- for (byte _groupCount_1 = 0; _groupCount_1 < conn_1_count; _groupCount_1++)
|
|
|
+ for (byte _groupCount_1 = 0; _groupCount_1 < ShmDcCommonData->conn_1_count; _groupCount_1++)
|
|
|
{
|
|
|
- SetDirModulePresentOutput(connector_1[_groupCount_1],
|
|
|
+ SetDirModulePresentOutput(ShmDcCommonData->connector[0][_groupCount_1],
|
|
|
(chargingInfo[0]->EvBatterytargetVoltage * 10),
|
|
|
(chargingInfo[0]->EvBatterytargetCurrent * 10),
|
|
|
_switch, _switch); Await();
|
|
|
}
|
|
|
|
|
|
- for (byte _groupCount_2 = 0; _groupCount_2 < conn_2_count; _groupCount_2++)
|
|
|
+ for (byte _groupCount_2 = 0; _groupCount_2 < ShmDcCommonData->conn_2_count; _groupCount_2++)
|
|
|
{
|
|
|
- SetDirModulePresentOutput(connector_2[_groupCount_2],
|
|
|
+ SetDirModulePresentOutput(ShmDcCommonData->connector[1][_groupCount_2],
|
|
|
(chargingInfo[0]->EvBatterytargetVoltage * 10),
|
|
|
(chargingInfo[0]->EvBatterytargetCurrent * 10),
|
|
|
_switch, _switch); Await();
|