소스 검색

2020-01-20 / Alston Lin
Actions
1. Modify 4G/wifi connection status check function
2. Support to read AC meter function (DTS 307)
3. Cancel the overvoltage check function between the request and actual value
4. Modify plug and charging function

Files
1. As follow commit history.

Alston 4 년 전
부모
커밋
fdbf3da624

+ 3 - 0
EVSE/Projects/DS60-120/Apps/Config.h

@@ -247,8 +247,11 @@ enum RELAY_STATUS_ERROR_TYPE
 
 struct DcCommonInformation
 {
+	// check if the guns are of the same type
 	byte SysGunAreSameType;
+	// to check the ccs version
 	byte CcsVersion;
+	// for relay welding/driving check
 	char RelayCheckStatus[6];
 	char GunRelayWeldingOccur[2];
 	char GunRelayDrivingOccur[2];

+ 21 - 3
EVSE/Projects/DS60-120/Apps/Module_EvComm.c

@@ -42,6 +42,8 @@
 #define EQUAL				0
 #define CHK_VOL_RANGE		50
 #define CHK_CUR_RANGE		20
+#define PLUG				1
+#define UNPLUG				0
 
 struct SysConfigAndInfo			*ShmSysConfigAndInfo;
 struct StatusCodeData 			*ShmStatusCodeData;
@@ -2490,6 +2492,7 @@ bool AbnormalStopAnalysis(byte gun_index, byte *errCode)
 	if (strcmp(string, "023735") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoReCapBmsEqrCurrentExceed = YES;
 	if (strcmp(string, "023736") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.ChademoChargeRemainCountDown = YES;
 
+	if (strcmp(string, "012288") == EQUAL) ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CcsOutputUVPFail = YES;
 	if (strcmp(string, "023701") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEvCommFail = YES;
 	if (strcmp(string, "023737") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsRESTemperatureInhibit = YES;
 	if (strcmp(string, "023738") == EQUAL) ShmStatusCodeData->InfoCode.InfoEvents.bits.CcsEVShiftPosition = YES;
@@ -2814,7 +2817,14 @@ void CANReceiver()
 					case NOTIFICATION_EV_STATUS:
 					{
 						if (_chargingData[targetGun]->ConnectorPlugIn != frame.data[0])
-							PRINTF_FUNC("Conn %d, Ori Plug status = %x, Now Plug status = %x \n", targetGun, _chargingData[targetGun]->ConnectorPlugIn, frame.data[0]);
+						{
+							if (frame.data[0] == PLUG)
+								PRINTF_FUNC("Conn %d, Plugin. \n", targetGun);
+							else if (frame.data[0] == UNPLUG)
+								PRINTF_FUNC("Conn %d, Unplug. \n", targetGun);
+							else
+								PRINTF_FUNC("Conn %d, None Check. (%d) \n", targetGun, frame.data[0]);
+						}
 
 						_chargingData[targetGun]->ConnectorPlugIn = frame.data[0];
 						_chargingData[targetGun]->PilotVoltage = frame.data[1];
@@ -3486,7 +3496,8 @@ void FormatVoltageAndCurrent()
 // 如果是使用 Meter 計算的話
 void CalOutputPowerAndEnergy(int _index)
 {
-	if(ShmSysConfigAndInfo->SysConfig.ModelName[3] == 'M')
+	if(ShmSysConfigAndInfo->SysConfig.ModelName[3] == 'M' ||
+			ShmSysConfigAndInfo->SysConfig.ModelName[3] == 'L')
 	{
 		//printf("(%d), totalChargingValue = %f \n", _index, ShmCsuMeterData->_meter[_index]._curTotalCharging / 100);
 		float totalChargingValue = ShmCsuMeterData->_meter[_index]._curTotalCharging / 100;
@@ -3682,7 +3693,8 @@ int main(int argc, char *argv[])
 						SendErrorCount[_index] = 0;
 
 						// 使用 Meter 狀況
-						if(ShmSysConfigAndInfo->SysConfig.ModelName[3] == 'M')
+						if(ShmSysConfigAndInfo->SysConfig.ModelName[3] == 'M' ||
+								ShmSysConfigAndInfo->SysConfig.ModelName[3] == 'L')
 						{
 							if (ShmCsuMeterData->_meter[_index].isCalculation == NO)
 							{
@@ -3787,6 +3799,9 @@ int main(int argc, char *argv[])
 
 					if (priorityLow % 5 == 1)
 					{
+						// 取得車端電池資訊 : 1.AC or DC ? 2.Total battery cap, 3.Max battery vol, 4.Max battery cur
+						GetEvBatteryInfo(_index, targetID);
+
 						// 樁端輸出能力改變
 						if (gun_count == 1)
 							SetPresentChargingOutputCap(_chargingData[0], _chargingData[0]);
@@ -3912,6 +3927,9 @@ int main(int argc, char *argv[])
 						{
 							SetEvsePrechargeInfo(_index, PRECHARGE_CHARELAY_PASS, targetID);
 						}
+
+						// 取得車端電池資訊 : 1.AC or DC ? 2.Total battery cap, 3.Max battery vol, 4.Max battery cur
+						GetEvBatteryInfo(_index, targetID);
 					}
 				}
 					break;

+ 11 - 7
EVSE/Projects/DS60-120/Apps/Module_InternalComm.c

@@ -1876,7 +1876,7 @@ void CableCheckDetected(byte index)
 	if ((_chargingData[index]->Type >= _Type_Chademo && _chargingData[index]->Type <= _Type_GB) ||
 			(_chargingData[index]->Type == 0x09 && ShmSysConfigAndInfo->SysConfig.AlwaysGfdFlag))
 	{
-		if ((_chargingData[index]->SystemStatus >= S_PREPARING_FOR_EVSE && _chargingData[index]->SystemStatus <= S_TERMINATING) ||
+		if ((_chargingData[index]->SystemStatus >= S_PREPARING_FOR_EVSE && _chargingData[index]->SystemStatus < S_TERMINATING) ||
 			(_chargingData[index]->SystemStatus >= S_CCS_PRECHARGE_ST0 && _chargingData[index]->SystemStatus <= S_CCS_PRECHARGE_ST1))
 		{
 			if (_chargingData[index]->SystemStatus == S_PREPARING_FOR_EVSE)
@@ -1889,7 +1889,7 @@ void CableCheckDetected(byte index)
 				SetGfdConfig(index, GFD_PRECHARGE);
 			}
 			else if (_chargingData[index]->SystemStatus >= S_CHARGING &&
-					_chargingData[index]->SystemStatus <= S_TERMINATING)
+					_chargingData[index]->SystemStatus < S_TERMINATING)
 			{
 				if (_chargingData[index]->Type == _Type_GB || _chargingData[index]->Type == _Type_Chademo)
 					SetGfdConfig(index, GFD_IDLE);
@@ -1922,16 +1922,18 @@ void CheckOutputPowerOverCarReq(byte index)
 				{
 					gettimeofday(&_checkOutputVolProtectTimer[index], NULL);
 					_isOvpChkTimeFlag[index] = YES;
+					PRINTF_FUNC("First time : CheckOutputPowerOverCarReq NG : fire = %f, req = %f, max-battery = %f \n",
+							_chargingData[index]->FireChargingVoltage, (_chargingData[index]->EvBatterytargetVoltage * 10), carV);
 				}
 			}
 			else
 			{
 				if ((GetTimeoutValue(_checkOutputVolProtectTimer[index]) / 1000) >= OUTPUT_VOL_CHK_TIME)
 				{
-					PRINTF_FUNC("[Module_InternalComm]CheckOutputPowerOverCarReq NG : fire = %f, battery = %f \n",
-							_chargingData[index]->FireChargingVoltage, (_chargingData[index]->EvBatterytargetVoltage * 10));
-					DEBUG_ERROR("[Module_InternalComm]CheckOutputPowerOverCarReq NG : fire = %f, battery = %f \n",
-							_chargingData[index]->FireChargingVoltage, (_chargingData[index]->EvBatterytargetVoltage * 10));
+					PRINTF_FUNC("[Module_InternalComm]CheckOutputPowerOverCarReq NG : fire = %f, req = %f, max-battery = %f \n",
+							_chargingData[index]->FireChargingVoltage, (_chargingData[index]->EvBatterytargetVoltage * 10), carV);
+					DEBUG_ERROR("[Module_InternalComm]CheckOutputPowerOverCarReq NG : fire = %f, req = %f, max-battery = %f \n",
+							_chargingData[index]->FireChargingVoltage, (_chargingData[index]->EvBatterytargetVoltage * 10), carV);
 
 					if (_chargingData[index]->Type == _Type_Chademo)
 						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemChademoOutputOVP = YES;
@@ -1944,6 +1946,8 @@ void CheckOutputPowerOverCarReq(byte index)
 				}
 			}
 		}
+		else
+			_isOvpChkTimeFlag[index] = NO;
 	}
 }
 
@@ -2616,7 +2620,7 @@ int main(void)
 					if (_chargingData[i]->SystemStatus == S_CHARGING)
 					{
 						CheckOutputPowerOverCarReq(i);    // load dump
-						CheckOutputVolNoneMatchFire(i);
+						//CheckOutputVolNoneMatchFire(i);
 					}
 					else
 						_isOutputNoneMatch[i] = NO;

+ 209 - 22
EVSE/Projects/DS60-120/Apps/Module_LcmControl.c

@@ -2,6 +2,9 @@
 
 bool needReloadQr = true;
 
+bool _isShow = false;
+byte _showInformIndex = 0;
+
 void PRINTF_FUNC(char *string, ...);
 
 int StoreLogMsg(const char *fmt, ...);
@@ -871,6 +874,27 @@ bool IsPageReloadChk()
 	return result;
 }
 
+void ClearDisplayInfo()
+{
+	ChangeDisplay2Value(__csu_ver_string, _disappear);
+	ChangeDisplay2Value(__csu_ver_value, _disappear);
+
+	ChangeDisplay2Value(__eth0_ip_string, _disappear);
+	ChangeDisplay2Value(__eth0_ip_value, _disappear);
+
+	ChangeDisplay2Value(__sn_string, _disappear);
+	ChangeDisplay2Value(__sn_value, _disappear);
+
+	ChangeDisplay2Value(__dc1_ver_string, _disappear);
+	ChangeDisplay2Value(__dc1_ver_value, _disappear);
+
+	ChangeDisplay2Value(__dc2_ver_string, _disappear);
+	ChangeDisplay2Value(__dc2_ver_value, _disappear);
+
+	ChangeDisplay2Value(__fan_speed_string, _disappear);
+	ChangeDisplay2Value(__fan_speed_value, _disappear);
+}
+
 void DisplayInfoCsuVer(bool isShow, unsigned char *modelName)
 {
 	if (isShow)
@@ -891,6 +915,32 @@ void DisplayInfoCsuVer(bool isShow, unsigned char *modelName)
 	}
 }
 
+void ShowWifiMode(bool isShow, unsigned char mode)
+{
+	if (isShow)
+	{
+		byte value[20];
+
+		memset(value, 0x00, sizeof(value));
+		strcpy((char *) value, "Wifi Mo. >");
+		DisplayValueToLcm(__csu_ver_string, value, sizeof(value));
+		memset(value, 0x00, sizeof(value));
+		if (mode == 0)
+			sprintf((char *)value, "disable");
+		else if (mode == 1)
+			sprintf((char *)value, "station");
+		else if (mode == 2)
+			sprintf((char *)value, "AP");
+
+		DisplayValueToLcm(__csu_ver_value, value, sizeof(value));
+	}
+	else
+	{
+		ChangeDisplay2Value(__csu_ver_string, _disappear);
+		ChangeDisplay2Value(__csu_ver_value, _disappear);
+	}
+}
+
 void DisplayInfoEthIp(bool isShow, unsigned char *ip)
 {
 	if (isShow)
@@ -911,6 +961,26 @@ void DisplayInfoEthIp(bool isShow, unsigned char *ip)
 	}
 }
 
+void Show4GRssi(bool isShow, int dbValue)
+{
+	if (isShow)
+	{
+		byte value[20];
+
+		memset(value, 0x00, sizeof(value));
+		strcpy((char *) value, "RSSI >");
+		DisplayValueToLcm(__eth0_ip_string, value, sizeof(value));
+		memset(value, 0x00, sizeof(value));
+		sprintf((char *)value, "%d dBm", dbValue);
+		DisplayValueToLcm(__eth0_ip_value, value, sizeof(value));
+	}
+	else
+	{
+		ChangeDisplay2Value(__eth0_ip_string, _disappear);
+		ChangeDisplay2Value(__eth0_ip_value, _disappear);
+	}
+}
+
 void DisplayInfoSN(bool isShow, unsigned char *sn)
 {
 	if (isShow)
@@ -931,6 +1001,26 @@ void DisplayInfoSN(bool isShow, unsigned char *sn)
 	}
 }
 
+void ShowWifiRssi(bool isShow, int dbValue)
+{
+	if (isShow)
+	{
+		byte value[20];
+
+		memset(value, 0x00, sizeof(value));
+		strcpy((char *) value, "RSSI >");
+		DisplayValueToLcm(__sn_string, value, sizeof(value));
+		memset(value, 0x00, sizeof(value));
+		sprintf((char *)value, "%d dBm", dbValue);
+		DisplayValueToLcm(__sn_value, value, sizeof(value));
+	}
+	else
+	{
+		ChangeDisplay2Value(__sn_string, _disappear);
+		ChangeDisplay2Value(__sn_value, _disappear);
+	}
+}
+
 void DisplayInfoGun1Ver(bool isShow, unsigned char *version)
 {
 	if (isShow)
@@ -951,6 +1041,30 @@ void DisplayInfoGun1Ver(bool isShow, unsigned char *version)
 	}
 }
 
+void Show4GMode(bool isShow, unsigned char mode)
+{
+	if (isShow)
+	{
+		byte value[20];
+
+		memset(value, 0x00, sizeof(value));
+		strcpy((char *) value, "3/4G Mo. >");
+		DisplayValueToLcm(__dc1_ver_string, value, sizeof(value));
+		memset(value, 0x00, sizeof(value));
+		if (mode == 0)
+			sprintf((char *)value, "disable");
+		else if (mode == 1)
+			sprintf((char *)value, "enable");
+
+		DisplayValueToLcm(__dc1_ver_value, value, sizeof(value));
+	}
+	else
+	{
+		ChangeDisplay2Value(__dc1_ver_string, _disappear);
+		ChangeDisplay2Value(__dc1_ver_value, _disappear);
+	}
+}
+
 void DisplayInfoGun2Ver(bool isShow, unsigned char *version)
 {
 	if (isShow)
@@ -971,6 +1085,26 @@ void DisplayInfoGun2Ver(bool isShow, unsigned char *version)
 	}
 }
 
+void Show4GIP(bool isShow, unsigned char *ip)
+{
+	if (isShow)
+	{
+		byte value[20];
+
+		memset(value, 0x00, sizeof(value));
+		strcpy((char *) value, "3/4G IP >");
+		DisplayValueToLcm(__dc2_ver_string, value, sizeof(value));
+		memset(value, 0x00, sizeof(value));
+		strcpy((char *) value, (char *) ip);
+		DisplayValueToLcm(__dc2_ver_value, value, sizeof(value));
+	}
+	else
+	{
+		ChangeDisplay2Value(__dc2_ver_string, _disappear);
+		ChangeDisplay2Value(__dc2_ver_value, _disappear);
+	}
+}
+
 void DisplayInfoSpeed(bool isShow, unsigned int fan)
 {
 	if (isShow)
@@ -991,35 +1125,68 @@ void DisplayInfoSpeed(bool isShow, unsigned int fan)
 	}
 }
 
-void InformationShow()
+void ShowWifiIP(bool isShow, unsigned char *ip)
 {
-	bool show = false;
+	if (isShow)
+	{
+		byte value[20];
+
+		memset(value, 0x00, sizeof(value));
+		strcpy((char *) value, "Wifi IP >");
+		DisplayValueToLcm(__fan_speed_string, value, sizeof(value));
+		memset(value, 0x00, sizeof(value));
+		strcpy((char *) value, (char *) ip);
+		DisplayValueToLcm(__fan_speed_value, value, sizeof(value));
+	}
+	else
+	{
+		ChangeDisplay2Value(__fan_speed_string, _disappear);
+		ChangeDisplay2Value(__fan_speed_value, _disappear);
+	}
+}
 
+void InformationShow()
+{
 	if(ShmSysConfigAndInfo->SysConfig.ShowInformation == YES)
 	{
-		show = true;
-		DisplayInfoCsuVer(show, ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
-		DisplayInfoSpeed(show, ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed);
-		DisplayInfoSN(show, ShmSysConfigAndInfo->SysConfig.SerialNumber);
-
-		DisplayInfoEthIp(show, ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress);
-		DisplayInfoGun1Ver(show, ShmSysConfigAndInfo->SysInfo.Connector1FwRev);
-		if (_totalCount > 1)
-			DisplayInfoGun2Ver(show, ShmSysConfigAndInfo->SysInfo.Connector2FwRev);
-		else
+		bool show = _isShow = true;
+		if (_showInformIndex == 0)
+		{
+			DisplayInfoCsuVer(show, ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
+			DisplayInfoSpeed(show, ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed);
+			DisplayInfoSN(show, ShmSysConfigAndInfo->SysConfig.SerialNumber);
+
+			DisplayInfoEthIp(show, ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress);
+			DisplayInfoGun1Ver(show, ShmSysConfigAndInfo->SysInfo.Connector1FwRev);
+			if (_totalCount > 1)
+				DisplayInfoGun2Ver(show, ShmSysConfigAndInfo->SysInfo.Connector2FwRev);
+			else
+			{
+				DisplayInfoGun2Ver(false, ShmSysConfigAndInfo->SysInfo.Connector2FwRev);
+			}
+		}
+		else if (_showInformIndex == 1)
 		{
-			DisplayInfoGun2Ver(false, ShmSysConfigAndInfo->SysInfo.Connector2FwRev);
+			ShowWifiMode(show, ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode);
+			ShowWifiIP(show, ShmSysConfigAndInfo->SysConfig.AthInterface.WifiIpAddress);
+			ShowWifiRssi(show, ShmSysConfigAndInfo->SysConfig.AthInterface.WifiRssi);
+
+			Show4GMode(show, ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled);
+			Show4GIP(show, ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress);
+			Show4GRssi(show, ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi);
 		}
 	}
 	else
 	{
-		DisplayInfoCsuVer(show, ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
-		DisplayInfoSpeed(show, ShmSysConfigAndInfo->SysInfo.SystemFanRotaSpeed);
-		DisplayInfoSN(show, ShmSysConfigAndInfo->SysConfig.SerialNumber);
+		ClearDisplayInfo();
 
-		DisplayInfoGun1Ver(show, ShmSysConfigAndInfo->SysInfo.Connector1FwRev);
-		DisplayInfoGun2Ver(show, ShmSysConfigAndInfo->SysInfo.Connector2FwRev);
-		DisplayInfoEthIp(show, ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress);
+		if (_isShow)
+		{
+			_isShow = false;
+			_showInformIndex++;
+			if (_showInformIndex >= 2)
+				_showInformIndex = 0;
+		}
 	}
 }
 
@@ -1076,6 +1243,24 @@ void ProcessPageInfo()
 					}
 				}
 			}
+
+			bool isCharging = false;
+			for(byte i = 0; i < _totalCount; i++)
+			{
+				if (_chargingInfoData[i]->SystemStatus == S_IDLE)
+					continue;
+
+				isCharging = true;
+				break;
+			}
+			if (isCharging && ShmSysConfigAndInfo->SysInfo.IsAlternatvieConf == NO)
+			{
+				ChangeDisplay2Value(__sel_gun_btn, _sel_gun_btn);
+			}
+			else
+			{
+				ChangeDisplay2Value(__sel_gun_btn, _disappear);
+			}
 		}
 			break;
 		case _LCM_AUTHORIZING:
@@ -1091,7 +1276,7 @@ void ProcessPageInfo()
 			if (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE)
 			{
 				// 新增隨插即充功能預設在等待插槍頁面在開啟
-				//ChangeDisplay2Value(__ret_home_btn, _disappear);
+				ChangeDisplay2Value(__ret_home_btn, _disappear);
 				bool isCharging = false;
 				for(byte i = 0; i < _totalCount; i++)
 				{
@@ -1111,6 +1296,8 @@ void ProcessPageInfo()
 					ChangeDisplay2Value(__sel_gun_btn, _disappear);
 				}
 			}
+			else
+				ChangeDisplay2Value(__sel_gun_btn, _disappear);
 		}
 			break;
 		case _LCM_PRE_CHARGE:
@@ -1518,9 +1705,9 @@ int main(void)
 	acgunCount = ShmSysConfigAndInfo->SysConfig.AcConnectorCount;
 	Initialization();
 
-//	ChangeToOtherPage(_LCM_IDLE);
+	//ChangeToOtherPage(_LCM_AUTHORIZING);
+	//return -1;
 
-//	return -1;
 	DefaultIconStatus();
 
 	while(_port != -1)

+ 3 - 1
EVSE/Projects/DS60-120/Apps/Module_PrimaryComm.c

@@ -338,6 +338,7 @@ void GetMeterConsumption(byte index)
 {
 	if (Query_Meter_value(Uart1Fd, Addr.IoExtend, &ShmCsuMeterData->_meter[index], &ShmCsuMeterData->isWorking, index) == PASS)
 	{
+		// meter value (Resolution) : 10
 		if (!ShmCsuMeterData->isWorking)
 		{
 			//ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterCommTimeout = YES;
@@ -623,7 +624,8 @@ int main(void)
 		{
 			GetInputGpioStatus();
 
-			if(ShmSysConfigAndInfo->SysConfig.ModelName[3] == 'M')
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[3] == 'M' ||
+					ShmSysConfigAndInfo->SysConfig.ModelName[3] == 'L')
 			{
 				GetMeterConsumption(_count);
 				_count++;

+ 10 - 5
EVSE/Projects/DS60-120/Apps/Module_PsuComm.c

@@ -1710,11 +1710,16 @@ int main(void)
 							{
 								bool isChanged = false;
 
-								PRINTF_FUNC("Max To Ava mode (3-1) : Gun_%d, PresentChargingCurrent = %f, AvailableChargingCurrent = %f, EvBatterytargetCurrent = %f, GroupPresentOutputCurrent = %d \n", groupIndex,
-									(chargingInfo[groupIndex]->PresentChargingCurrent * 10),
-									chargingInfo[groupIndex]->AvailableChargingCurrent,
-									(chargingInfo[groupIndex]->EvBatterytargetCurrent * 10),
-									ShmPsuData->PsuGroup[groupIndex].GroupPresentOutputCurrent);
+								PRINTF_FUNC("Max To Ava mode (3-1) : Gun_%d, AvailableChargingCurrent = %f, EvBatterytargetCurrent = %f \n",
+										groupIndex,
+										chargingInfo[groupIndex]->AvailableChargingCurrent,
+										(chargingInfo[groupIndex]->EvBatterytargetCurrent * 10));
+
+								PRINTF_FUNC("Max To Ava mode (3-1) : Gun_%d, PresentChargingCurrent = %f, GroupPresentOutputCurrent = %d, GroupCount = %d \n",
+										groupIndex,
+										(chargingInfo[groupIndex]->PresentChargingCurrent * 10),
+										ShmPsuData->PsuGroup[groupIndex].GroupPresentOutputCurrent,
+										ShmPsuData->GroupCount);
 
 								if (chargingInfo[groupIndex]->AvailableChargingCurrent <= (chargingInfo[groupIndex]->EvBatterytargetCurrent * 10))
 								{

+ 15 - 0
EVSE/Projects/DS60-120/Apps/ReadCmdline.c

@@ -282,6 +282,7 @@ void RunStatusProc(char *v1, char *v2)
 			printf ("SystemTimeoutFlag = %d, PageIndex = %d\n",
 					ShmSysConfigAndInfo->SysInfo.SystemTimeoutFlag, ShmSysConfigAndInfo->SysInfo.PageIndex);
 			printf ("SOC = %d \n", _chargingData[_index]->EvBatterySoc);
+			printf ("Maximum battery Voltage = %f \n", _chargingData[_index]->EvBatteryMaxVoltage);
 			printf("Charging mode = %d \n", ShmSysConfigAndInfo->SysInfo.MainChargingMode);
 		}
 		else
@@ -606,6 +607,16 @@ void SetFanSpeed(char *v1)
 	ShmFanModuleData->TestFanSpeed = speed;
 }
 
+void ShowSysInformation()
+{
+	if (!ShmSysConfigAndInfo->SysConfig.ShowInformation)
+		ShmSysConfigAndInfo->SysConfig.ShowInformation = 0x01;
+	else
+		ShmSysConfigAndInfo->SysConfig.ShowInformation = 0x00;
+
+	printf("Show inform = %d \n", ShmSysConfigAndInfo->SysConfig.ShowInformation);
+}
+
 void GetFanSpeed()
 {
 	printf("ShmFanModuleData->PresentFan1Speed = %d \n", ShmFanModuleData->PresentFan1Speed);
@@ -1248,6 +1259,10 @@ int main(void)
 			// 設定風扇速度
 			SetFanSpeed(newString[1]);
 		}
+		else if(strcmp(newString[0], "show") == 0)
+		{
+			ShowSysInformation();
+		}
 		else if(strcmp(newString[0], "speed") == 0)
 		{
 			// 取得風扇速度

+ 76 - 8
EVSE/Projects/DS60-120/Apps/main.c

@@ -159,7 +159,7 @@ bool isModelNameMatch = true;
 
 int rfidFd = -1;
 char* rfidPortName = "/dev/ttyS2";
-char* fwVersion = "V1.06.00.0000.00";
+char* fwVersion = "V1.07.00.0000.00";
 
 sqlite3 *localDb;
 bool isDb_ready;
@@ -1019,6 +1019,13 @@ int isReachableInternet()
 					{
 						strcpy((char *) ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress, tmp);
 					}
+
+					sscanf(buf, "%*s%*s%*s%s", tmp);
+					substr(tmp, tmp, strspn(tmp, "Mask:"), strlen(buf)-strspn(tmp, "Mask:"));
+					if (strcmp(tmp, (char *)ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress) != 0)
+					{
+						strcpy((char *) ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress, tmp);
+					}
 				}
 			}
 		}
@@ -1152,7 +1159,8 @@ void InitEthernet()
 					ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode != _SYS_WIFI_MODE_DISABLE &&
 					(ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'W' || ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'D'))
 			{
-				ethResult = ShmSysConfigAndInfo->SysConfig.AthInterface.WifiNetworkConn;
+				//ethResult = ShmSysConfigAndInfo->SysConfig.AthInterface.WifiNetworkConn;
+				ethResult = ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi == YES ? NO : YES;
 
 				if (ethResult)
 				{
@@ -1171,7 +1179,8 @@ void InitEthernet()
 					ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled == YES &&
 					(ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'T' || ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'D'))
 			{
-				ethResult = ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkConn;
+				//ethResult = ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomNetworkConn;
+				ethResult = ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi == YES ? NO : YES;
 
 				if (ethResult)
 				{
@@ -3192,6 +3201,8 @@ void ScannerCardProcess()
 		// 處理刷卡及驗證卡號的動作
 		UserScanFunction();
 	}
+	else if (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE)
+		strcpy((char *)ShmSysConfigAndInfo->SysConfig.UserId, "");
 
 	if (ShmSysConfigAndInfo->SysInfo.PageIndex == _LCM_AUTHORIZING)
 	{
@@ -3243,7 +3254,8 @@ void ScannerCardProcess()
 	{
 		StartSystemTimeoutDet(Timeout_VerifyComp);
 	}
-	else if(ShmSysConfigAndInfo->SysInfo.PageIndex == _LCM_WAIT_FOR_PLUG)
+	else if(ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_ENABLE &&
+			ShmSysConfigAndInfo->SysInfo.PageIndex == _LCM_WAIT_FOR_PLUG)
 	{
 		StartSystemTimeoutDet(Timeout_WaitPlug);
 	}
@@ -3439,6 +3451,7 @@ bool CheckConnectorTypeStatus()
 			{
 				if (gunIndex == 0 && bd0_1_status == 0 && bd0_2_status == 1)
 				{
+					PRINTF_FUNC("HW Conn %d (Chademo) \n", gunIndex);
 					// 與硬體相同 type : Chademo
 					if (chargingInfo[gunIndex]->Type == _Type_Chademo)
 					{
@@ -3447,6 +3460,7 @@ bool CheckConnectorTypeStatus()
 				}
 				else if (gunIndex == 0 && bd0_1_status == 1 && bd0_2_status == 0)
 				{
+					PRINTF_FUNC("HW Conn %d (CCS) \n", gunIndex);
 					// 與硬體相同 type : CCS
 					if (chargingInfo[gunIndex]->Type == _Type_CCS_2)
 					{
@@ -3455,6 +3469,7 @@ bool CheckConnectorTypeStatus()
 				}
 				else if (gunIndex == 0 && bd0_1_status == 1 && bd0_2_status == 1)
 				{
+					PRINTF_FUNC("HW Conn %d (GB) \n", gunIndex);
 					// 與硬體相同 type : GB
 					if (chargingInfo[gunIndex]->Type == _Type_GB)
 					{
@@ -3464,6 +3479,7 @@ bool CheckConnectorTypeStatus()
 
 				if (gunIndex == 1 && bd1_1_status == 0 && bd1_2_status == 1)
 				{
+					PRINTF_FUNC("HW Conn %d (Chademo) \n", gunIndex);
 					// 與硬體相同 type : Chademo
 					if (chargingInfo[gunIndex]->Type == _Type_Chademo)
 					{
@@ -3475,6 +3491,7 @@ bool CheckConnectorTypeStatus()
 				}
 				else if (gunIndex == 1 && bd1_1_status == 1 && bd1_2_status == 0)
 				{
+					PRINTF_FUNC("HW Conn %d (CCS) \n", gunIndex);
 					// 與硬體相同 type : CCS
 					if (chargingInfo[gunIndex]->Type == _Type_CCS_2)
 					{
@@ -3486,6 +3503,7 @@ bool CheckConnectorTypeStatus()
 				}
 				else if (gunIndex == 1 && bd1_1_status == 1 && bd1_2_status == 1)
 				{
+					PRINTF_FUNC("HW Conn %d (GB) \n", gunIndex);
 					// 與硬體相同 type : GB
 					if (chargingInfo[gunIndex]->Type == _Type_GB)
 					{
@@ -3659,10 +3677,18 @@ int CheckUpdateProcess(void)
                         {
                             if (chargingInfo[index]->Type == _Type_CCS_2)
                             {
+                            	byte targetID = chargingInfo[index]->Evboard_id;
+
+                            	if (ShmSysConfigAndInfo->SysConfig.TotalConnectorCount == 1 &&
+                            		ShmDcCommonData->CcsVersion == _CCS_VERSION_CHECK_TAG_V015S0)
+                            	{
+                            		targetID += 1;
+                            	}
+
                             	system("echo 3 > /proc/sys/vm/drop_caches");
                             	sleep(2);
-                            	PRINTF_FUNC("Upgrade CCS Processing.. %d \n", chargingInfo[index]->Evboard_id);
-                                if (Upgrade_CCS(CanFd, Type, chargingInfo[index]->Evboard_id, new_str, (char *)ShmSysConfigAndInfo->SysConfig.ModelName) == FAIL)
+                            	PRINTF_FUNC("Upgrade CCS Processing..target id = %d \n", targetID);
+                                if (Upgrade_CCS(CanFd, Type, targetID, new_str, (char *)ShmSysConfigAndInfo->SysConfig.ModelName) == FAIL)
                                 {
                                     PRINTF_FUNC("Upgrade CCS Failed \n");
                                     retFail++;
@@ -5637,7 +5663,7 @@ int main(void)
 		// 確認是否要回到充電中的槍畫面邏輯判斷
 		CheckReturnToChargingConn();
 
-		if (_acgunIndex > 0 && isDetectPlugin() && !isCardScan)
+		if ((_acgunIndex > 0 && isDetectPlugin() && !isCardScan))
 		{
 			ShmSysConfigAndInfo->SysInfo.SystemPage = _LCM_WAIT_FOR_PLUG;
 		}
@@ -5679,7 +5705,8 @@ int main(void)
 			gettimeofday(&_cmdMainPriority_time, NULL);
 		}
 
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[3] == 'M')
+		if(ShmSysConfigAndInfo->SysConfig.ModelName[3] == 'M' ||
+				ShmSysConfigAndInfo->SysConfig.ModelName[3] == 'L')
 			CheckStatusOfMeter();
 
 		for (byte gun_index = 0; gun_index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; gun_index++)
@@ -5862,7 +5889,18 @@ int main(void)
 								else
 								{
 									if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == gun_index)
+									{
+										if (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE)
+										{
+											ShmSysConfigAndInfo->SysInfo.SystemPage = _LCM_WAIT_FOR_PLUG;
+										}
+										else if (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_ENABLE &&
+												ShmSysConfigAndInfo->SysInfo.SystemPage == _LCM_WAIT_FOR_PLUG)
+										{
+											ShmSysConfigAndInfo->SysInfo.SystemPage = _LCM_NONE;
+										}
 										ShmSysConfigAndInfo->SysInfo.ConnectorPage = _LCM_IDLE;
+									}
 								}
 							} // Idle 正常程序終點
 						}
@@ -5939,7 +5977,10 @@ int main(void)
 						setChargerMode(gun_index, MODE_PRECHARGE);
 
 					if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == gun_index)
+					{
 						ShmSysConfigAndInfo->SysInfo.ConnectorPage = _LCM_PRE_CHARGE;
+						ShmSysConfigAndInfo->SysInfo.SystemPage = _LCM_NONE;
+					}
 				}
 					break;
 				case S_REASSIGN:
@@ -5975,7 +6016,10 @@ int main(void)
 
 					//PRINTF_FUNC("CurGunSelected = %d, gun_index = %d \n", ShmSysConfigAndInfo->SysInfo.CurGunSelected, gun_index);
 					if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == gun_index)
+					{
 						ShmSysConfigAndInfo->SysInfo.ConnectorPage = _LCM_PRE_CHARGE;
+						ShmSysConfigAndInfo->SysInfo.SystemPage = _LCM_NONE;
+					}
 				}
 					break;
 				case S_PREPARNING:
@@ -6041,7 +6085,10 @@ int main(void)
 					}
 
 					if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == gun_index)
+					{
 						ShmSysConfigAndInfo->SysInfo.ConnectorPage = _LCM_PRE_CHARGE;
+						ShmSysConfigAndInfo->SysInfo.SystemPage = _LCM_NONE;
+					}
 				}
 					break;
 				case S_PREPARING_FOR_EV: // 等待車端的通訊 (EV 小板),待車端回報後,開始樁端的測試
@@ -6106,7 +6153,10 @@ int main(void)
 
 					// LCM => Pre-charging
 					if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == gun_index)
+					{
 						ShmSysConfigAndInfo->SysInfo.ConnectorPage = _LCM_PRE_CHARGE;
+						ShmSysConfigAndInfo->SysInfo.SystemPage = _LCM_NONE;
+					}
 				}
 					break;
 				case S_PREPARING_FOR_EVSE: // 等待 RB 通訊及測試,並將狀態回報, CSU 確認 Pass 後,開始進入充電
@@ -6205,7 +6255,10 @@ int main(void)
 
 					// LCM => Pre-charging
 					if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == gun_index)
+					{
 						ShmSysConfigAndInfo->SysInfo.ConnectorPage = _LCM_PRE_CHARGE;
+						ShmSysConfigAndInfo->SysInfo.SystemPage = _LCM_NONE;
+					}
 				}
 					break;
 				case S_CHARGING: // 剛進入充電狀態,等待 EV 小板要求的輸出電流後開始輸出
@@ -6318,7 +6371,10 @@ int main(void)
 
 					// LCM => Charging
 					if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == gun_index)
+					{
 						ShmSysConfigAndInfo->SysInfo.ConnectorPage = _LCM_CHARGING;
+						ShmSysConfigAndInfo->SysInfo.SystemPage = _LCM_NONE;
+					}
 				}
 					break;
 				case S_ALARM:
@@ -6429,7 +6485,10 @@ int main(void)
 						}
 					}
 					if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == gun_index)
+					{
 						ShmSysConfigAndInfo->SysInfo.ConnectorPage = _LCM_COMPLETE;
+						ShmSysConfigAndInfo->SysInfo.SystemPage = _LCM_NONE;
+					}
 				}
 					break;
 				case S_COMPLETE:
@@ -6452,7 +6511,10 @@ int main(void)
 					}
 
 					if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == gun_index)
+					{
 						ShmSysConfigAndInfo->SysInfo.ConnectorPage = _LCM_COMPLETE;
+						ShmSysConfigAndInfo->SysInfo.SystemPage = _LCM_NONE;
+					}
 				}
 					break;
 				case S_CCS_PRECHARGE_ST0:
@@ -6508,7 +6570,10 @@ int main(void)
 					}
 
 					if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == gun_index)
+					{
 						ShmSysConfigAndInfo->SysInfo.ConnectorPage = _LCM_PRE_CHARGE;
+						ShmSysConfigAndInfo->SysInfo.SystemPage = _LCM_NONE;
+					}
 					break;
 				}
 				case S_CCS_PRECHARGE_ST1:
@@ -6550,7 +6615,10 @@ int main(void)
 					}
 
 					if (ShmSysConfigAndInfo->SysInfo.CurGunSelected == gun_index)
+					{
 						ShmSysConfigAndInfo->SysInfo.ConnectorPage = _LCM_PRE_CHARGE;
+						ShmSysConfigAndInfo->SysInfo.SystemPage = _LCM_NONE;
+					}
 					break;
 				}
 			}