|
@@ -329,7 +329,7 @@ unsigned char Query_FW_Ver(unsigned char fd, unsigned char targetAddr, Ver *Ret_
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
@@ -360,7 +360,7 @@ unsigned char Query_HW_Ver(unsigned char fd, unsigned char targetAddr, Ver *Ret_
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
@@ -391,7 +391,7 @@ unsigned char Query_Present_InputVoltage(unsigned char fd, unsigned char targetA
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
@@ -430,7 +430,7 @@ unsigned char Query_Present_OutputVoltage(unsigned char fd, unsigned char target
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
@@ -467,7 +467,7 @@ unsigned char Query_Fan_Speed(unsigned char fd, unsigned char targetAddr, FanSpe
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
@@ -500,7 +500,7 @@ unsigned char Query_Temperature(unsigned char fd, unsigned char targetAddr, Temp
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
@@ -533,7 +533,7 @@ unsigned char Query_Aux_PowerVoltage(unsigned char fd, unsigned char targetAddr,
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
@@ -566,7 +566,7 @@ unsigned char Query_Relay_Output(unsigned char fd, unsigned char targetAddr, Rel
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
@@ -602,7 +602,7 @@ unsigned char Query_Gfd_Adc(unsigned char fd, unsigned char targetAddr, Gfd *Ret
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
@@ -638,7 +638,7 @@ unsigned char Query_Gpio_Input(unsigned char fd, unsigned char targetAddr, Gpio_
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
@@ -679,7 +679,7 @@ unsigned char Query_Alarm_Log(unsigned char fd, unsigned char targetAddr, Alarm_
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
@@ -711,7 +711,7 @@ unsigned char Query_RTC(unsigned char fd, unsigned char targetAddr, Rtc *Ret_Buf
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
@@ -748,7 +748,7 @@ unsigned char Query_AC_MCU_Status(unsigned char fd, unsigned char targetAddr, Ac
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
@@ -792,7 +792,7 @@ unsigned char Query_AC_MCU_Alarm(unsigned char fd, unsigned char targetAddr, Ac_
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
@@ -837,7 +837,7 @@ unsigned char Query_AC_MCU_Alarm(unsigned char fd, unsigned char targetAddr, Ac_
|
|
|
Ret_Buf->bits.UVP_L3 = (((rx[8]>>7)&0x01)?1:0);
|
|
|
}
|
|
|
|
|
|
- //rx[9] bit 5~7 reserved
|
|
|
+ //rx[9] bits 6 & 7 Reserved
|
|
|
if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
|
|
|
{
|
|
|
Ret_Buf->bits.OCP_L2 = (((rx[9]>>0)&0x01)?1:0);
|
|
@@ -846,6 +846,7 @@ unsigned char Query_AC_MCU_Alarm(unsigned char fd, unsigned char targetAddr, Ac_
|
|
|
Ret_Buf->bits.short_circuit_L3 = (((rx[9]>>3)&0x01)?1:0);
|
|
|
}
|
|
|
Ret_Buf->bits.meter_comm_timeout = (((rx[9]>>4)&0x01)?1:0);
|
|
|
+ Ret_Buf->bits.meter_ic_comm_timeout = (((rx[9]>>5)&0x01)?1:0);
|
|
|
|
|
|
result = PASS;
|
|
|
}
|
|
@@ -1025,7 +1026,7 @@ unsigned char Config_Fan_Speed(unsigned char fd, unsigned char targetAddr, FanSp
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
chksum = 0x00;
|
|
@@ -1064,7 +1065,7 @@ unsigned char Config_Serial_Number(unsigned char fd, unsigned char targetAddr, E
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
chksum = 0x00;
|
|
@@ -1103,7 +1104,7 @@ unsigned char Config_Model_Name(unsigned char fd, unsigned char targetAddr, Evse
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
chksum = 0x00;
|
|
@@ -1128,23 +1129,40 @@ unsigned char Config_Model_Name(unsigned char fd, unsigned char targetAddr, Evse
|
|
|
unsigned char Config_Relay_Output(unsigned char fd, unsigned char targetAddr, Relay *Set_Buf)
|
|
|
{
|
|
|
unsigned char result = FAIL;
|
|
|
- unsigned char tx[9] = {0xaa, 0x00, targetAddr, CMD_CONFIG_RELAY_OUTPUT, 0x02, 0x00, 0x00, 0x00, 0x00};
|
|
|
+ unsigned char tx[15] = {0};
|
|
|
unsigned char rx[512];
|
|
|
unsigned char chksum = 0x00;
|
|
|
|
|
|
+ tx[0] = 0xaa;
|
|
|
+ tx[1] = 0x00;
|
|
|
+ tx[2] = targetAddr;
|
|
|
+ tx[3] = CMD_CONFIG_RELAY_OUTPUT;
|
|
|
+ tx[4] = 0x08;
|
|
|
+ tx[5] = 0x00;
|
|
|
+ tx[6] = 0x00;
|
|
|
+ tx[7] = 0x00;
|
|
|
+ tx[8] = 0x00;
|
|
|
+
|
|
|
for(int idx_connector=0;idx_connector<2;idx_connector++)
|
|
|
for(int idx = 0;idx<8;idx++)
|
|
|
- tx[6+idx_connector] |= ((Set_Buf->relay_status[idx_connector][idx]?0x01:0x00)<<idx);
|
|
|
+ tx[9+idx_connector] |= ((Set_Buf->relay_status[idx_connector][idx]?0x01:0x00)<<idx);
|
|
|
+
|
|
|
+ tx[11] = 0x00;
|
|
|
+ tx[12] = 0x00;
|
|
|
+ tx[13] = 0x00;
|
|
|
|
|
|
for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
|
|
|
chksum ^= tx[6+idx];
|
|
|
- tx[8] = chksum;
|
|
|
+ tx[14] = chksum;
|
|
|
+
|
|
|
+ //for(int count = 0; count < ARRAY_SIZE(tx); count++)
|
|
|
+ //printf("TX[%d] : %x \n",count, tx[count]);
|
|
|
|
|
|
unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
chksum = 0x00;
|
|
@@ -1189,7 +1207,7 @@ unsigned char Config_Gpio_Output(unsigned char fd, unsigned char targetAddr, Gpi
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
chksum = 0x00;
|
|
@@ -1214,11 +1232,10 @@ unsigned char Config_Gpio_Output(unsigned char fd, unsigned char targetAddr, Gpi
|
|
|
unsigned char Config_RTC(unsigned char fd, unsigned char targetAddr, Rtc *Set_Buf)
|
|
|
{
|
|
|
unsigned char result = FAIL;
|
|
|
- unsigned char tx[21];
|
|
|
+ unsigned char tx[21] = {0};
|
|
|
unsigned char rx[512];
|
|
|
unsigned char chksum = 0x00;
|
|
|
|
|
|
-
|
|
|
tx[0] = 0xaa;
|
|
|
tx[1] = 0x00;
|
|
|
tx[2] = targetAddr;
|
|
@@ -1248,7 +1265,7 @@ unsigned char Config_RTC(unsigned char fd, unsigned char targetAddr, Rtc *Set_Bu
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
chksum = 0x00;
|
|
@@ -1273,7 +1290,7 @@ unsigned char Config_RTC(unsigned char fd, unsigned char targetAddr, Rtc *Set_Bu
|
|
|
unsigned char Config_AC_MCU_LED(unsigned char fd, unsigned char targetAddr, Ac_Primary_Mcu_Led *Set_Buf)
|
|
|
{
|
|
|
unsigned char result = FAIL;
|
|
|
- unsigned char tx[12] ;
|
|
|
+ unsigned char tx[12] = {0};
|
|
|
unsigned char rx[512];
|
|
|
unsigned char chksum = 0x00;
|
|
|
|
|
@@ -1297,7 +1314,7 @@ unsigned char Config_AC_MCU_LED(unsigned char fd, unsigned char targetAddr, Ac_P
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
chksum = 0x00;
|
|
@@ -1322,7 +1339,7 @@ unsigned char Config_AC_MCU_LED(unsigned char fd, unsigned char targetAddr, Ac_P
|
|
|
unsigned char Config_AC_MCU_LEGACY_REQUEST(unsigned char fd, unsigned char targetAddr, Legacy_Request *Set_Buf)
|
|
|
{
|
|
|
unsigned char result = FAIL;
|
|
|
- unsigned char tx[9];
|
|
|
+ unsigned char tx[9] = {0};
|
|
|
unsigned char rx[512];
|
|
|
unsigned char chksum = 0x00;
|
|
|
|
|
@@ -1343,7 +1360,7 @@ unsigned char Config_AC_MCU_LEGACY_REQUEST(unsigned char fd, unsigned char targe
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
chksum = 0x00;
|
|
@@ -1369,7 +1386,7 @@ unsigned char Config_AC_MCU_LEGACY_REQUEST(unsigned char fd, unsigned char targe
|
|
|
unsigned char Config_AC_MCU_RESET_REQUEST(unsigned char fd, unsigned char targetAddr, Mcu_Reset_Request *Set_Buf)
|
|
|
{
|
|
|
unsigned char result = FAIL;
|
|
|
- unsigned char tx[9];
|
|
|
+ unsigned char tx[9] = {0};
|
|
|
unsigned char rx[512];
|
|
|
unsigned char chksum = 0x00;
|
|
|
|
|
@@ -1390,7 +1407,7 @@ unsigned char Config_AC_MCU_RESET_REQUEST(unsigned char fd, unsigned char target
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
chksum = 0x00;
|
|
@@ -1446,7 +1463,7 @@ unsigned char Query_AC_GUN_PLUGIN_TIMES(unsigned char fd, unsigned char targetAd
|
|
|
unsigned char Config_AC_MaxCurrent_And_CpPwmDuty(unsigned char fd, unsigned char targetAddr, Ac_Primary_Mcu_Cp_Pwm_Duty *Set_Buf)
|
|
|
{
|
|
|
unsigned char result = FAIL;
|
|
|
- unsigned char tx[8];
|
|
|
+ unsigned char tx[8] = {0};
|
|
|
unsigned char rx[512];
|
|
|
unsigned char chksum = 0x00;
|
|
|
|
|
@@ -1491,7 +1508,7 @@ unsigned char Config_AC_MaxCurrent_And_CpPwmDuty(unsigned char fd, unsigned char
|
|
|
unsigned char Config_AC_Set_Breathe_Led_Timing(unsigned char fd, unsigned char targetAddr,Set_Breathe_Led_Timing *Set_Buf)
|
|
|
{
|
|
|
unsigned char result = FAIL;
|
|
|
- unsigned char tx[19];
|
|
|
+ unsigned char tx[19] = {0};
|
|
|
unsigned char rx[512];
|
|
|
unsigned char chksum = 0x00;
|
|
|
|
|
@@ -1559,7 +1576,7 @@ unsigned char Config_AC_Set_Breathe_Led_Timing(unsigned char fd, unsigned char t
|
|
|
unsigned char Config_AC_Set_Led_Brightness(unsigned char fd, unsigned char targetAddr,Set_Led_Brightness *Set_Buf)
|
|
|
{
|
|
|
unsigned char result = FAIL;
|
|
|
- unsigned char tx[19];
|
|
|
+ unsigned char tx[19] = {0};
|
|
|
unsigned char rx[512];
|
|
|
unsigned char chksum = 0x00;
|
|
|
|
|
@@ -1672,7 +1689,7 @@ unsigned char Update_Start(unsigned char fd, unsigned char targetAddr, unsigned
|
|
|
unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
chksum = 0x00;
|
|
@@ -1704,7 +1721,7 @@ unsigned char Update_Abord(unsigned char fd, unsigned char targetAddr)
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
@@ -1752,7 +1769,7 @@ unsigned char Update_Transfer(unsigned char fd, unsigned char targetAddr, unsign
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
@@ -1783,7 +1800,7 @@ unsigned char Update_Finish(unsigned char fd, unsigned char targetAddr)
|
|
|
|
|
|
if(len > 6)
|
|
|
{
|
|
|
- if (len < 6+(rx[4] | rx[5]<<8))
|
|
|
+ if(len < 6+(rx[4] | rx[5]<<8))
|
|
|
return result;
|
|
|
|
|
|
for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
|
|
@@ -1810,8 +1827,8 @@ unsigned char Update_Finish(unsigned char fd, unsigned char targetAddr)
|
|
|
int main(void)
|
|
|
{
|
|
|
int Uart1Fd;
|
|
|
-
|
|
|
unsigned short int failCount[2] = {0,0};
|
|
|
+ struct Charger previousCharger;
|
|
|
|
|
|
if(InitShareMemory() == FAIL)
|
|
|
{
|
|
@@ -1998,8 +2015,8 @@ int main(void)
|
|
|
//================================================
|
|
|
// Byte[6]
|
|
|
// Byte[7]
|
|
|
- // Byte[8] Alarm code 3~7 bits Reserved
|
|
|
- // Byte[9] Alarm code 0~7 bits Reserved
|
|
|
+ // Byte[8] bits 3 Reserved
|
|
|
+ // Byte[9] bits 6 & 7 Reserved
|
|
|
//================================================
|
|
|
|
|
|
//================================================
|
|
@@ -2154,6 +2171,11 @@ int main(void)
|
|
|
else
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<28);
|
|
|
|
|
|
+ if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.meter_ic_comm_timeout == 0x01)
|
|
|
+ ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode |= 1<<29;
|
|
|
+ else
|
|
|
+ ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode &= ~(1<<29);
|
|
|
+
|
|
|
failCount[gun_index] = 0;
|
|
|
|
|
|
ShmCharger->gun_info[gun_index].acCcsInfo.CSUAlarmStatusCode = ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode;
|
|
@@ -2270,7 +2292,7 @@ int main(void)
|
|
|
else
|
|
|
failCount[gun_index] = FAIL_SPEC_COMM;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//===============================
|
|
|
// Case 10 : Query primary MCU power consumption
|
|
|
//===============================
|
|
@@ -2286,7 +2308,7 @@ int main(void)
|
|
|
else
|
|
|
failCount[gun_index] = FAIL_SPEC_COMM;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//==========================================================
|
|
|
// High priority polling log print out
|
|
|
//==========================================================
|
|
@@ -2297,121 +2319,188 @@ int main(void)
|
|
|
//===============================
|
|
|
// Config primary MCU LED
|
|
|
//===============================
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("***** High priority polling : Case 1 ******\n");
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("MCU-%d set Led mode : %d\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuLed.mode);
|
|
|
- DEBUG_INFO("MCU-%d set Alarm code : %x\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuLed.alarm_code);
|
|
|
+ if((previousCharger.gun_info[gun_index].primaryMcuLed.mode != ShmCharger->gun_info[gun_index].primaryMcuLed.mode) ||
|
|
|
+ (previousCharger.gun_info[gun_index].primaryMcuLed.alarm_code != ShmCharger->gun_info[gun_index].primaryMcuLed.alarm_code))
|
|
|
+ {
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("***** High priority polling : Case 1 ******\n");
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("MCU-%d set Led mode : %d\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuLed.mode);
|
|
|
+ DEBUG_INFO("MCU-%d set Alarm code : %x\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuLed.alarm_code);
|
|
|
+
|
|
|
+ previousCharger.gun_info[gun_index].primaryMcuLed.mode = ShmCharger->gun_info[gun_index].primaryMcuLed.mode;
|
|
|
+ previousCharger.gun_info[gun_index].primaryMcuLed.alarm_code = ShmCharger->gun_info[gun_index].primaryMcuLed.alarm_code;
|
|
|
+ }
|
|
|
|
|
|
//===============================
|
|
|
// Config primary Legacy request
|
|
|
//===============================
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("***** High priority polling : Case 2 ******\n");
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("MCU-%d set relay request : %d\n", gun_index, ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest);
|
|
|
+ if(previousCharger.gun_info[gun_index].legacyRequest.isLegacyRequest != ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("***** High priority polling : Case 2 ******\n");
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("MCU-%d set relay request : %d\n", gun_index, ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest);
|
|
|
+
|
|
|
+ previousCharger.gun_info[gun_index].legacyRequest.isLegacyRequest = ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest;
|
|
|
+ }
|
|
|
|
|
|
//===============================
|
|
|
// Query primary MCU status
|
|
|
//===============================
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("***** High priority polling : Case 3 ******\n");
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("MCU-%d get Pilot State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_state);
|
|
|
- DEBUG_INFO("MCU-%d get Pilot Duty : %.2f\n", gun_index, (float)ShmCharger->gun_info[gun_index].primaryMcuState.current_limit);
|
|
|
- DEBUG_INFO("MCU-%d get Pilot Voltage Positive : %.2f\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_positive);
|
|
|
- DEBUG_INFO("MCU-%d get Pilot Voltage Negative : %.2f\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_negtive);
|
|
|
- DEBUG_INFO("MCU-%d get Relay State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.relay_state);
|
|
|
- DEBUG_INFO("MCU-%d get Rating Current : %.2f\n", gun_index, (float)ShmCharger->gun_info[gun_index].primaryMcuState.rating_current);
|
|
|
- DEBUG_INFO("MCU-%d get Rotary switch : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.rotatory_switch);
|
|
|
- DEBUG_INFO("MCU-%d get is on Socket-E mode : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEMode);
|
|
|
- DEBUG_INFO("MCU-%d get Socket-E detect pin : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn);
|
|
|
-
|
|
|
- /*
|
|
|
- DEBUG_INFO("MCU-%d get Locker State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.locker_state);
|
|
|
- DEBUG_INFO("MCU-%d get Shutter State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.shutter_state);
|
|
|
- DEBUG_INFO("MCU-%d get Meter State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.meter_state);
|
|
|
- DEBUG_INFO("MCU-%d get PP State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.pp_state);
|
|
|
- */
|
|
|
+ if((previousCharger.gun_info[gun_index].primaryMcuState.cp_state != ShmCharger->gun_info[gun_index].primaryMcuState.cp_state) ||
|
|
|
+ (previousCharger.gun_info[gun_index].primaryMcuState.current_limit != ShmCharger->gun_info[gun_index].primaryMcuState.current_limit) ||
|
|
|
+ (previousCharger.gun_info[gun_index].primaryMcuState.relay_state != ShmCharger->gun_info[gun_index].primaryMcuState.relay_state) ||
|
|
|
+ (previousCharger.gun_info[gun_index].primaryMcuState.socket_e.isSocketEMode != ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEMode) ||
|
|
|
+ (previousCharger.gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn != ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn))
|
|
|
+ {
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("***** High priority polling : Case 3 ******\n");
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("MCU-%d get Pilot State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_state);
|
|
|
+ DEBUG_INFO("MCU-%d get Pilot Duty : %.2f\n", gun_index, (float)ShmCharger->gun_info[gun_index].primaryMcuState.current_limit);
|
|
|
+ DEBUG_INFO("MCU-%d get Pilot Voltage Positive : %.2f\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_positive);
|
|
|
+ DEBUG_INFO("MCU-%d get Pilot Voltage Negative : %.2f\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_negtive);
|
|
|
+
|
|
|
+ if(ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn == ON)
|
|
|
+ DEBUG_INFO("Relay on mode : CHARGING_MODE_SOCKETE. \n");
|
|
|
+ else
|
|
|
+ DEBUG_INFO("Relay on mode : CHARGING_MODE_BS / CHARGING_MODE_HLC. \n");
|
|
|
+
|
|
|
+ DEBUG_INFO("MCU-%d get Relay State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.relay_state);
|
|
|
+ DEBUG_INFO("MCU-%d get Rating Current : %.2f\n", gun_index, (float)ShmCharger->gun_info[gun_index].primaryMcuState.rating_current);
|
|
|
+ DEBUG_INFO("MCU-%d get Rotary switch : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.rotatory_switch);
|
|
|
+ DEBUG_INFO("MCU-%d get is on Socket-E mode : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEMode);
|
|
|
+ DEBUG_INFO("MCU-%d get Socket-E detect pin : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn);
|
|
|
+
|
|
|
+ //===============================
|
|
|
+ // Query primary MCU power consumption
|
|
|
+ //===============================
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("***** High priority polling : Case 10 *****\n");
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("MCU-%d get total power consumption : %f kWh\n",gun_index, ((float)ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption/10000.0));
|
|
|
+ DEBUG_INFO("MCU-%d get L1N_L12 power consumption : %f kWh\n",gun_index, ((float)ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption/10000.0));
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("MCU-%d get L2N_L23 power consumption : %f kWh\n",gun_index, ((float)ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption/10000.0));
|
|
|
+ DEBUG_INFO("MCU-%d get L3N_L31 power consumption : %f kWh\n",gun_index, ((float)ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption/10000.0));
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ DEBUG_INFO("MCU-%d get Locker State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.locker_state);
|
|
|
+ DEBUG_INFO("MCU-%d get Shutter State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.shutter_state);
|
|
|
+ DEBUG_INFO("MCU-%d get Meter State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.meter_state);
|
|
|
+ DEBUG_INFO("MCU-%d get PP State : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuState.pp_state);
|
|
|
+ */
|
|
|
+
|
|
|
+ previousCharger.gun_info[gun_index].primaryMcuState.cp_state = ShmCharger->gun_info[gun_index].primaryMcuState.cp_state;
|
|
|
+ previousCharger.gun_info[gun_index].primaryMcuState.current_limit = ShmCharger->gun_info[gun_index].primaryMcuState.current_limit;
|
|
|
+ previousCharger.gun_info[gun_index].primaryMcuState.relay_state = ShmCharger->gun_info[gun_index].primaryMcuState.relay_state;
|
|
|
+ previousCharger.gun_info[gun_index].primaryMcuState.socket_e.isSocketEMode = ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEMode;
|
|
|
+ previousCharger.gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn = ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn;
|
|
|
+ }
|
|
|
|
|
|
//===============================
|
|
|
// Query primary MCU Alarm code
|
|
|
//===============================
|
|
|
- if((ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode>0))
|
|
|
+ if((previousCharger.gun_info[gun_index].primaryMcuAlarm.InputAlarmCode != ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode))
|
|
|
{
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("***** High priority polling : Case 4 ******\n");
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("MCU-%d get OVP_L1 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP_L1);
|
|
|
- DEBUG_INFO("MCU-%d get UVP_L1 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP_L1);
|
|
|
- DEBUG_INFO("MCU-%d get OCP_L1 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L1);
|
|
|
- if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
|
|
|
+ if((ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode>0))
|
|
|
{
|
|
|
- DEBUG_INFO("MCU-%d get OVP_L2 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP_L2);
|
|
|
- DEBUG_INFO("MCU-%d get UVP_L2 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP_L2);
|
|
|
- DEBUG_INFO("MCU-%d get OCP_L2 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L2);
|
|
|
- DEBUG_INFO("MCU-%d get OVP_L3 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP_L3);
|
|
|
- DEBUG_INFO("MCU-%d get UVP_L3 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP_L3);
|
|
|
- DEBUG_INFO("MCU-%d get OCP_L3 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L3);
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("***** High priority polling : Case 4 ******\n");
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("MCU-%d get OVP_L1 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP_L1);
|
|
|
+ DEBUG_INFO("MCU-%d get UVP_L1 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP_L1);
|
|
|
+ DEBUG_INFO("MCU-%d get OCP_L1 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L1);
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("MCU-%d get OVP_L2 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP_L2);
|
|
|
+ DEBUG_INFO("MCU-%d get UVP_L2 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP_L2);
|
|
|
+ DEBUG_INFO("MCU-%d get OCP_L2 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L2);
|
|
|
+ DEBUG_INFO("MCU-%d get OVP_L3 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP_L3);
|
|
|
+ DEBUG_INFO("MCU-%d get UVP_L3 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP_L3);
|
|
|
+ DEBUG_INFO("MCU-%d get OCP_L3 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L3);
|
|
|
+ }
|
|
|
+ DEBUG_INFO("MCU-%d get OTP : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OTP);
|
|
|
+ DEBUG_INFO("MCU-%d get gmi_fault : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.gmi_fault);
|
|
|
+ DEBUG_INFO("MCU-%d get cp_fault : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.cp_fault);
|
|
|
+ DEBUG_INFO("MCU-%d get ac_leak : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.ac_leak);
|
|
|
+ DEBUG_INFO("MCU-%d get dc_leak : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.dc_leak);
|
|
|
+ DEBUG_INFO("MCU-%d get mcu_selftest_fail : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.mcu_selftest_fail);
|
|
|
+ DEBUG_INFO("MCU-%d get handshaking_timeout : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.handshaking_timeout);
|
|
|
+ DEBUG_INFO("MCU-%d get emergency_stop : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.emergency_stop);
|
|
|
+ DEBUG_INFO("MCU-%d get relay_welding : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_welding);
|
|
|
+ DEBUG_INFO("MCU-%d get leak_module_fail : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.leak_module_fail);
|
|
|
+ DEBUG_INFO("MCU-%d get shutter_fault : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.shutter_fault);
|
|
|
+ DEBUG_INFO("MCU-%d get locker_fault : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.locker_fault);
|
|
|
+ DEBUG_INFO("MCU-%d get power_drop : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.power_drop);
|
|
|
+ DEBUG_INFO("MCU-%d get rotate_switch_fault : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.rotate_switch_fault);
|
|
|
+ DEBUG_INFO("MCU-%d get short_circuit_L1 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.short_circuit_L1);
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("MCU-%d get short_circuit_L2 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.short_circuit_L2);
|
|
|
+ DEBUG_INFO("MCU-%d get short_circuit_L3 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.short_circuit_L3);
|
|
|
+ }
|
|
|
+ DEBUG_INFO("MCU-%d get relay_drive_fault : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_drive_fault);
|
|
|
+ DEBUG_INFO("MCU-%d get meter_comm_timeout : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.meter_comm_timeout);
|
|
|
+ DEBUG_INFO("MCU-%d get meter_ic_comm_timeout : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.meter_ic_comm_timeout);
|
|
|
+ DEBUG_INFO("MCU-%d get InputAlarmCode : %x\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode);
|
|
|
}
|
|
|
- DEBUG_INFO("MCU-%d get OTP : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OTP);
|
|
|
- DEBUG_INFO("MCU-%d get gmi_fault : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.gmi_fault);
|
|
|
- DEBUG_INFO("MCU-%d get cp_fault : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.cp_fault);
|
|
|
- DEBUG_INFO("MCU-%d get ac_leak : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.ac_leak);
|
|
|
- DEBUG_INFO("MCU-%d get dc_leak : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.dc_leak);
|
|
|
- DEBUG_INFO("MCU-%d get mcu_selftest_fail : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.mcu_selftest_fail);
|
|
|
- DEBUG_INFO("MCU-%d get handshaking_timeout : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.handshaking_timeout);
|
|
|
- DEBUG_INFO("MCU-%d get emergency_stop : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.emergency_stop);
|
|
|
- DEBUG_INFO("MCU-%d get relay_welding : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_welding);
|
|
|
- DEBUG_INFO("MCU-%d get leak_module_fail : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.leak_module_fail);
|
|
|
- DEBUG_INFO("MCU-%d get shutter_fault : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.shutter_fault);
|
|
|
- DEBUG_INFO("MCU-%d get locker_fault : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.locker_fault);
|
|
|
- DEBUG_INFO("MCU-%d get power_drop : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.power_drop);
|
|
|
- DEBUG_INFO("MCU-%d get rotate_switch_fault : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.rotate_switch_fault);
|
|
|
- DEBUG_INFO("MCU-%d get short_circuit_L1 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.short_circuit_L1);
|
|
|
+
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("==== Normal priority polling : Case 1 =====\n");
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("MCU-%d get Input voltage L1: %.2f\n", gun_index, (float)ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12);
|
|
|
+ DEBUG_INFO("MCU-%d get PresentChargingVoltage L1: %.2f\n", gun_index, (float)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltage);
|
|
|
if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
|
|
|
{
|
|
|
- DEBUG_INFO("MCU-%d get short_circuit_L2 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.short_circuit_L2);
|
|
|
- DEBUG_INFO("MCU-%d get short_circuit_L3 : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.short_circuit_L3);
|
|
|
+ DEBUG_INFO("MCU-%d get Input voltage L2: %f\n", gun_index, (float)ShmCharger->gun_info[gun_index].inputVoltage.L2N_L23);
|
|
|
+ DEBUG_INFO("MCU-%d get PresentChargingVoltage L2: %.2f\n", gun_index, (float)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltageL2);
|
|
|
+ DEBUG_INFO("MCU-%d get Input voltage L3: %f\n", gun_index, (float)ShmCharger->gun_info[gun_index].inputVoltage.L3N_L31);
|
|
|
+ DEBUG_INFO("MCU-%d get PresentChargingVoltage L3: %.2f\n", gun_index, (float)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltageL3);
|
|
|
}
|
|
|
- DEBUG_INFO("MCU-%d get relay_drive_fault : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_drive_fault);
|
|
|
- DEBUG_INFO("MCU-%d get meter_comm_timeout : %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.meter_comm_timeout);
|
|
|
- DEBUG_INFO("MCU-%d get InputAlarmCode : %x\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode);
|
|
|
+
|
|
|
+ previousCharger.gun_info[gun_index].primaryMcuAlarm.InputAlarmCode = ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode;
|
|
|
}
|
|
|
|
|
|
//===============================
|
|
|
// Query primary MCU BLE config
|
|
|
//===============================
|
|
|
- if(ShmCharger->gun_info[gun_index].bleConfigData.isLogin == ON)
|
|
|
+ if((previousCharger.gun_info[gun_index].bleConfigData.isLogin != ShmCharger->gun_info[gun_index].bleConfigData.isLogin) ||
|
|
|
+ (previousCharger.gun_info[gun_index].bleConfigData.isRequestStart != ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart) ||
|
|
|
+ (previousCharger.gun_info[gun_index].bleConfigData.isRequestStop != ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop))
|
|
|
{
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("***** High priority polling : Case 5 ******\n");
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("MCU-%d get isUserLogin : %d\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isLogin);
|
|
|
- DEBUG_INFO("MCU-%d get isRequestStartCharger : %d\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart);
|
|
|
- DEBUG_INFO("MCU-%d get isRequestStopCharger : %d\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop);
|
|
|
+ if(ShmCharger->gun_info[gun_index].bleConfigData.isLogin == ON)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("***** High priority polling : Case 5 ******\n");
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("MCU-%d get isUserLogin : %d\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isLogin);
|
|
|
+ DEBUG_INFO("MCU-%d get isRequestStartCharger : %d\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart);
|
|
|
+ DEBUG_INFO("MCU-%d get isRequestStopCharger : %d\n", gun_index, ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop);
|
|
|
+ }
|
|
|
+
|
|
|
+ previousCharger.gun_info[gun_index].bleConfigData.isLogin = ShmCharger->gun_info[gun_index].bleConfigData.isLogin;
|
|
|
+ previousCharger.gun_info[gun_index].bleConfigData.isRequestStart = ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart;
|
|
|
+ previousCharger.gun_info[gun_index].bleConfigData.isRequestStop = ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop;
|
|
|
}
|
|
|
|
|
|
//===============================
|
|
|
// Query primary MCU ble login id
|
|
|
//===============================
|
|
|
- if(strcmp((char *)&ShmCharger->gun_info[gun_index].bleLoginCentralId.id,"") != 0)
|
|
|
+ if((strcmp((char *)&previousCharger.gun_info[gun_index].bleLoginCentralId.id,(char *)&ShmCharger->gun_info[gun_index].bleLoginCentralId.id) != 0))
|
|
|
{
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("***** High priority polling : Case 6 ******\n");
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("MCU-%d get ble central id : %s\n", gun_index, ShmCharger->gun_info[gun_index].bleLoginCentralId.id);
|
|
|
- }
|
|
|
-
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("**** High priority polling : Case 10 ****\n");
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("MCU-%d get total power consumption : %f kWh\n",gun_index, ((float)ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption/10000.0));
|
|
|
- DEBUG_INFO("MCU-%d get L1N_L12 power consumption : %f kWh\n",gun_index, ((float)ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption/10000.0));
|
|
|
- if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
|
|
|
- {
|
|
|
- DEBUG_INFO("MCU-%d get L2N_L23 power consumption : %f kWh\n",gun_index, ((float)ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption/10000.0));
|
|
|
- DEBUG_INFO("MCU-%d get L3N_L31 power consumption : %f kWh\n",gun_index, ((float)ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption/10000.0));
|
|
|
+ if(strcmp((char *)&ShmCharger->gun_info[gun_index].bleLoginCentralId.id,"") != 0)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("***** High priority polling : Case 6 ******\n");
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("MCU-%d get ble central id : %s\n", gun_index, ShmCharger->gun_info[gun_index].bleLoginCentralId.id);
|
|
|
+ }
|
|
|
+
|
|
|
+ memcpy(&previousCharger.gun_info[gun_index].bleLoginCentralId.id, ShmCharger->gun_info[gun_index].bleLoginCentralId.id, ARRAY_SIZE(ShmCharger->gun_info[gun_index].bleLoginCentralId.id));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2469,9 +2558,13 @@ int main(void)
|
|
|
ShmCharger->gun_info[gun_index].acCcsInfo.EVSEPresentCurrent[1] = (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0];
|
|
|
ShmCharger->gun_info[gun_index].acCcsInfo.EVSEPresentCurrent[2] = (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0];
|
|
|
#else //SIMULATION
|
|
|
- ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrent = (float)(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus==SYS_MODE_CHARGING?(((rand()%10)+((ShmCharger->gun_info[gun_index].targetCurrent*10)-5))/10.0):0) ;
|
|
|
+ ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrent = (float)(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus==SYS_MODE_CHARGING?(((rand()%10)+((ShmCharger->gun_info[gun_index].targetCurrent*10)-5))/10.0):0);
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
|
|
|
+ {
|
|
|
+ ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrentL2 = (float)(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus==SYS_MODE_CHARGING?(((rand()%10)+((ShmCharger->gun_info[gun_index].targetCurrent*10)-5))/10.0):0);
|
|
|
+ ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrentL3 = (float)(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus==SYS_MODE_CHARGING?(((rand()%10)+((ShmCharger->gun_info[gun_index].targetCurrent*10)-5))/10.0):0);
|
|
|
+ }
|
|
|
#endif //SIMULATION
|
|
|
-
|
|
|
failCount[gun_index] = 0;
|
|
|
}
|
|
|
else
|
|
@@ -2584,23 +2677,6 @@ int main(void)
|
|
|
}
|
|
|
break;
|
|
|
case 11:
|
|
|
- //===============================
|
|
|
- // Query primary MCU power consumption
|
|
|
- //===============================
|
|
|
- /*
|
|
|
- if(Query_Power_Consumption(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].powerConsumptionTotal, &ShmCharger->gun_info[gun_index].powerConsumption[0], &ShmCharger->gun_info[gun_index].powerConsumption[1], &ShmCharger->gun_info[gun_index].powerConsumption[2]))
|
|
|
- {
|
|
|
- failCount[gun_index] = 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DEBUG_WARN("MCU-%d get power consumption fail...%d\n", gun_index, failCount[gun_index]);
|
|
|
- if(failCount[gun_index]<USHRT_MAX)
|
|
|
- failCount[gun_index]++;
|
|
|
- else
|
|
|
- failCount[gun_index] = FAIL_SPEC_COMM;
|
|
|
- }
|
|
|
- */
|
|
|
break;
|
|
|
case 13:
|
|
|
//===============================
|
|
@@ -2789,33 +2865,61 @@ int main(void)
|
|
|
switch(logIndex)
|
|
|
{
|
|
|
case 1:
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("==== Normal priority polling : Case 3 =====\n");
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("MCU-%d get output current L1: %f\n", gun_index, (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0]);
|
|
|
- if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
|
|
|
+ if((previousCharger.gun_info[gun_index].outputCurrent.L1N_L12[0] != ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0]) ||
|
|
|
+ (previousCharger.gun_info[gun_index].outputCurrent.L2N_L23[0] != ShmCharger->gun_info[gun_index].outputCurrent.L2N_L23[0]) ||
|
|
|
+ (previousCharger.gun_info[gun_index].outputCurrent.L3N_L31[0] != ShmCharger->gun_info[gun_index].outputCurrent.L3N_L31[0]))
|
|
|
{
|
|
|
- DEBUG_INFO("MCU-%d get output current L2: %f\n", gun_index, (float)ShmCharger->gun_info[gun_index].outputCurrent.L2N_L23[0]);
|
|
|
- DEBUG_INFO("MCU-%d get output current L3: %f\n", gun_index, (float)ShmCharger->gun_info[gun_index].outputCurrent.L3N_L31[0]);
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("==== Normal priority polling : Case 3 =====\n");
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("MCU-%d get output current L1: %f\n", gun_index, (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0]);
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("MCU-%d get output current L2: %f\n", gun_index, (float)ShmCharger->gun_info[gun_index].outputCurrent.L2N_L23[0]);
|
|
|
+ DEBUG_INFO("MCU-%d get output current L3: %f\n", gun_index, (float)ShmCharger->gun_info[gun_index].outputCurrent.L3N_L31[0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ previousCharger.gun_info[gun_index].outputCurrent.L1N_L12[0] = ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0];
|
|
|
+ previousCharger.gun_info[gun_index].outputCurrent.L2N_L23[0] = ShmCharger->gun_info[gun_index].outputCurrent.L2N_L23[0];
|
|
|
+ previousCharger.gun_info[gun_index].outputCurrent.L3N_L31[0] = ShmCharger->gun_info[gun_index].outputCurrent.L3N_L31[0];
|
|
|
}
|
|
|
+
|
|
|
break;
|
|
|
case 2:
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("==== Normal priority polling : Case 5 =====\n");
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("MCU-%d get gun plugin times : %ld\n", gun_index, (long)ShmCharger->gun_info[gun_index].gunPluginTimes.GunPluginTimes);
|
|
|
+ if(previousCharger.gun_info[gun_index].gunPluginTimes.GunPluginTimes != ShmCharger->gun_info[gun_index].gunPluginTimes.GunPluginTimes)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("==== Normal priority polling : Case 5 =====\n");
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("MCU-%d get gun plugin times : %ld\n", gun_index, (long)ShmCharger->gun_info[gun_index].gunPluginTimes.GunPluginTimes);
|
|
|
+
|
|
|
+ previousCharger.gun_info[gun_index].gunPluginTimes.GunPluginTimes = ShmCharger->gun_info[gun_index].gunPluginTimes.GunPluginTimes;
|
|
|
+ }
|
|
|
+
|
|
|
break;
|
|
|
case 3:
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("==== Normal priority polling : Case 7 =====\n");
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("MCU-%d get temperature : %d\n", gun_index, ShmCharger->gun_info[gun_index].temperature.point[0]);
|
|
|
+ if(previousCharger.gun_info[gun_index].temperature.point[0] != ShmCharger->gun_info[gun_index].temperature.point[0])
|
|
|
+ {
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("==== Normal priority polling : Case 7 =====\n");
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("MCU-%d get temperature : %d\n", gun_index, ShmCharger->gun_info[gun_index].temperature.point[0]);
|
|
|
+
|
|
|
+ previousCharger.gun_info[gun_index].temperature.point[0] = ShmCharger->gun_info[gun_index].temperature.point[0];
|
|
|
+ }
|
|
|
+
|
|
|
break;
|
|
|
case 4:
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("==== Normal priority polling : Case 9 =====\n");
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("MCU-%d set cp pwn duty : %d\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current);
|
|
|
+ if(previousCharger.gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current != ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("==== Normal priority polling : Case 9 =====\n");
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("MCU-%d set cp pwn duty : %d\n",gun_index, ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current);
|
|
|
+
|
|
|
+ previousCharger.gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current;
|
|
|
+ }
|
|
|
+
|
|
|
break;
|
|
|
case 5:
|
|
|
DEBUG_INFO("===========================================\n");
|
|
@@ -2830,8 +2934,6 @@ int main(void)
|
|
|
ShmCharger->gun_info[gun_index].rtc.hour,
|
|
|
ShmCharger->gun_info[gun_index].rtc.min,
|
|
|
ShmCharger->gun_info[gun_index].rtc.sec);
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -2881,19 +2983,30 @@ int main(void)
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("==== Normal priority polling : Case 1 =====\n");
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("MCU-%d get input voltage L1: %f\n", gun_index, (float)ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12);
|
|
|
- DEBUG_INFO("MCU-%d get PresentChargingVoltage L1: %.2f\n", gun_index, (float)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltage);
|
|
|
-
|
|
|
- if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
|
|
|
+ /*
|
|
|
+ if((previousCharger.gun_info[gun_index].inputVoltage.L1N_L12 != ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12) ||
|
|
|
+ (previousCharger.gun_info[gun_index].inputVoltage.L2N_L23 != ShmCharger->gun_info[gun_index].inputVoltage.L2N_L23) ||
|
|
|
+ (previousCharger.gun_info[gun_index].inputVoltage.L3N_L31 != ShmCharger->gun_info[gun_index].inputVoltage.L3N_L31))
|
|
|
{
|
|
|
- DEBUG_INFO("MCU-%d get input voltage L2: %f\n", gun_index, (float)ShmCharger->gun_info[gun_index].inputVoltage.L2N_L23);
|
|
|
- DEBUG_INFO("MCU-%d get PresentChargingVoltage L2: %.2f\n", gun_index, (float)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltageL2);
|
|
|
- DEBUG_INFO("MCU-%d get input voltage L3: %f\n", gun_index, (float)ShmCharger->gun_info[gun_index].inputVoltage.L3N_L31);
|
|
|
- DEBUG_INFO("MCU-%d get PresentChargingVoltage L3: %.2f\n", gun_index, (float)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltageL3);
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("==== Normal priority polling : Case 1 =====\n");
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("MCU-%d get Input voltage L1: %.2f\n", gun_index, (float)ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12);
|
|
|
+ DEBUG_INFO("MCU-%d get PresentChargingVoltage L1: %.2f\n", gun_index, (float)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltage);
|
|
|
+
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("MCU-%d get Input voltage L2: %f\n", gun_index, (float)ShmCharger->gun_info[gun_index].inputVoltage.L2N_L23);
|
|
|
+ DEBUG_INFO("MCU-%d get PresentChargingVoltage L2: %.2f\n", gun_index, (float)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltageL2);
|
|
|
+ DEBUG_INFO("MCU-%d get Input voltage L3: %f\n", gun_index, (float)ShmCharger->gun_info[gun_index].inputVoltage.L3N_L31);
|
|
|
+ DEBUG_INFO("MCU-%d get PresentChargingVoltage L3: %.2f\n", gun_index, (float)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltageL3);
|
|
|
+ }
|
|
|
+
|
|
|
+ previousCharger.gun_info[gun_index].inputVoltage.L1N_L12 = ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12;
|
|
|
+ previousCharger.gun_info[gun_index].inputVoltage.L2N_L23 = ShmCharger->gun_info[gun_index].inputVoltage.L2N_L23;
|
|
|
+ previousCharger.gun_info[gun_index].inputVoltage.L3N_L31 = ShmCharger->gun_info[gun_index].inputVoltage.L3N_L31;
|
|
|
}
|
|
|
+ */
|
|
|
|
|
|
logIndex = 0;
|
|
|
break;
|