|
@@ -40,6 +40,8 @@
|
|
|
|
|
|
struct SysConfigAndInfo *ShmSysConfigAndInfo;
|
|
|
struct StatusCodeData *ShmStatusCodeData;
|
|
|
+struct OCPP16Data *ShmOCPP16Data;
|
|
|
+struct OCPP20Data *ShmOCPP20Data;
|
|
|
struct Charger *ShmCharger;
|
|
|
|
|
|
int StoreLogMsg(const char *fmt, ...)
|
|
@@ -113,6 +115,30 @@ int InitShareMemory()
|
|
|
result = FAIL;
|
|
|
}
|
|
|
|
|
|
+ // Initial ShmOCPP16Data
|
|
|
+ if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), 0777)) < 0)
|
|
|
+ {
|
|
|
+ DEBUG_ERROR("shmget ShmOCPP16Data NG\n");
|
|
|
+ result = FAIL;
|
|
|
+ }
|
|
|
+ else if ((ShmOCPP16Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
|
|
|
+ {
|
|
|
+ DEBUG_ERROR("shmat ShmOCPP16Data NG\n");
|
|
|
+ result = FAIL;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Initial ShmOCPP20Data
|
|
|
+ if ((MeterSMId = shmget(ShmOcpp20ModuleKey, sizeof(struct OCPP20Data), 0777)) < 0)
|
|
|
+ {
|
|
|
+ DEBUG_ERROR("shmget ShmOCPP20Data NG\n");
|
|
|
+ result = FAIL;
|
|
|
+ }
|
|
|
+ else if ((ShmOCPP20Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
|
|
|
+ {
|
|
|
+ DEBUG_ERROR("shmat ShmOCPP20Data NG\n");
|
|
|
+ result = FAIL;
|
|
|
+ }
|
|
|
+
|
|
|
//Initial ShmCharger
|
|
|
if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), 0777)) < 0)
|
|
|
{
|
|
@@ -165,6 +191,7 @@ int main(void)
|
|
|
memset(cmd, 0x00, ARRAY_SIZE(cmd));
|
|
|
printf("\n ============== Debug main menu ==================");
|
|
|
printf("\n info: List charger status info.");
|
|
|
+ printf("\n test: Charger test command.");
|
|
|
printf("\n exit: Exit Module_Debug_Test.");
|
|
|
printf("\n =================================================");
|
|
|
printf("\n Please input debug command: ");
|
|
@@ -195,14 +222,26 @@ int main(void)
|
|
|
|
|
|
gun_index = gun_index<AC_QUANTITY?gun_index:0;
|
|
|
|
|
|
+ printf("\n CSU u-boot version: %s", ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev);
|
|
|
+ printf("\n CSU kernel version: %s", ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev);
|
|
|
+ printf("\n CSU rootfs version: %s", ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
|
|
|
+ printf("\n --------------------------------------------------");
|
|
|
printf("\n Charger connector plug times: %d", ShmCharger->gun_info[gun_index].gunPluginTimes.GunPluginTimes);
|
|
|
+ printf("\n --------------------------------------------------");
|
|
|
printf("\n CP positive voltage: %.2f", ShmCharger->gun_info[gun_index].PilotVoltage.PilotVoltagePositive);
|
|
|
printf("\n CP negative voltage: %.2f", ShmCharger->gun_info[gun_index].PilotVoltage.PilotVoltageNegative);
|
|
|
+ printf("\n --------------------------------------------------");
|
|
|
printf("\n CSU to MCU legacyRequest: %d", ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest);
|
|
|
printf("\n CSU to MCU relay on request: %d", ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn);
|
|
|
+ printf("\n --------------------------------------------------");
|
|
|
printf("\n Charger charging mode BS/HLC: %d", ShmCharger->gun_info[gun_index].chargingMode);
|
|
|
+ printf("\n --------------------------------------------------");
|
|
|
printf("\n Charger input voltage L1: %.2f", ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12);
|
|
|
+ printf("\n --------------------------------------------------");
|
|
|
printf("\n CSU output current L1: %.2f", ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0]);
|
|
|
+ printf("\n --------------------------------------------------");
|
|
|
+ printf("\n CSU power total consumption: %.2f", (ShmCharger->gun_info[gun_index].powerConsumption.power_consumption/100.0));
|
|
|
+ printf("\n --------------------------------------------------");
|
|
|
printf("\n CSU temperature: %d", ShmCharger->gun_info[gun_index].temperature.point[0]);
|
|
|
|
|
|
wait();
|
|
@@ -213,7 +252,9 @@ int main(void)
|
|
|
scanf("%d", &gun_index);
|
|
|
printf("\n MCU info.\n\n");
|
|
|
|
|
|
+ gun_index = gun_index<AC_QUANTITY?gun_index:0;
|
|
|
|
|
|
+ printf("\n Firmware version: %s", ShmCharger->gun_info[gun_index].ver.Version_FW);
|
|
|
|
|
|
wait();
|
|
|
}
|
|
@@ -224,6 +265,72 @@ int main(void)
|
|
|
}
|
|
|
}while(!isExit);
|
|
|
}
|
|
|
+ else if(strcmp(cmd, "test") == 0)
|
|
|
+ {
|
|
|
+ int gun_index;
|
|
|
+
|
|
|
+ memset(cmd, 0x00, ARRAY_SIZE(cmd));
|
|
|
+ printf("\n ***************** Info menu *********************");
|
|
|
+ printf("\n start: start charging session");
|
|
|
+ printf("\n stop: stop charging session");
|
|
|
+ printf("\n operative: enable charger gun");
|
|
|
+ printf("\n inoperative: disable charger gun");
|
|
|
+ printf("\n exit: exit to previous menu.");
|
|
|
+ printf("\n *************************************************");
|
|
|
+ printf("\n Please input command: ");
|
|
|
+ scanf("%s", &cmd[0]);
|
|
|
+
|
|
|
+ if(strcmp(cmd, "start") == 0)
|
|
|
+ {
|
|
|
+ printf("\n Please input gun index: ");
|
|
|
+ scanf("%d", &gun_index);
|
|
|
+
|
|
|
+ ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].schedule.isTriggerStart = ON;
|
|
|
+ }
|
|
|
+ else if(strcmp(cmd, "stop") == 0)
|
|
|
+ {
|
|
|
+ printf("\n Please input gun index: ");
|
|
|
+ scanf("%d", &gun_index);
|
|
|
+
|
|
|
+ ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].schedule.isTriggerStop = ON;
|
|
|
+ }
|
|
|
+ else if(strcmp(cmd, "operative") == 0)
|
|
|
+ {
|
|
|
+ printf("\n Please input gun index: ");
|
|
|
+ scanf("%d", &gun_index);
|
|
|
+
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP16Data->ChangeAvailability[gun_index].Type, "Operative");
|
|
|
+ ShmOCPP16Data->CsMsg.bits[gun_index].ChangeAvailabilityReq = ON;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sprintf((char*)(char*)ShmOCPP20Data->ChangeAvailability[gun_index].operationalStatus, "Operative");
|
|
|
+ ShmOCPP20Data->CsMsg.bits[gun_index].ChangeAvailabilityReq = ON;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(strcmp(cmd, "inoperative") == 0)
|
|
|
+ {
|
|
|
+ printf("\n Please input gun index: ");
|
|
|
+ scanf("%d", &gun_index);
|
|
|
+
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP16Data->ChangeAvailability[gun_index].Type, "Inoperative");
|
|
|
+ ShmOCPP16Data->CsMsg.bits[gun_index].ChangeAvailabilityReq = ON;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sprintf((char*)(char*)ShmOCPP20Data->ChangeAvailability[gun_index].operationalStatus, "Inoperative");
|
|
|
+ ShmOCPP20Data->CsMsg.bits[gun_index].ChangeAvailabilityReq = ON;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(strcmp(cmd, "exit") == 0)
|
|
|
+ {
|
|
|
+ printf("\n Exit to previous.\n\n");
|
|
|
+ }
|
|
|
+ }
|
|
|
else if(strcmp(cmd, "exit") == 0)
|
|
|
{
|
|
|
printf("\n exit program.\n\n");
|