Bläddra i källkod

2020-01-09 / ct_chen

Actions:
1. 修正儲存設定值未寫入nand flash的錯誤

Files:
1. EVSE/Modularization/WebService.c
ct_chen 5 år sedan
förälder
incheckning
1233c0e607
1 ändrade filer med 4 tillägg och 96 borttagningar
  1. 4 96
      EVSE/Modularization/WebService.c

+ 4 - 96
EVSE/Modularization/WebService.c

@@ -605,18 +605,7 @@ int main(int argc, char *argv[]) {
 			strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,ChargeBoxId);
 		}
 		struct SysConfigData 	SysConfig;
-		unsigned char *ptr;
-//		ptr=malloc(sizeof(struct SysConfigData));
-//		if(ptr==NULL)
-//		{
-//			#ifdef SystemLogMessage
-//			DEBUG_ERROR("malloc for SysConfigData NG");
-//			#endif
-//			return 0;
-//		}
 		memcpy(&SysConfig, &ShmSysConfigAndInfo->SysConfig, sizeof(struct SysConfigData));
-//		memset(ptr,0,sizeof(struct SysConfigData));
-//		memset(&SysConfig,0,sizeof(struct SysConfigData));
 
 		int result = StoreUsrConfigData(&SysConfig);
 		if(result != 1){
@@ -629,7 +618,6 @@ int main(int argc, char *argv[]) {
 			StoreLogMsg("[WebService]StoreUsrConfigData: normal OK");
 			#endif
 		}
-//		free(ptr);
 
 		#ifdef SystemLogMessage
 			DEBUG_INFO("WebServiceConfig update OK");
@@ -758,7 +746,9 @@ int main(int argc, char *argv[]) {
 		strcpy((char *)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId,"");
 
 		ShmSysConfigAndInfo->SysInfo.FirmwareUpdate=0;
-		StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig);
+		struct SysConfigData 	SysConfig;
+		memcpy(&SysConfig, &ShmSysConfigAndInfo->SysConfig, sizeof(struct SysConfigData));
+		StoreUsrConfigData(&SysConfig);
 
 		#ifdef SystemLogMessage
 		DEBUG_INFO("WebService initial OK");
@@ -951,16 +941,6 @@ int main(int argc, char *argv[]) {
 		struct json_object *OcppServerURL;
 		struct json_object *ChargeBoxId;
 
-		/* log for debug charginginfodata start*/
-//		#ifdef SystemLogMessage
-			WriteLogMsg("ModelName:%s",(char *)&ShmSysConfigAndInfo->SysConfig.ModelName);
-			WriteLogMsg("connectorType1:%d",connectorType1);
-			WriteLogMsg("connectorType2:%d",connectorType2);
-			WriteLogMsg("connectorType3:%d",connectorType3);
-//		#endif
-		/* log for debug charginginfodata end*/
-
-
 //		array_obj = json_object_new_array();
 		jobj1=json_object_new_object();
 		jobj2=json_object_new_object();
@@ -1108,30 +1088,6 @@ int main(int argc, char *argv[]) {
 				CHAdeMOGunQty++;
 			}
 			else if(connectorType1 == 4){//AC
-		/* log for debug charginginfodata start*/
-//		#ifdef SystemLogMessage
-			WriteLogMsg("PresentChargingVoltage[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
-			WriteLogMsg("PresentChargingCurrent[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
-			WriteLogMsg("PresentChargingPower[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
-			WriteLogMsg("PresentChargedEnergy[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
-			WriteLogMsg("PresentChargedDuration[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
-			WriteLogMsg("RemainChargingDuration[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
-			WriteLogMsg("EvBatteryMaxVoltage[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
-			WriteLogMsg("EvBatterytargetVoltage[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
-			WriteLogMsg("EvBatterySoc[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
-			WriteLogMsg("SystemStatus[0]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
-			WriteLogMsg("Index[0]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Index);
-			WriteLogMsg("Type[0]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Type);
-			WriteLogMsg("type_index[0]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].type_index);
-			WriteLogMsg("EvBatterytargetCurrent[0]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
-			WriteLogMsg("CardNumber[0]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].CardNumber);
-			WriteLogMsg("StartUserId[0]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
-			WriteLogMsg("StartDateTime[0]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
-			WriteLogMsg("StopDateTime[0]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
-			WriteLogMsg("StartMethod[0]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
-			WriteLogMsg("ConnectorTemp[0]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
-//		#endif
-		/* log for debug charginginfodata end*/
 				PresentChargingVoltage[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
 				PresentChargingCurrent[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
 				PresentChargingPower[0] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
@@ -1226,30 +1182,6 @@ int main(int argc, char *argv[]) {
 				CHAdeMOGunQty++;
 			}
 			else if(connectorType2 == 4){//AC
-		/* log for debug charginginfodata start*/
-//		#ifdef SystemLogMessage
-			WriteLogMsg("PresentChargingVoltage[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
-			WriteLogMsg("PresentChargingCurrent[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
-			WriteLogMsg("PresentChargingPower[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
-			WriteLogMsg("PresentChargedEnergy[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
-			WriteLogMsg("PresentChargedDuration[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
-			WriteLogMsg("RemainChargingDuration[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
-			WriteLogMsg("EvBatteryMaxVoltage[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
-			WriteLogMsg("EvBatterytargetVoltage[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
-			WriteLogMsg("EvBatterySoc[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
-			WriteLogMsg("SystemStatus[1]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
-			WriteLogMsg("Index[1]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Index);
-			WriteLogMsg("Type[1]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Type);
-			WriteLogMsg("type_index[1]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].type_index);
-			WriteLogMsg("EvBatterytargetCurrent[1]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
-			WriteLogMsg("CardNumber[1]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].CardNumber);
-			WriteLogMsg("StartUserId[1]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
-			WriteLogMsg("StartDateTime[1]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
-			WriteLogMsg("StopDateTime[1]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
-			WriteLogMsg("StartMethod[1]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
-			WriteLogMsg("ConnectorTemp[1]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
-//		#endif
-		/* log for debug charginginfodata end*/
 				PresentChargingVoltage[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
 				PresentChargingCurrent[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
 				PresentChargingPower[1] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
@@ -1344,30 +1276,6 @@ int main(int argc, char *argv[]) {
 				CHAdeMOGunQty++;
 			}
 			else if(connectorType3 == 4){//AC
-		/* log for debug charginginfodata start*/
-//		#ifdef SystemLogMessage
-			WriteLogMsg("PresentChargingVoltage[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
-			WriteLogMsg("PresentChargingCurrent[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
-			WriteLogMsg("PresentChargingPower[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
-			WriteLogMsg("PresentChargedEnergy[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedEnergy);
-			WriteLogMsg("PresentChargedDuration[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargedDuration);
-			WriteLogMsg("RemainChargingDuration[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].RemainChargingDuration);
-			WriteLogMsg("EvBatteryMaxVoltage[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatteryMaxVoltage);
-			WriteLogMsg("EvBatterytargetVoltage[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetVoltage);
-			WriteLogMsg("EvBatterySoc[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterySoc);
-			WriteLogMsg("SystemStatus[2]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].SystemStatus);
-			WriteLogMsg("Index[2]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Index);
-			WriteLogMsg("Type[2]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].Type);
-			WriteLogMsg("type_index[2]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].type_index);
-			WriteLogMsg("EvBatterytargetCurrent[2]:%f",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].EvBatterytargetCurrent);
-			WriteLogMsg("CardNumber[2]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].CardNumber);
-			WriteLogMsg("StartUserId[2]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartUserId);
-			WriteLogMsg("StartDateTime[2]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartDateTime);
-			WriteLogMsg("StopDateTime[2]:%s",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StopDateTime);
-			WriteLogMsg("StartMethod[2]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].StartMethod);
-			WriteLogMsg("ConnectorTemp[2]:%d",ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].ConnectorTemp);
-//		#endif
-		/* log for debug charginginfodata end*/
 				PresentChargingVoltage[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingVoltage);
 				PresentChargingCurrent[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingCurrent);
 				PresentChargingPower[2] = json_object_new_double(ShmSysConfigAndInfo->SysInfo.AcChargingData[AcGunQty].PresentChargingPower);
@@ -1422,7 +1330,7 @@ int main(int argc, char *argv[]) {
 		TelcomChapPapPwd = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd);
 		TelcomModemImei = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemImei);
 		TelcomSimImsi = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimImsi);
-		TelcomSimIccid = json_object_new_string((char*)ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimIccid);
+		TelcomSimIccid = json_object_new_string((char*)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimIccid);
 		TelcomSimStatus = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomSimStatus);
 		TelcomModemMode = json_object_new_int(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode);
 		TelcomIpAddress = json_object_new_string((char *)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomIpAddress);