|
@@ -60,6 +60,9 @@
|
|
|
#define UPGRADE_PRI 0x04
|
|
|
#define UPGRADE_AC 0x05
|
|
|
#define UPGRADE_LED 0x06
|
|
|
+#define UPGRADE_DORC1 0x07
|
|
|
+#define UPGRADE_DORC2 0x08
|
|
|
+#define UPGRADE_DDRB 0x09
|
|
|
#define SYSTEM_MIN_VOL 150
|
|
|
#define MIN_OUTPUT_CUR 0
|
|
|
#define AC_OUTPUT_VOL 220
|
|
@@ -89,12 +92,14 @@
|
|
|
#define DISPENSER_RECONNECTE_TIME 30
|
|
|
#define DISPENSER_AUTH_COMP_TIME 3
|
|
|
#define FORCE_BALANCE_TIME 5
|
|
|
+#define DISPENSER_UPGRADE_TIME 600
|
|
|
|
|
|
char *valid_Internet[2] = {"8.8.8.8", "180.76.76.76"};
|
|
|
unsigned char mask_table[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
|
|
|
int whileLoopTime = 10000;
|
|
|
int wtdFd = -1;
|
|
|
byte _authorizeIndex = NO_DEFINE;
|
|
|
+BOOL _UpgradeNeedReboot = FALSE;
|
|
|
|
|
|
bool IsAuthorizingMode();
|
|
|
void ClearAuthorizedFlag();
|
|
@@ -158,6 +163,7 @@ struct timeval _ConnectorAuthorizing_Time[CONNECTOR_QUANTITY];
|
|
|
struct timeval _ConnectorAuthorizeFail_Time[CONNECTOR_QUANTITY];
|
|
|
struct timeval _DispenserAuthorizing_Time[CONNECTOR_QUANTITY];
|
|
|
int chargingTime[CONNECTOR_QUANTITY];
|
|
|
+struct timeval _DispenserUpgrade_time;
|
|
|
|
|
|
|
|
|
byte _gunIndex = 0;
|
|
@@ -176,7 +182,7 @@ bool isModelNameMatch = true;
|
|
|
|
|
|
|
|
|
|
|
|
-char* fwVersion = "D0.07.00.0000.00";
|
|
|
+char* fwVersion = "D0.08.00.0000.00";
|
|
|
|
|
|
sqlite3 *localDb;
|
|
|
bool isDb_ready;
|
|
@@ -1348,6 +1354,8 @@ void InitialShareMemoryInfo()
|
|
|
char cmd[512];
|
|
|
char buf[512];
|
|
|
|
|
|
+ _UpgradeNeedReboot = FALSE;
|
|
|
+
|
|
|
sprintf((char *)ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn, "Internet");
|
|
|
sprintf((char *)ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId, " ");
|
|
|
sprintf((char *)ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd, " ");
|
|
@@ -3121,15 +3129,19 @@ void PowerCabinetAuthorizingSettingInitial(void)
|
|
|
ShmSysConfigAndInfo->SysInfo.CabinetSetting.bits.BackendAuthorized = false;
|
|
|
}
|
|
|
|
|
|
+void AnnounceAccountBalance(unsigned char index, int balance)
|
|
|
+{
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].Parameter.bits.AnnounceBalance = true;
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].AccountBalance = balance;
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].Parameter.bits.AccountBalanceRequest = true;
|
|
|
+ PRINTF_FUNC("Announce Account Balance %d To Connector %d", balance, index + 1);
|
|
|
+}
|
|
|
+
|
|
|
void FouceAnnounceAccountBalance(unsigned char index)
|
|
|
{
|
|
|
if(!ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].Parameter.bits.AnnounceBalance)
|
|
|
{
|
|
|
- ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].Parameter.bits.AnnounceBalance = true;
|
|
|
-
|
|
|
- ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].AccountBalance = 0;
|
|
|
- ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].Parameter.bits.AccountBalanceRequest = true;
|
|
|
- PRINTF_FUNC("Force Announce Account Balance To Connector %d", index + 1);
|
|
|
+ AnnounceAccountBalance(index, 0);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -3799,157 +3811,272 @@ void KillTask()
|
|
|
system("killall Module_Wifi &");
|
|
|
}
|
|
|
|
|
|
-char CheckUpdateProcess()
|
|
|
+int PutDispenserImage(char *IpAddress, char *SourcePath)
|
|
|
{
|
|
|
- DIR *d;
|
|
|
- struct dirent *dir;
|
|
|
- d = opendir("/mnt/");
|
|
|
+ int isPass = PASS;
|
|
|
+ unsigned char ftpcmdbuf[256];
|
|
|
|
|
|
- if (d)
|
|
|
- {
|
|
|
- long int MaxLen=48*1024*1024, ImageLen = 0;
|
|
|
- while ((dir = readdir(d)) != NULL)
|
|
|
+ PRINTF_FUNC("Transfer image(%s) to ip: %s ", SourcePath, IpAddress);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ sprintf((char*)ftpcmdbuf,"ftpput -u root -p y42j/4cj84 %s %s %s", IpAddress, SourcePath, SourcePath);
|
|
|
+
|
|
|
+ if(system((char*)ftpcmdbuf) != 0)
|
|
|
+ {
|
|
|
+ isPass = FAIL;
|
|
|
+ PRINTF_FUNC("Transfer Image NG - FTP put upgrade image to fail");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ PRINTF_FUNC("FTP put Image OK");
|
|
|
+ }
|
|
|
+
|
|
|
+ return isPass;
|
|
|
+}
|
|
|
+
|
|
|
+void TriggerDispenserUpgrade(unsigned char index, char *FileName)
|
|
|
+{
|
|
|
+ memset(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[index].FwFileName, 0x00, 128);
|
|
|
+ memcpy(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[index].FwFileName, FileName, strlen(FileName));
|
|
|
+ ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[index].Setting.bits.FirmwareUpdateRequest = true;
|
|
|
+ PRINTF_FUNC("Trigger dispenser %d to update image %s", index + 1, FileName);
|
|
|
+}
|
|
|
+
|
|
|
+BOOL PutImageToAllDispenser(char *SourcePath, char *FileName)
|
|
|
+{
|
|
|
+ int isPass = FAIL;
|
|
|
+ BOOL transferred = FALSE;
|
|
|
+
|
|
|
+ for(int i = 0; i < GENERAL_GUN_QUANTITY; i++)
|
|
|
+ {
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectionInfo[i].Status == _CNS_DispenserMatched)
|
|
|
+ {
|
|
|
+ char DispenserIpAddress[16];
|
|
|
+ memset((char*)DispenserIpAddress, 0x00, 16);
|
|
|
+ sprintf((char*)DispenserIpAddress, "%d.%d.%d.%d",
|
|
|
+ ((ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectionInfo[i].IpAddress >> 0) & 0xFF),
|
|
|
+ ((ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectionInfo[i].IpAddress >> 8) & 0xFF),
|
|
|
+ ((ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectionInfo[i].IpAddress >> 16) & 0xFF),
|
|
|
+ ((ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectionInfo[i].IpAddress >> 24) & 0xFF));
|
|
|
+
|
|
|
+ isPass = PutDispenserImage(DispenserIpAddress, SourcePath);
|
|
|
+ if(isPass == PASS)
|
|
|
+ {
|
|
|
+ TriggerDispenserUpgrade(ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectionInfo[i].DispenserIndex, FileName);
|
|
|
+ }
|
|
|
+ transferred = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return transferred;
|
|
|
+}
|
|
|
+
|
|
|
+BOOL WaitAllDispenserUpgradeCompleted(void)
|
|
|
+{
|
|
|
+ BOOL completed = TRUE;
|
|
|
+
|
|
|
+ gettimeofday(&_DispenserUpgrade_time, NULL);
|
|
|
+ do
|
|
|
+ {
|
|
|
+ completed = TRUE;
|
|
|
+ for(int i = 0; i < GENERAL_GUN_QUANTITY; i++)
|
|
|
+ {
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Setting.bits.FirmwareUpdateRequest ||
|
|
|
+ ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Setting.bits.FirmwareUpdateConfirm)
|
|
|
+ {
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Setting.bits.FirmwareUpdateCompleted)
|
|
|
+ {
|
|
|
+ ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Setting.bits.FirmwareUpdateRequest = false;
|
|
|
+ ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Setting.bits.FirmwareUpdateConfirm = false;
|
|
|
+ ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Setting.bits.FirmwareUpdateCompleted = false;
|
|
|
+ PRINTF_FUNC("Dispenser %d Upgrade Success", i + 1);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ completed = FALSE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(GetTimeoutValue(_DispenserUpgrade_time) / uSEC_VAL >= DISPENSER_UPGRADE_TIME)
|
|
|
+ {
|
|
|
+ PRINTF_FUNC("Wait Upgrade Timeout");
|
|
|
+ completed = FALSE;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(completed == FALSE)
|
|
|
+ {
|
|
|
+ sleep(1);
|
|
|
+ }
|
|
|
+ }while(!completed);
|
|
|
+
|
|
|
+ return completed;
|
|
|
+}
|
|
|
+
|
|
|
+char CheckUpdateProcess()
|
|
|
+{
|
|
|
+ char model[32];
|
|
|
+ bool support = false;
|
|
|
+ bool OneImageOnly = false;
|
|
|
+ int isPass = true;
|
|
|
+ uint8_t retSucc = 0;
|
|
|
+ uint8_t retFail = 0;
|
|
|
+ byte target = 0;
|
|
|
+ char *new_str = NULL;
|
|
|
+ unsigned char *ptr = NULL;
|
|
|
+ int fd = 0;
|
|
|
+ int uartFd = 0;
|
|
|
+ unsigned int Type = 0;
|
|
|
+ long int MaxLen = 48 * 1024 * 1024, ImageLen = 0;
|
|
|
+ DIR *d;
|
|
|
+ struct dirent *dir;
|
|
|
+ char cmdBuf[128];
|
|
|
+
|
|
|
+ d = opendir("/mnt/");
|
|
|
+
|
|
|
+ if(d)
|
|
|
+ {
|
|
|
+ while((dir = readdir(d)) != NULL && !OneImageOnly)
|
|
|
{
|
|
|
- char *new_str;
|
|
|
- new_str = malloc(strlen("/mnt/")+strlen(dir->d_name)+1);
|
|
|
- new_str[0] = '\0';
|
|
|
+ if (strcmp(dir->d_name, ".") == 0 || strcmp(dir->d_name, "..") == 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ new_str = calloc(strlen("/mnt/") + strlen(dir->d_name) + 1, sizeof(char));
|
|
|
strcat(new_str, "/mnt/");
|
|
|
strcat(new_str, dir->d_name);
|
|
|
- int fd = open(new_str, O_RDONLY);
|
|
|
- if (fd < 0)
|
|
|
+ fd = open(new_str, O_RDONLY);
|
|
|
+ if(fd < 0)
|
|
|
{
|
|
|
- return FAIL;
|
|
|
+ free(new_str);
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
- unsigned char *ptr = malloc(MaxLen);
|
|
|
- memset(ptr, 0xFF, MaxLen);
|
|
|
+ DEBUG_INFO_MSG("%s\n", new_str);
|
|
|
+
|
|
|
+ ptr = calloc(MaxLen, sizeof(char));
|
|
|
+ memset(ptr, 0xFF, MaxLen);
|
|
|
|
|
|
ImageLen = read(fd, ptr, MaxLen);
|
|
|
|
|
|
if (ImageLen > 20)
|
|
|
{
|
|
|
- unsigned int Type = (((unsigned int)ptr[16])<<24 | ((unsigned int)ptr[17])<<16 | ((unsigned int)ptr[18])<<8 | ((unsigned int)ptr[19]));
|
|
|
- PRINTF_FUNC("Typed...%x \r\n", Type);
|
|
|
+ support = false;
|
|
|
+ memcpy(model, ptr, 16);
|
|
|
+ PRINTF_FUNC("Model: %s", model);
|
|
|
+ Type = (((unsigned int)ptr[16]) << 24 | ((unsigned int)ptr[17]) << 16 | ((unsigned int)ptr[18]) << 8 | ((unsigned int)ptr[19]));
|
|
|
+ PRINTF_FUNC("Typed...%x", Type);
|
|
|
|
|
|
- switch (Type)
|
|
|
+ if(strcmp(model, (char *)ShmSysConfigAndInfo->SysConfig.ModelName) == EQUAL)
|
|
|
{
|
|
|
- case 0x10000001:
|
|
|
- case 0x10000002:
|
|
|
- case 0x10000003:
|
|
|
- case 0x10000004:
|
|
|
- case 0x10000005:
|
|
|
- {
|
|
|
- if (Upgrade_Flash(Type, new_str, (char *)ShmSysConfigAndInfo->SysConfig.ModelName) == PASS)
|
|
|
- return PASS;
|
|
|
- else
|
|
|
- return FAIL;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 0x10000007:
|
|
|
- case 0x10000008:
|
|
|
- case 0x10000009:
|
|
|
- case 0x1000000A:
|
|
|
- {
|
|
|
- bool isPass = true;
|
|
|
- int CanFd = InitCanBus();
|
|
|
+ switch (Type)
|
|
|
+ {
|
|
|
+ case 0x10000001:
|
|
|
+ case 0x10000002:
|
|
|
+ case 0x10000003:
|
|
|
+ case 0x10000004:
|
|
|
+ case 0x10000005:
|
|
|
+ support = true;
|
|
|
+ _UpgradeNeedReboot = TRUE;
|
|
|
+ isPass = Upgrade_Flash(Type, new_str, (char *)ShmSysConfigAndInfo->SysConfig.ModelName);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 0x10000006:
|
|
|
+ case 0x1000000D:
|
|
|
+ case 0x1000000E:
|
|
|
+ case 0x10000014:
|
|
|
+ support = true;
|
|
|
+ target = 0x00;
|
|
|
+
|
|
|
+ if (Type == 0x10000006)
|
|
|
+ {
|
|
|
+ target = UPGRADE_PRI;
|
|
|
+ }
|
|
|
+ else if (Type == 0x1000000D)
|
|
|
+ {
|
|
|
+ target = UPGRADE_RB;
|
|
|
+ }
|
|
|
+ else if (Type == 0x1000000E)
|
|
|
+ {
|
|
|
+ target = UPGRADE_FAN;
|
|
|
+ }
|
|
|
+ else if (Type == 0x10000014)
|
|
|
+ {
|
|
|
+ target = UPGRADE_LED;
|
|
|
+ }
|
|
|
|
|
|
- if (CanFd > 0)
|
|
|
- {
|
|
|
- for(byte index = 0; index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; index++)
|
|
|
- {
|
|
|
- if (!isPass)
|
|
|
- break;
|
|
|
-
|
|
|
- if (chargingInfo[index]->Type == _Type_CCS_2)
|
|
|
- {
|
|
|
- if (Upgrade_CCS(CanFd, Type, chargingInfo[index]->Evboard_id, new_str, (char *)ShmSysConfigAndInfo->SysConfig.ModelName) == FAIL)
|
|
|
- {
|
|
|
- isPass = false;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- printf("Upgrade CCS open CAN FD fail.\n");
|
|
|
- isPass = false;
|
|
|
- }
|
|
|
+ uartFd = InitComPort(target);
|
|
|
|
|
|
- return isPass;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 0x10000006:
|
|
|
- case 0x1000000D:
|
|
|
- case 0x1000000E:
|
|
|
- case 0x20000002:
|
|
|
- case 0x10000014:
|
|
|
- {
|
|
|
-
|
|
|
- byte target = 0x00;
|
|
|
-
|
|
|
- if (Type == 0x10000006)
|
|
|
- target = UPGRADE_PRI;
|
|
|
- else if (Type == 0x1000000D)
|
|
|
- target = UPGRADE_RB;
|
|
|
- else if (Type == 0x1000000E)
|
|
|
- target = UPGRADE_FAN;
|
|
|
- else if (Type == 0x20000002)
|
|
|
- target = UPGRADE_AC;
|
|
|
- else if (Type == 0x10000014)
|
|
|
- target = UPGRADE_LED;
|
|
|
-
|
|
|
- int fd = InitComPort(target);
|
|
|
-
|
|
|
- if (Upgrade_UART(fd, Type, target, new_str, (char *)ShmSysConfigAndInfo->SysConfig.ModelName) == PASS)
|
|
|
- return PASS;
|
|
|
- else
|
|
|
- return FAIL;
|
|
|
-
|
|
|
- close(fd);
|
|
|
- }
|
|
|
- break;
|
|
|
- case 0x1000000B:
|
|
|
- case 0x1000000C:
|
|
|
- {
|
|
|
-
|
|
|
- bool isPass = true;
|
|
|
- int CanFd = InitCanBus();
|
|
|
-
|
|
|
- if (CanFd > 0)
|
|
|
- {
|
|
|
- for(byte index = 0; index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; index++)
|
|
|
- {
|
|
|
- if (!isPass)
|
|
|
- break;
|
|
|
-
|
|
|
- if ((Type == 0x1000000B && chargingInfo[index]->Type == _Type_Chademo) ||
|
|
|
- (Type == 0x1000000C && chargingInfo[index]->Type == _Type_GB))
|
|
|
- {
|
|
|
- if (Upgrade_CAN(CanFd, Type, chargingInfo[index]->Evboard_id, new_str, (char *)ShmSysConfigAndInfo->SysConfig.ModelName) == PASS)
|
|
|
- return PASS;
|
|
|
- else
|
|
|
- return FAIL;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- PRINTF_FUNC("Upgrad FD fail. \n");
|
|
|
- isPass = false;
|
|
|
- }
|
|
|
-
|
|
|
- return isPass;
|
|
|
- break;
|
|
|
- }
|
|
|
+ if(target == UPGRADE_RB)
|
|
|
+ {
|
|
|
+ isPass = Upgrade_UART(uartFd, Type, UPGRADE_DORC1, new_str, (char *)ShmSysConfigAndInfo->SysConfig.ModelName);
|
|
|
+ if(isPass == PASS)
|
|
|
+ {
|
|
|
+ retSucc++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ retFail++;
|
|
|
+ }
|
|
|
+ PRINTF_FUNC("Upgrade %s", isPass == PASS ? "Success" : "Fail");
|
|
|
+ sleep(3);
|
|
|
+ isPass = Upgrade_UART(uartFd, Type, UPGRADE_DORC2, new_str, (char *)ShmSysConfigAndInfo->SysConfig.ModelName);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isPass = Upgrade_UART(uartFd, Type, target, new_str, (char *)ShmSysConfigAndInfo->SysConfig.ModelName);
|
|
|
+ }
|
|
|
+
|
|
|
+ close(fd);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(support)
|
|
|
+ {
|
|
|
+ if(isPass == PASS)
|
|
|
+ {
|
|
|
+ retSucc++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ retFail++;
|
|
|
+ }
|
|
|
+ PRINTF_FUNC("Upgrade %s", isPass == PASS ? "Success" : "Fail");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(model[0] == 'D' && model[1] == 'D')
|
|
|
+ {
|
|
|
+ OneImageOnly = true;
|
|
|
+ _UpgradeNeedReboot = TRUE;
|
|
|
+ PRINTF_FUNC("Start Put Image To All Dispenser");
|
|
|
+ PutImageToAllDispenser(new_str, dir->d_name);
|
|
|
+ WaitAllDispenserUpgradeCompleted();
|
|
|
+ PRINTF_FUNC("All Dispenser Upgrade Completed");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- free(new_str);
|
|
|
- free(ptr);
|
|
|
+
|
|
|
+ sprintf(cmdBuf, "rm -f %s", new_str);
|
|
|
+ system(cmdBuf);
|
|
|
+
|
|
|
+ free(new_str);
|
|
|
+ free(ptr);
|
|
|
}
|
|
|
}
|
|
|
free(dir);
|
|
|
closedir(d);
|
|
|
- return FAIL;
|
|
|
+
|
|
|
+ if(retFail != 0)
|
|
|
+ {
|
|
|
+ return FAIL;
|
|
|
+ }
|
|
|
+
|
|
|
+ return PASS;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -4333,16 +4460,28 @@ void CheckFwUpdateFunction()
|
|
|
|
|
|
if (ShmSysConfigAndInfo->SysInfo.FirmwareUpdate == YES)
|
|
|
{
|
|
|
- DEBUG_INFO_MSG("ftp : update start. \n");
|
|
|
- KillTask();
|
|
|
+ DEBUG_INFO_MSG("ftp : update start.");
|
|
|
+
|
|
|
+ ChangeLcmByIndex(_LCM_FIX);
|
|
|
+ system("killall Module_PrimaryComm");
|
|
|
+ system("killall Module_InternalComm");
|
|
|
+
|
|
|
if (CheckUpdateProcess() == PASS)
|
|
|
- DEBUG_INFO_MSG("ftp : update complete. \n");
|
|
|
+ DEBUG_INFO_MSG("ftp : update complete.");
|
|
|
else
|
|
|
- DEBUG_INFO_MSG("ftp : update fail. \n");
|
|
|
+ DEBUG_INFO_MSG("ftp : update fail.");
|
|
|
|
|
|
ShmSysConfigAndInfo->SysInfo.FirmwareUpdate = NO;
|
|
|
sleep(5);
|
|
|
- system("reboot -f");
|
|
|
+ if(_UpgradeNeedReboot)
|
|
|
+ {
|
|
|
+ system("reboot -f");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ KillTask();
|
|
|
+ system("/usr/bin/run_evse_restart.sh");
|
|
|
+ }
|
|
|
}
|
|
|
else if(ShmOCPP16Data->MsMsg.bits.UpdateFirmwareReq == YES)
|
|
|
{
|
|
@@ -4354,16 +4493,14 @@ void CheckFwUpdateFunction()
|
|
|
strcpy((char *)ShmOCPP16Data->FirmwareStatusNotification.Status, "");
|
|
|
strcpy((char *)ShmOCPP16Data->FirmwareStatusNotification.Status, "Installing");
|
|
|
ShmOCPP16Data->SpMsg.bits.FirmwareStatusNotificationReq = YES;
|
|
|
- KillTask();
|
|
|
+
|
|
|
+ system("killall Module_PrimaryComm");
|
|
|
+ system("killall Module_InternalComm");
|
|
|
|
|
|
for (byte _index = 0; _index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; _index++)
|
|
|
{
|
|
|
setChargerMode(_index, MODE_UPDATE);
|
|
|
}
|
|
|
- for (byte _index = 0; _index < ShmSysConfigAndInfo->SysConfig.AcConnectorCount; _index++)
|
|
|
- {
|
|
|
- ac_chargingInfo[_index]->SystemStatus = MODE_UPDATE;
|
|
|
- }
|
|
|
|
|
|
if (CheckUpdateProcess() == PASS)
|
|
|
{
|
|
@@ -4379,7 +4516,16 @@ void CheckFwUpdateFunction()
|
|
|
strcpy((char *)ShmOCPP16Data->FirmwareStatusNotification.Status, "Installed");
|
|
|
ShmOCPP16Data->SpMsg.bits.FirmwareStatusNotificationReq = YES;
|
|
|
sleep(5);
|
|
|
- system("reboot -f");
|
|
|
+
|
|
|
+ if(_UpgradeNeedReboot)
|
|
|
+ {
|
|
|
+ system("reboot -f");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ KillTask();
|
|
|
+ system("/usr/bin/run_evse_restart.sh");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -4607,12 +4753,9 @@ void UserPriceHandler(char *UserId, char *UserPrice)
|
|
|
ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].UserPrice = CurrentRate;
|
|
|
ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].AccountBalance = AccountBalance;
|
|
|
|
|
|
- int DispenserIndex = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].ParentDispensetIndex;
|
|
|
-
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[DispenserIndex].AuthorizeStatus == _AuthorizeStatus_Pass &&
|
|
|
- ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].Parameter.bits.AuthorizeRequestType == _AuthorizeSrc_Local)
|
|
|
+ if(chargingInfo[i]->SystemStatus == S_AUTHORIZING)
|
|
|
{
|
|
|
- ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].Parameter.bits.AccountBalanceRequest = true;
|
|
|
+ AnnounceAccountBalance(i, AccountBalance);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -5687,25 +5830,27 @@ void CheckMiscCommandRequirement(void)
|
|
|
{
|
|
|
BOOL NeedAnnouncement = FALSE;
|
|
|
|
|
|
- for(int i = 0; i < CONNECTOR_QUANTITY; i++)
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.FirmwareUpdate != YES)
|
|
|
{
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].Parameter.bits.AvailabilityRequest ||
|
|
|
- ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].Parameter.bits.RemoteStartRequest ||
|
|
|
- ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].Parameter.bits.AccountBalanceRequest)
|
|
|
+ for(int i = 0; i < CONNECTOR_QUANTITY; i++)
|
|
|
{
|
|
|
- NeedAnnouncement = TRUE;
|
|
|
- }
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].Parameter.bits.AvailabilityRequest ||
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].Parameter.bits.RemoteStartRequest ||
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].Parameter.bits.AccountBalanceRequest)
|
|
|
+ {
|
|
|
+ NeedAnnouncement = TRUE;
|
|
|
+ }
|
|
|
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Setting.bits.ConnectorTimeoutConfigRequest ||
|
|
|
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Setting.bits.DefaultPriceConfigRequest ||
|
|
|
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Setting.bits.CurrencyConfigRequest ||
|
|
|
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Setting.bits.HardwareRebootRequest ||
|
|
|
- ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Setting.bits.SoftwareResetRequest)
|
|
|
- {
|
|
|
- NeedAnnouncement = TRUE;
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Setting.bits.ConnectorTimeoutConfigRequest ||
|
|
|
+ ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Setting.bits.DefaultPriceConfigRequest ||
|
|
|
+ ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Setting.bits.CurrencyConfigRequest ||
|
|
|
+ ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Setting.bits.HardwareRebootRequest ||
|
|
|
+ ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].Setting.bits.SoftwareResetRequest)
|
|
|
+ {
|
|
|
+ NeedAnnouncement = TRUE;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
ShmSysConfigAndInfo->SysInfo.CabinetSetting.bits.MiscNeedAnnouncement = NeedAnnouncement;
|
|
|
}
|
|
|
|
|
@@ -6008,6 +6153,12 @@ int main(void)
|
|
|
|
|
|
ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].Parameter.bits.StartWaitPlug = false;
|
|
|
ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].Parameter.bits.NeedCleanAuthorizeInfo = false;
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].Parameter.bits.OutputLimitEnable = false;
|
|
|
+
|
|
|
+ chargingInfo[gun_index]->EvBatterytargetVoltage = 0;
|
|
|
+ chargingInfo[gun_index]->EvBatterytargetCurrent = 0;
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].RemoteTargetVoltage = 0;
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].RemoteTargetCurrent = 0;
|
|
|
}
|
|
|
else if (chargingInfo[gun_index]->SystemStatus == S_RESERVATION &&
|
|
|
isModeChange(gun_index))
|
|
@@ -6253,6 +6404,16 @@ int main(void)
|
|
|
ShmSysConfigAndInfo->SysInfo.OrderCharging = NO_DEFINE;
|
|
|
StopSystemTimeoutDet();
|
|
|
ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].Parameter.bits.PsuReleasable = false;
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].MaxTotalChargingCurrent = ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent * 10;
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].MaxTotalChargingPower = ShmSysConfigAndInfo->SysConfig.MaxChargingPower * 10;
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].MaxOutputEnergy = ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy;
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].MaxOutputDuration = ShmSysConfigAndInfo->SysConfig.MaxChargingDuration;
|
|
|
+
|
|
|
+ PRINTF_FUNC("Max Total Current %d, Max Total Power %d, Total Energy %d, Total Duration %d",
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].MaxTotalChargingCurrent,
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].MaxTotalChargingPower,
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].MaxOutputEnergy,
|
|
|
+ ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].MaxOutputDuration);
|
|
|
}
|
|
|
|
|
|
bool isRessign = false;
|