|
@@ -2422,6 +2422,11 @@ void InitEthernet()
|
|
|
char tmpbuf[256];
|
|
|
unsigned int natInterface = 0;
|
|
|
|
|
|
+
|
|
|
+ system("/sbin/ifconfig uap0 down");
|
|
|
+ system("/sbin/ifconfig br0 down");
|
|
|
+ system("/usr/sbin/brctl delbr br0");
|
|
|
+
|
|
|
|
|
|
memset(tmpbuf,0,256);
|
|
|
sprintf(tmpbuf,"/sbin/ifconfig eth0 %s netmask %s up &",
|
|
@@ -2661,6 +2666,25 @@ void InitEthernet()
|
|
|
refreshStartTimer(&startTime[0][TMR_IDX_RESET_WIFI]);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing &&
|
|
|
+ (ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == 2) &&
|
|
|
+ (isUap0up() == PASS) &&
|
|
|
+ (access("/sys/class/net/br0/address", F_OK) == -1))
|
|
|
+ {
|
|
|
+ sleep(10);
|
|
|
+ system("/usr/sbin/brctl addbr br0");
|
|
|
+ system("/usr/sbin/brctl addif br0 eth0");
|
|
|
+ system("/usr/sbin/brctl addif br0 uap0");
|
|
|
+ system("/sbin/ifconfig br0 192.168.10.200 up");
|
|
|
+ system("/bin/sed -i '/interface/d' /etc/udhcpd.conf");
|
|
|
+ system("/bin/echo 'interface br0' >> /etc/udhcpd.conf");
|
|
|
+ system("kill udhcpd");
|
|
|
+ system("/usr/sbin/udhcpd /etc/udhcpd.conf");
|
|
|
+
|
|
|
+ DEBUG_INFO("Bridge uap0 & eth0 for local power sharing by ethernet.\n");
|
|
|
+ }
|
|
|
+
|
|
|
sleep(5);
|
|
|
}
|
|
|
}
|
|
@@ -4031,7 +4055,7 @@ void checkTask()
|
|
|
system("/root/Module_EventLogging &");
|
|
|
}
|
|
|
|
|
|
- if((strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") != 0) && !ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing)
|
|
|
+ if((strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") != 0))
|
|
|
{
|
|
|
if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
|
|
|
{
|
|
@@ -4069,7 +4093,7 @@ void checkTask()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if((strcmp((char *)&ShmSysConfigAndInfo->SysConfig.MaintainServerURL,"") != 0) && !ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing)
|
|
|
+ if((strcmp((char *)&ShmSysConfigAndInfo->SysConfig.MaintainServerURL,"") != 0))
|
|
|
{
|
|
|
if(system("pidof -s OcppBackendPH > /dev/null") != 0)
|
|
|
{
|
|
@@ -4458,6 +4482,20 @@ void checkChargingProfileLimit(uint8_t gun_index, uint8_t system_mode)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing > 0)
|
|
|
+ {
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.localSharingInfo.isConnectedSharingServer)
|
|
|
+ ShmCharger->gun_info[gun_index].targetCurrent = ShmSysConfigAndInfo->SysInfo.localSharingInfo.AvailableShargingCurrent[gun_index]>ShmCharger->gun_info[gun_index].primaryMcuState.rating_current?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmSysConfigAndInfo->SysInfo.localSharingInfo.AvailableShargingCurrent[gun_index];
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(ShmCharger->gun_info[gun_index].targetCurrent != 0)
|
|
|
+ DEBUG_WARN("Disconnect from power sharing server, target current set to 0.\n");
|
|
|
+
|
|
|
+ ShmCharger->gun_info[gun_index].targetCurrent = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
switch(system_mode)
|
|
|
{
|
|
|
case SYS_MODE_IDLE:
|
|
@@ -5508,14 +5546,11 @@ int main(void)
|
|
|
ShmCharger->gun_info[gun_index].isSleepOn = NO;
|
|
|
|
|
|
|
|
|
- if((strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") == 0) || ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing)
|
|
|
+ if((strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") == 0))
|
|
|
{
|
|
|
if(strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") == 0)
|
|
|
DEBUG_INFO("URL is empty kill Module_OcppBackend...\n");
|
|
|
|
|
|
- if(ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing)
|
|
|
- DEBUG_INFO("Local power sharing enable kill Module_OcppBackend...\n");
|
|
|
-
|
|
|
system ("pkill OcppBackend");
|
|
|
}
|
|
|
|
|
@@ -6288,20 +6323,6 @@ int main(void)
|
|
|
|
|
|
checkChargingProfileLimit(gun_index, ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus);
|
|
|
|
|
|
-
|
|
|
- if(!ocpp_get_connection_status() && ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing)
|
|
|
- {
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.localSharingInfo.isConnectedSharingServer)
|
|
|
- ShmCharger->gun_info[gun_index].targetCurrent = ShmSysConfigAndInfo->SysInfo.localSharingInfo.AvailableShargingCurrent;
|
|
|
- else
|
|
|
- {
|
|
|
- if(ShmCharger->gun_info[gun_index].targetCurrent != 0)
|
|
|
- DEBUG_WARN("Disconnect from power sharing server, target current set to 0.\n");
|
|
|
-
|
|
|
- ShmCharger->gun_info[gun_index].targetCurrent = 0;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
if(ocpp_get_connection_status())
|
|
|
{
|