|
@@ -38,6 +38,11 @@
|
|
|
#define ON 1
|
|
|
#define OFF 0
|
|
|
|
|
|
+//Print out level
|
|
|
+unsigned char PRINT_OUT_LEVEL_STATE = 0;
|
|
|
+#define LEVEL_1 4 // 3 Seconds
|
|
|
+#define LEVEL_2 8 // 6 Seconds
|
|
|
+
|
|
|
struct SysConfigAndInfo *ShmSysConfigAndInfo;
|
|
|
struct StatusCodeData *ShmStatusCodeData;
|
|
|
struct PrimaryMcuData *ShmPrimaryMcuData;
|
|
@@ -51,6 +56,7 @@ int mystrcmp(char *p1,char *p2);
|
|
|
void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
|
|
|
void split(char **arr, char *str, const char *del);
|
|
|
|
|
|
+
|
|
|
int StoreLogMsg(const char *fmt, ...)
|
|
|
{
|
|
|
char Buf[4096+256];
|
|
@@ -66,16 +72,31 @@ int StoreLogMsg(const char *fmt, ...)
|
|
|
memset(Buf,0,sizeof(Buf));
|
|
|
CurrentTime = time(NULL);
|
|
|
tm=localtime(&CurrentTime);
|
|
|
- sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
|
|
|
- tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
|
|
|
- buffer,
|
|
|
- tm->tm_year+1900,tm->tm_mon+1);
|
|
|
+
|
|
|
+ if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
|
|
|
+ {
|
|
|
+ sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
|
|
|
+ tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
|
|
|
+ buffer,
|
|
|
+ tm->tm_year+1900,tm->tm_mon+1,
|
|
|
+ ShmSysConfigAndInfo->SysConfig.ModelName,
|
|
|
+ ShmSysConfigAndInfo->SysConfig.SerialNumber);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
|
|
|
+ tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
|
|
|
+ buffer,
|
|
|
+ tm->tm_year+1900,tm->tm_mon+1);
|
|
|
+ }
|
|
|
|
|
|
#ifdef SystemLogMessage
|
|
|
system(Buf);
|
|
|
#endif
|
|
|
|
|
|
+#ifdef ConsloePrintLog
|
|
|
printf("[%04d.%02d.%02d %02d:%02d:%02d] - %s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec, buffer);
|
|
|
+#endif
|
|
|
|
|
|
return rc;
|
|
|
}
|
|
@@ -153,7 +174,7 @@ int InitShareMemory()
|
|
|
int MeterSMId;
|
|
|
|
|
|
//Initial ShmSysConfigAndInfo
|
|
|
- if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
|
|
|
+ if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
|
|
|
{
|
|
|
#ifdef SystemLogMessage
|
|
|
DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
|
|
@@ -169,7 +190,7 @@ int InitShareMemory()
|
|
|
}
|
|
|
|
|
|
//Initial ShmStatusCodeData
|
|
|
- if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
|
|
|
+ if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
|
|
|
{
|
|
|
#ifdef SystemLogMessage
|
|
|
DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
|
|
@@ -185,7 +206,7 @@ int InitShareMemory()
|
|
|
}
|
|
|
|
|
|
//Initial ShmPrimaryMcuKey
|
|
|
- if ((MeterSMId = shmget(ShmPrimaryMcuKey, sizeof(struct PrimaryMcuData), IPC_CREAT | 0777)) < 0)
|
|
|
+ if ((MeterSMId = shmget(ShmPrimaryMcuKey, sizeof(struct PrimaryMcuData), 0777)) < 0)
|
|
|
{
|
|
|
#ifdef SystemLogMessage
|
|
|
DEBUG_ERROR("shmget ShmPrimaryMcuData NG\r\n");
|
|
@@ -201,7 +222,7 @@ int InitShareMemory()
|
|
|
}
|
|
|
|
|
|
//creat ShmOCPP16Data
|
|
|
- if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), 0777)) < 0)
|
|
|
+ if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), 0777)) < 0)
|
|
|
{
|
|
|
#ifdef SystemLogMessage
|
|
|
DEBUG_ERROR("shmget ShmOCPP16Data NG");
|
|
@@ -219,7 +240,7 @@ int InitShareMemory()
|
|
|
{}
|
|
|
|
|
|
//Initial ShmCharger
|
|
|
- if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), IPC_CREAT | 0777)) < 0)
|
|
|
+ if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), 0777)) < 0)
|
|
|
{
|
|
|
#ifdef SystemLogMessage
|
|
|
DEBUG_ERROR("shmget ShmChargerKey NG\r\n");
|
|
@@ -1000,6 +1021,9 @@ unsigned char Config_Serial_Number(unsigned char fd, unsigned char targetAddr, E
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
+ if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ return result;
|
|
|
+
|
|
|
chksum = 0x00;
|
|
|
for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
|
{
|
|
@@ -1036,6 +1060,9 @@ unsigned char Config_Model_Name(unsigned char fd, unsigned char targetAddr, Evse
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
+ if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ return result;
|
|
|
+
|
|
|
chksum = 0x00;
|
|
|
for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
|
{
|
|
@@ -1396,6 +1423,9 @@ unsigned char Config_AC_MaxCurrent_And_CpPwmDuty(unsigned char fd, unsigned char
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ return result;
|
|
|
+
|
|
|
chksum = 0x00;
|
|
|
for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
|
{
|
|
@@ -1466,7 +1496,6 @@ unsigned char Update_Abord(unsigned char fd, unsigned char targetAddr)
|
|
|
for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
|
{
|
|
|
chksum ^= rx[6+idx];
|
|
|
-
|
|
|
}
|
|
|
|
|
|
if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
|
|
@@ -1541,7 +1570,7 @@ unsigned char Update_Finish(unsigned char fd, unsigned char targetAddr)
|
|
|
if(len > 6)
|
|
|
{
|
|
|
if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
- return result;
|
|
|
+ return result;
|
|
|
|
|
|
for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
|
{
|
|
@@ -1569,6 +1598,7 @@ int main(void)
|
|
|
int Uart1Fd;
|
|
|
|
|
|
unsigned short int failCount[2] = {0,0};
|
|
|
+ unsigned short int printOutCount[2] = {0,0};
|
|
|
|
|
|
if(InitShareMemory() == FAIL)
|
|
|
{
|
|
@@ -1615,16 +1645,13 @@ int main(void)
|
|
|
/*
|
|
|
* High priority communication
|
|
|
*/
|
|
|
- DEBUG_INFO("========== High priority polling ==========\r\n");
|
|
|
+
|
|
|
//===============================
|
|
|
- // Config primary MCU LED
|
|
|
+ // Case 1 : Config primary MCU LED
|
|
|
//===============================
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuLed.alarm_code = ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode;
|
|
|
if(Config_AC_MCU_LED(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuLed))
|
|
|
{
|
|
|
- DEBUG_INFO("MCU-%d set Led mode : %d\r\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuLed.mode);
|
|
|
- DEBUG_INFO("MCU-%d set Alarm code : %x\r\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuLed.alarm_code);
|
|
|
-
|
|
|
failCount[gun_index] = 0;
|
|
|
}
|
|
|
else
|
|
@@ -1637,12 +1664,10 @@ int main(void)
|
|
|
}
|
|
|
|
|
|
//===============================
|
|
|
- // Config primary Legacy request
|
|
|
+ // Case 2 : Config primary Legacy request
|
|
|
//===============================
|
|
|
if(Config_AC_MCU_LEGACY_REQUEST(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1),&ShmCharger->gun_info[gun_index].legacyRequest))
|
|
|
{
|
|
|
- DEBUG_INFO("MCU-%d set relay request : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest);
|
|
|
-
|
|
|
failCount[gun_index] = 0;
|
|
|
}
|
|
|
else
|
|
@@ -1655,22 +1680,10 @@ int main(void)
|
|
|
}
|
|
|
|
|
|
//===============================
|
|
|
- // Query primary MCU status
|
|
|
+ // Case 3 : Query primary MCU status
|
|
|
//===============================
|
|
|
if(Query_AC_MCU_Status(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuState))
|
|
|
{
|
|
|
- DEBUG_INFO("MCU-%d get Pilot State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_state);
|
|
|
- DEBUG_INFO("MCU-%d get Pilot Duty : %.2f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].primaryMcuState.current_limit);
|
|
|
- DEBUG_INFO("MCU-%d get Pilot Voltage Positive : %.2f\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_positive);
|
|
|
- DEBUG_INFO("MCU-%d get Pilot Voltage Negative : %.2f\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_negtive);
|
|
|
- DEBUG_INFO("MCU-%d get Relay State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.relay_state);
|
|
|
- DEBUG_INFO("MCU-%d get Rating Current : %.2f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].primaryMcuState.rating_current);
|
|
|
- DEBUG_INFO("MCU-%d get Rotary switch : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.rotatory_switch);
|
|
|
- DEBUG_INFO("MCU-%d get Locker State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.locker_state);
|
|
|
- DEBUG_INFO("MCU-%d get Shutter State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.shutter_state);
|
|
|
- DEBUG_INFO("MCU-%d get Meter State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.meter_state);
|
|
|
- DEBUG_INFO("MCU-%d get PP State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.pp_state);
|
|
|
-
|
|
|
ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState = ShmCharger->gun_info[gun_index].primaryMcuState.cp_state;
|
|
|
ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotDuty = (ShmCharger->gun_info[gun_index].primaryMcuState.current_limit>51?(unsigned char)((ShmCharger->gun_info[gun_index].primaryMcuState.current_limit/2.5)+64):(unsigned char)(ShmCharger->gun_info[gun_index].primaryMcuState.current_limit/0.6));
|
|
|
ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotVoltage = ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_positive;
|
|
@@ -1689,17 +1702,18 @@ int main(void)
|
|
|
}
|
|
|
|
|
|
//===============================
|
|
|
- // Query primary MCU Alarm code
|
|
|
+ // Case 4 : Query primary MCU Alarm code
|
|
|
//===============================
|
|
|
if(Query_AC_MCU_Alarm(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuAlarm))
|
|
|
{
|
|
|
- DEBUG_INFO("MCU-%d get alarm OK...\r\n");
|
|
|
- /*
|
|
|
+ //DEBUG_INFO("MCU-%d get alarm code success.\r\n",gun_index);
|
|
|
+
|
|
|
+ //================================================
|
|
|
// Byte[6]
|
|
|
// Byte[7]
|
|
|
// Byte[8] Alarm code 3~7 bits Reserved
|
|
|
// Byte[9] Alarm code 0~7 bits Reserved
|
|
|
- */
|
|
|
+ //================================================
|
|
|
|
|
|
//================================================
|
|
|
// Byte[6]
|
|
@@ -1806,32 +1820,8 @@ int main(void)
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<18);
|
|
|
|
|
|
//================================================
|
|
|
- // Byte[9]
|
|
|
+ // Byte[9] Reserved
|
|
|
//================================================
|
|
|
- // Debug information print out
|
|
|
- if((ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode>0))
|
|
|
- {
|
|
|
- DEBUG_INFO("MCU-%d get OVP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP);
|
|
|
- DEBUG_INFO("MCU-%d get UVP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP);
|
|
|
- DEBUG_INFO("MCU-%d get OCP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP);
|
|
|
- DEBUG_INFO("MCU-%d get OTP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OTP);
|
|
|
- DEBUG_INFO("MCU-%d get gmi_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.gmi_fault);
|
|
|
- DEBUG_INFO("MCU-%d get cp_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.cp_fault);
|
|
|
- DEBUG_INFO("MCU-%d get ac_leak : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.ac_leak);
|
|
|
- DEBUG_INFO("MCU-%d get dc_leak : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.dc_leak);
|
|
|
- DEBUG_INFO("MCU-%d get mcu_selftest_fail : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.mcu_selftest_fail);
|
|
|
- DEBUG_INFO("MCU-%d get handshaking_timeout : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.handshaking_timeout);
|
|
|
- DEBUG_INFO("MCU-%d get emergency_stop : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.emergency_stop);
|
|
|
- DEBUG_INFO("MCU-%d get relay_welding : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_welding);
|
|
|
- DEBUG_INFO("MCU-%d get leak_module_fail : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.leak_module_fail);
|
|
|
- DEBUG_INFO("MCU-%d get shutter_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.shutter_fault);
|
|
|
- DEBUG_INFO("MCU-%d get locker_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.locker_fault);
|
|
|
- DEBUG_INFO("MCU-%d get power_drop : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.power_drop);
|
|
|
- DEBUG_INFO("MCU-%d get circuit_short : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.circuit_short);
|
|
|
- DEBUG_INFO("MCU-%d get set_circuit : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.set_circuit);
|
|
|
- DEBUG_INFO("MCU-%d get relay_drive_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_drive_fault);
|
|
|
- DEBUG_INFO("MCU-%d get InputAlarmCode : %x\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode);
|
|
|
- }
|
|
|
|
|
|
failCount[gun_index] = 0;
|
|
|
}
|
|
@@ -1845,17 +1835,10 @@ int main(void)
|
|
|
}
|
|
|
|
|
|
//===============================
|
|
|
- // Query primary MCU BLE config
|
|
|
+ // Case 5 : Query primary MCU BLE config
|
|
|
//===============================
|
|
|
if(Query_Ble_Config(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].bleConfigData))
|
|
|
{
|
|
|
- if(ShmCharger->gun_info[gun_index].bleConfigData.isLogin == ON)
|
|
|
- {
|
|
|
- DEBUG_INFO("MCU-%d get isUserLogin : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isLogin);
|
|
|
- DEBUG_INFO("MCU-%d get isRequestStartCharger : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart);
|
|
|
- DEBUG_INFO("MCU-%d get isRequestStopCharger : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop);
|
|
|
- }
|
|
|
-
|
|
|
ShmSysConfigAndInfo->SysConfig.Bluetooth.isLogin = ShmCharger->gun_info[gun_index].bleConfigData.isLogin;
|
|
|
ShmSysConfigAndInfo->SysConfig.Bluetooth.isRequestStart = ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart;
|
|
|
ShmSysConfigAndInfo->SysConfig.Bluetooth.isRequestStop = ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop;
|
|
@@ -1872,11 +1855,10 @@ int main(void)
|
|
|
}
|
|
|
|
|
|
//===============================
|
|
|
- // Query primary MCU ble login id
|
|
|
+ // Case 6 : Query primary MCU ble login id
|
|
|
//===============================
|
|
|
if(Query_Ble_Central_ID(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].bleLoginCentralId))
|
|
|
{
|
|
|
- DEBUG_INFO("MCU-%d get ble central id : %s\r\n", gun_index, ShmCharger->gun_info[gun_index].bleLoginCentralId.id);
|
|
|
memcpy(ShmSysConfigAndInfo->SysConfig.Bluetooth.LoginCentralID, ShmCharger->gun_info[gun_index].bleLoginCentralId.id, sizeof ShmSysConfigAndInfo->SysConfig.Bluetooth.LoginCentralID);
|
|
|
|
|
|
failCount[gun_index] = 0;
|
|
@@ -1891,12 +1873,15 @@ int main(void)
|
|
|
}
|
|
|
|
|
|
//===============================
|
|
|
- // Config primary MCU reset request
|
|
|
+ // Case 7 : Config primary MCU reset request
|
|
|
//===============================
|
|
|
if(ShmCharger->gun_info[gun_index].mcuResetRequest.isMcuResetRequest == ON)
|
|
|
{
|
|
|
if(Config_AC_MCU_RESET_REQUEST(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].mcuResetRequest) == PASS)
|
|
|
{
|
|
|
+ DEBUG_INFO("**************************************************\r\n");
|
|
|
+ DEBUG_INFO("********* High priority polling : Case 7 *********\r\n");
|
|
|
+ DEBUG_INFO("**************************************************\r\n");
|
|
|
DEBUG_INFO("MCU-%d set MCU reset Request : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].mcuResetRequest.isMcuResetRequest);
|
|
|
|
|
|
ShmCharger->gun_info[gun_index].mcuResetRequest.isMcuResetRequest = OFF;
|
|
@@ -1912,13 +1897,128 @@ int main(void)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //==========================================================
|
|
|
+ // High priority polling log print out
|
|
|
+ //==========================================================
|
|
|
+ if(ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest == ON)
|
|
|
+ {
|
|
|
+ PRINT_OUT_LEVEL_STATE = LEVEL_1;
|
|
|
+ if(printOutCount[gun_index]>LEVEL_1)
|
|
|
+ printOutCount[gun_index] = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ PRINT_OUT_LEVEL_STATE = LEVEL_2;
|
|
|
+ if(printOutCount[gun_index]>LEVEL_2)
|
|
|
+ printOutCount[gun_index] = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(printOutCount[gun_index] == PRINT_OUT_LEVEL_STATE)
|
|
|
+ {
|
|
|
+ //===============================
|
|
|
+ // Config primary MCU LED
|
|
|
+ //===============================
|
|
|
+ DEBUG_INFO("**************************************************\r\n");
|
|
|
+ DEBUG_INFO("********* High priority polling : Case 1 *********\r\n");
|
|
|
+ DEBUG_INFO("**************************************************\r\n");
|
|
|
+ DEBUG_INFO("MCU-%d set Led mode : %d\r\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuLed.mode);
|
|
|
+ DEBUG_INFO("MCU-%d set Alarm code : %x\r\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuLed.alarm_code);
|
|
|
+
|
|
|
+ //===============================
|
|
|
+ // Config primary Legacy request
|
|
|
+ //===============================
|
|
|
+ DEBUG_INFO("**************************************************\r\n");
|
|
|
+ DEBUG_INFO("********* High priority polling : Case 2 *********\r\n");
|
|
|
+ DEBUG_INFO("**************************************************\r\n");
|
|
|
+ DEBUG_INFO("MCU-%d set relay request : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest);
|
|
|
+
|
|
|
+ //===============================
|
|
|
+ // Query primary MCU status
|
|
|
+ //===============================
|
|
|
+ DEBUG_INFO("**************************************************\r\n");
|
|
|
+ DEBUG_INFO("********* High priority polling : Case 3 *********\r\n");
|
|
|
+ DEBUG_INFO("**************************************************\r\n");
|
|
|
+ DEBUG_INFO("MCU-%d get Pilot State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_state);
|
|
|
+ DEBUG_INFO("MCU-%d get Pilot Duty : %.2f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].primaryMcuState.current_limit);
|
|
|
+ DEBUG_INFO("MCU-%d get Pilot Voltage Positive : %.2f\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_positive);
|
|
|
+ DEBUG_INFO("MCU-%d get Pilot Voltage Negative : %.2f\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_negtive);
|
|
|
+ DEBUG_INFO("MCU-%d get Relay State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.relay_state);
|
|
|
+ DEBUG_INFO("MCU-%d get Rating Current : %.2f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].primaryMcuState.rating_current);
|
|
|
+ DEBUG_INFO("MCU-%d get Rotary switch : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.rotatory_switch);
|
|
|
+
|
|
|
+ /*
|
|
|
+ DEBUG_INFO("MCU-%d get Locker State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.locker_state);
|
|
|
+ DEBUG_INFO("MCU-%d get Shutter State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.shutter_state);
|
|
|
+ DEBUG_INFO("MCU-%d get Meter State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.meter_state);
|
|
|
+ DEBUG_INFO("MCU-%d get PP State : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.pp_state);
|
|
|
+ */
|
|
|
+
|
|
|
+ //===============================
|
|
|
+ // Query primary MCU Alarm code
|
|
|
+ //===============================
|
|
|
+ if((ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode>0))
|
|
|
+ {
|
|
|
+ DEBUG_INFO("**************************************************\r\n");
|
|
|
+ DEBUG_INFO("********* High priority polling : Case 4 *********\r\n");
|
|
|
+ DEBUG_INFO("**************************************************\r\n");
|
|
|
+ DEBUG_INFO("MCU-%d get OVP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP);
|
|
|
+ DEBUG_INFO("MCU-%d get UVP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP);
|
|
|
+ DEBUG_INFO("MCU-%d get OCP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP);
|
|
|
+ DEBUG_INFO("MCU-%d get OTP : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OTP);
|
|
|
+ DEBUG_INFO("MCU-%d get gmi_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.gmi_fault);
|
|
|
+ DEBUG_INFO("MCU-%d get cp_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.cp_fault);
|
|
|
+ DEBUG_INFO("MCU-%d get ac_leak : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.ac_leak);
|
|
|
+ DEBUG_INFO("MCU-%d get dc_leak : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.dc_leak);
|
|
|
+ DEBUG_INFO("MCU-%d get mcu_selftest_fail : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.mcu_selftest_fail);
|
|
|
+ DEBUG_INFO("MCU-%d get handshaking_timeout : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.handshaking_timeout);
|
|
|
+ DEBUG_INFO("MCU-%d get emergency_stop : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.emergency_stop);
|
|
|
+ DEBUG_INFO("MCU-%d get relay_welding : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_welding);
|
|
|
+ DEBUG_INFO("MCU-%d get leak_module_fail : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.leak_module_fail);
|
|
|
+ DEBUG_INFO("MCU-%d get shutter_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.shutter_fault);
|
|
|
+ DEBUG_INFO("MCU-%d get locker_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.locker_fault);
|
|
|
+ DEBUG_INFO("MCU-%d get power_drop : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.power_drop);
|
|
|
+ DEBUG_INFO("MCU-%d get circuit_short : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.circuit_short);
|
|
|
+ DEBUG_INFO("MCU-%d get set_circuit : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.set_circuit);
|
|
|
+ DEBUG_INFO("MCU-%d get relay_drive_fault : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_drive_fault);
|
|
|
+ DEBUG_INFO("MCU-%d get InputAlarmCode : %x\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode);
|
|
|
+ }
|
|
|
+
|
|
|
+ //===============================
|
|
|
+ // Query primary MCU BLE config
|
|
|
+ //===============================
|
|
|
+ if(ShmCharger->gun_info[gun_index].bleConfigData.isLogin == ON)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("**************************************************\r\n");
|
|
|
+ DEBUG_INFO("********* High priority polling : Case 5 *********\r\n");
|
|
|
+ DEBUG_INFO("**************************************************\r\n");
|
|
|
+ DEBUG_INFO("MCU-%d get isUserLogin : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isLogin);
|
|
|
+ DEBUG_INFO("MCU-%d get isRequestStartCharger : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart);
|
|
|
+ DEBUG_INFO("MCU-%d get isRequestStopCharger : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop);
|
|
|
+ }
|
|
|
+
|
|
|
+ //===============================
|
|
|
+ // Query primary MCU ble login id
|
|
|
+ //===============================
|
|
|
+ if(strcmp((char *)&ShmCharger->gun_info[gun_index].bleLoginCentralId.id,"") != 0)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("**************************************************\r\n");
|
|
|
+ DEBUG_INFO("********* High priority polling : Case 6 *********\r\n");
|
|
|
+ DEBUG_INFO("**************************************************\r\n");
|
|
|
+ DEBUG_INFO("MCU-%d get ble central id : %s\r\n", gun_index, ShmCharger->gun_info[gun_index].bleLoginCentralId.id);
|
|
|
+ }
|
|
|
+
|
|
|
+ usleep(100000);
|
|
|
+ }
|
|
|
+
|
|
|
+ printOutCount[gun_index]++;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
/*
|
|
|
* Normal priority communication
|
|
|
*/
|
|
|
- DEBUG_INFO("========== Normal priority polling ==========\r\n");
|
|
|
+
|
|
|
switch(stepIndex)
|
|
|
{
|
|
|
case 1:
|
|
@@ -1927,11 +2027,12 @@ int main(void)
|
|
|
//===============================
|
|
|
if(Query_Present_InputVoltage(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].inputVoltage) == PASS)
|
|
|
{
|
|
|
- DEBUG_INFO("MCU-%d get input voltage : %f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12);
|
|
|
ShmSysConfigAndInfo->SysInfo.InputVoltageR = ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12;
|
|
|
ShmSysConfigAndInfo->SysInfo.InputVoltageS = ShmCharger->gun_info[gun_index].inputVoltage.L2N_L23;
|
|
|
ShmSysConfigAndInfo->SysInfo.InputVoltageT = ShmCharger->gun_info[gun_index].inputVoltage.L3N_L31;
|
|
|
|
|
|
+ ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltage = ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12;
|
|
|
+
|
|
|
failCount[gun_index] = 0;
|
|
|
}
|
|
|
else
|
|
@@ -1949,7 +2050,7 @@ int main(void)
|
|
|
//===============================
|
|
|
if(Query_Present_OutputCurrent(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].outputCurrent) == PASS)
|
|
|
{
|
|
|
- DEBUG_INFO("MCU-%d get output current : %f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0]);
|
|
|
+ ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrent = (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0];
|
|
|
|
|
|
failCount[gun_index] = 0;
|
|
|
}
|
|
@@ -1968,8 +2069,6 @@ int main(void)
|
|
|
//===============================
|
|
|
if(Query_AC_GUN_PLUGIN_TIMES(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].gunPluginTimes) == PASS)
|
|
|
{
|
|
|
- DEBUG_INFO("MCU-%d get gun plugin times : %ld\r\n", gun_index, (long)ShmCharger->gun_info[gun_index].gunPluginTimes.GunPluginTimes);
|
|
|
-
|
|
|
ShmSysConfigAndInfo->SysConfig.AcPlugInTimes = ((long)ShmCharger->gun_info[gun_index].gunPluginTimes.GunPluginTimes & 0xFFFF);
|
|
|
|
|
|
failCount[gun_index] = 0;
|
|
@@ -1989,7 +2088,6 @@ int main(void)
|
|
|
//===============================
|
|
|
if(Query_Temperature(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].temperature) == PASS)
|
|
|
{
|
|
|
- DEBUG_INFO("MCU-%d get temperature : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].temperature.point[0]);
|
|
|
ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp = ShmCharger->gun_info[gun_index].temperature.point[0];
|
|
|
|
|
|
failCount[gun_index] = 0;
|
|
@@ -2007,18 +2105,22 @@ int main(void)
|
|
|
//===============================
|
|
|
// Config primary set CP PWN duty
|
|
|
//===============================
|
|
|
- if(Config_AC_MaxCurrent_And_CpPwmDuty(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty))
|
|
|
+ if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == ON)
|
|
|
{
|
|
|
- DEBUG_INFO("MCU-%d cp pwn duty : %d\r\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current);
|
|
|
-
|
|
|
- failCount[gun_index] = 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DEBUG_WARN("MCU-%d set cp pwn duty fail...%d\r\n", gun_index, failCount[gun_index]);
|
|
|
- if(failCount[gun_index]<1000)
|
|
|
+ if(Config_AC_MaxCurrent_And_CpPwmDuty(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty))
|
|
|
{
|
|
|
- failCount[gun_index]++;
|
|
|
+ failCount[gun_index] = 0;
|
|
|
+ ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = OFF;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = OFF;
|
|
|
+
|
|
|
+ DEBUG_WARN("MCU-%d set cp pwn duty fail...%d\r\n", gun_index, failCount[gun_index]);
|
|
|
+ if(failCount[gun_index]<1000)
|
|
|
+ {
|
|
|
+ failCount[gun_index]++;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
@@ -2055,14 +2157,6 @@ int main(void)
|
|
|
system(cmdBuf);
|
|
|
system("hwclock -w -u");
|
|
|
system("hwclock -s");
|
|
|
-
|
|
|
- DEBUG_INFO("Sync from MCU-%d rtc OK...%04d-%02d-%02d %02d:%02d:%02d\r\n", gun_index,
|
|
|
- ShmCharger->gun_info[gun_index].rtc.year,
|
|
|
- ShmCharger->gun_info[gun_index].rtc.month,
|
|
|
- ShmCharger->gun_info[gun_index].rtc.day,
|
|
|
- ShmCharger->gun_info[gun_index].rtc.hour,
|
|
|
- ShmCharger->gun_info[gun_index].rtc.min,
|
|
|
- ShmCharger->gun_info[gun_index].rtc.sec);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -2076,14 +2170,6 @@ int main(void)
|
|
|
ShmCharger->gun_info[gun_index].rtc.min = tmCSU->tm_min;
|
|
|
ShmCharger->gun_info[gun_index].rtc.sec = tmCSU->tm_sec;
|
|
|
Config_RTC(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].rtc);
|
|
|
-
|
|
|
- DEBUG_INFO("MCU-%d set rtc OK...%04d-%02d-%02d %02d:%02d:%02d\r\n", gun_index,
|
|
|
- ShmCharger->gun_info[gun_index].rtc.year,
|
|
|
- ShmCharger->gun_info[gun_index].rtc.month,
|
|
|
- ShmCharger->gun_info[gun_index].rtc.day,
|
|
|
- ShmCharger->gun_info[gun_index].rtc.hour,
|
|
|
- ShmCharger->gun_info[gun_index].rtc.min,
|
|
|
- ShmCharger->gun_info[gun_index].rtc.sec);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2104,8 +2190,6 @@ int main(void)
|
|
|
//===============================
|
|
|
if(Query_Power_Consumption(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].powerConsumption))
|
|
|
{
|
|
|
- DEBUG_INFO("MCU-%d get power consumption : %f\r\n",gun_index, ((float)ShmCharger->gun_info[gun_index].powerConsumption.power_consumption/100.0));
|
|
|
-
|
|
|
failCount[gun_index] = 0;
|
|
|
}
|
|
|
else
|
|
@@ -2123,6 +2207,10 @@ int main(void)
|
|
|
//===============================
|
|
|
if(ShmCharger->gun_info[gun_index].mcuFlag.isMcuUpgradeReq)
|
|
|
{
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+ DEBUG_INFO("======== Normal priority polling : Case 15 =======\r\n");
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+
|
|
|
unsigned char cmd[512];
|
|
|
if(Upgrade_UART(Uart1Fd, AC_WALLMOUNT_CONTROLLER, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), ShmCharger->fwUpgradeInfo.location, ShmCharger->fwUpgradeInfo.modelName))
|
|
|
{
|
|
@@ -2145,10 +2233,14 @@ int main(void)
|
|
|
}
|
|
|
break;
|
|
|
case 17:
|
|
|
-
|
|
|
+ //DEBUG_INFO("==================================================\r\n");
|
|
|
+ //DEBUG_INFO("======== Normal priority polling : Case 17 =======\r\n");
|
|
|
+ //DEBUG_INFO("==================================================\r\n");
|
|
|
break;
|
|
|
case 19:
|
|
|
-
|
|
|
+ //DEBUG_INFO("==================================================\r\n");
|
|
|
+ //DEBUG_INFO("======== Normal priority polling : Case 19 =======\r\n");
|
|
|
+ //DEBUG_INFO("==================================================\r\n");
|
|
|
break;
|
|
|
case 21:
|
|
|
//===============================
|
|
@@ -2156,6 +2248,9 @@ int main(void)
|
|
|
//===============================
|
|
|
if(ShmCharger->gun_info[gun_index].mcuFlag.isReadFwVerPass != PASS)
|
|
|
{
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+ DEBUG_INFO("======== Normal priority polling : Case 21-1======\r\n");
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
if(Query_FW_Ver(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].ver) == PASS)
|
|
|
{
|
|
|
DEBUG_INFO("MCU-%d get firmware version : %s\r\n", gun_index, ShmCharger->gun_info[gun_index].ver.Version_FW);
|
|
@@ -2179,6 +2274,9 @@ int main(void)
|
|
|
//===============================
|
|
|
if(ShmCharger->gun_info[gun_index].mcuFlag.isSetSerialNumberPass != PASS)
|
|
|
{
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+ DEBUG_INFO("======== Normal priority polling : Case 21-2======\r\n");
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
memcpy(ShmCharger->evseId.serial_number, ShmSysConfigAndInfo->SysConfig.SerialNumber, ARRAY_SIZE(ShmCharger->evseId.serial_number));
|
|
|
if(Config_Serial_Number(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->evseId))
|
|
|
{
|
|
@@ -2202,6 +2300,9 @@ int main(void)
|
|
|
//===============================
|
|
|
if(ShmCharger->gun_info[gun_index].mcuFlag.isSetModelNamePass != PASS)
|
|
|
{
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+ DEBUG_INFO("======== Normal priority polling : Case 21-3======\r\n");
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
memcpy(ShmCharger->evseId.model_name, ShmSysConfigAndInfo->SysConfig.ModelName, ARRAY_SIZE(ShmCharger->evseId.model_name));
|
|
|
if(Config_Model_Name(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->evseId))
|
|
|
{
|
|
@@ -2224,10 +2325,89 @@ int main(void)
|
|
|
stepIndex = 0;
|
|
|
break;
|
|
|
}
|
|
|
+
|
|
|
+ //==========================================================
|
|
|
+ // Low priority polling log print out
|
|
|
+ //==========================================================
|
|
|
+ if(printOutCount[gun_index] == PRINT_OUT_LEVEL_STATE)
|
|
|
+ {
|
|
|
+ if(stepIndex == 1)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+ DEBUG_INFO("======== Normal priority polling : Case 1 ========\r\n");
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+ DEBUG_INFO("MCU-%d get input voltage : %f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12);
|
|
|
+ DEBUG_INFO("MCU-%d get PresentChargingVoltage : %.2f\r\n", gun_index, (float)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltage);
|
|
|
+ }
|
|
|
+ else if(stepIndex == 3)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+ DEBUG_INFO("======== Normal priority polling : Case 3 ========\r\n");
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+ DEBUG_INFO("MCU-%d get output current : %f\r\n", gun_index, (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0]);
|
|
|
+ }
|
|
|
+ else if (stepIndex == 5)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+ DEBUG_INFO("======== Normal priority polling : Case 5 ========\r\n");
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+ DEBUG_INFO("MCU-%d get gun plugin times : %ld\r\n", gun_index, (long)ShmCharger->gun_info[gun_index].gunPluginTimes.GunPluginTimes);
|
|
|
+ }
|
|
|
+ else if (stepIndex == 7)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+ DEBUG_INFO("======== Normal priority polling : Case 7 ========\r\n");
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+ DEBUG_INFO("MCU-%d get temperature : %d\r\n", gun_index, ShmCharger->gun_info[gun_index].temperature.point[0]);
|
|
|
+ }
|
|
|
+ else if (stepIndex == 9)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+ DEBUG_INFO("======== Normal priority polling : Case 9 ========\r\n");
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+ DEBUG_INFO("MCU-%d cp pwn duty : %d\r\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current);
|
|
|
+ }
|
|
|
+ else if (stepIndex == 11)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+ DEBUG_INFO("======== Normal priority polling : Case 11 =======\r\n");
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+ if(ShmCharger->gun_info[gun_index].bleConfigData.isLogin && !ShmOCPP16Data->OcppConnStatus)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("Sync from MCU-%d rtc OK...%04d-%02d-%02d %02d:%02d:%02d\r\n", gun_index,
|
|
|
+ ShmCharger->gun_info[gun_index].rtc.year,
|
|
|
+ ShmCharger->gun_info[gun_index].rtc.month,
|
|
|
+ ShmCharger->gun_info[gun_index].rtc.day,
|
|
|
+ ShmCharger->gun_info[gun_index].rtc.hour,
|
|
|
+ ShmCharger->gun_info[gun_index].rtc.min,
|
|
|
+ ShmCharger->gun_info[gun_index].rtc.sec);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ DEBUG_INFO("MCU-%d set rtc OK...%04d-%02d-%02d %02d:%02d:%02d\r\n", gun_index,
|
|
|
+ ShmCharger->gun_info[gun_index].rtc.year,
|
|
|
+ ShmCharger->gun_info[gun_index].rtc.month,
|
|
|
+ ShmCharger->gun_info[gun_index].rtc.day,
|
|
|
+ ShmCharger->gun_info[gun_index].rtc.hour,
|
|
|
+ ShmCharger->gun_info[gun_index].rtc.min,
|
|
|
+ ShmCharger->gun_info[gun_index].rtc.sec);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (stepIndex == 13)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+ DEBUG_INFO("======== Normal priority polling : Case 13 =======\r\n");
|
|
|
+ DEBUG_INFO("==================================================\r\n");
|
|
|
+ DEBUG_INFO("MCU-%d get power consumption : %f kWh\r\n",gun_index, ((float)ShmCharger->gun_info[gun_index].powerConsumption.power_consumption/100));
|
|
|
+ }
|
|
|
+
|
|
|
+ usleep(100000);
|
|
|
+ }
|
|
|
}
|
|
|
stepIndex++;
|
|
|
|
|
|
-
|
|
|
//===============================
|
|
|
// Communication fail check
|
|
|
//===============================
|