Sfoglia il codice sorgente

2022-07-07 / Simon Xue

Simon Xue 2 anni fa
parent
commit
dfd89a478a

+ 5 - 3
EVSE/Projects/DD360Tcci/Apps/CSU/RFID.c

@@ -509,8 +509,10 @@ void CreateRfidFork(void)
                     if (ShmDcCommonData->DebugFlag == TRUE ||
                         ShmDcCommonData->is_RemoteStart[gunIndex] == TRUE ||
                         ShmDcCommonData->is_AutoStart[gunIndex] == TRUE) {
-                        pSysInfo->SystemPage = _PAGE_PLUGOUT;
+                        if (pSysInfo->CurGunSelected == gunIndex)
+                            pSysInfo->SystemPage = _PAGE_PLUGOUT;
                         ShmDcCommonData->PayPass_flag[gunIndex] = TRUE;
+                        ShmDcCommonData->StopCharge[gunIndex] = FALSE;
                         continue;
                     }
                     ShmDcCommonData->StopCharge[gunIndex] = FALSE;
@@ -610,7 +612,7 @@ void CreateRfidFork(void)
             }
 
             if ((is_idle == TRUE &&
-                (pSysInfo->SystemPage == _PAGE_IDLE || pSysInfo->SystemPage == _PAGE_SELECT_GUN) &&
+                pSysInfo->SystemPage == _PAGE_IDLE  &&
                 ShmDcCommonData->RoutineReduct == FALSE) || ShmDcCommonData->Exe_ReDeduct) {
 
                 ReDeductProcess(fd);
@@ -620,7 +622,7 @@ void CreateRfidFork(void)
             }
 
             // 每日晚上11點30分結帳
-            if (is_idle == TRUE && (pSysInfo->SystemPage == _PAGE_IDLE || pSysInfo->SystemPage == _PAGE_SELECT_GUN) &&
+            if (is_idle == TRUE && pSysInfo->SystemPage == _PAGE_IDLE  &&
                 ((tm->tm_hour == 15 && tm->tm_min > 30  && ShmDcCommonData->RoutineSettlement == FALSE) ||
                     ShmDcCommonData->UnionSettlement)) {
                 StopSystemTimeoutDet();

+ 2 - 2
EVSE/Projects/DD360Tcci/Apps/CSU/main.c

@@ -83,7 +83,7 @@ uint8_t bd1_1_status = 0;
 uint8_t bd1_2_status = 0;
 
 char *fwVersion = "V2.12.00.0000.00"; // Phihong version
-char* DebugVersion = "v2.12.01";      // Software debug version
+char* DebugVersion = "V2.12.04";      // Software debug version
 //sqlite3 *localDb;
 bool isDb_ready;
 
@@ -4492,8 +4492,8 @@ int main(void)
                     break;
                 }
                 if (pDcChargingInfo->SystemStatus == S_FAULT) {
-                    systemPageRestoreInit();
                     setChargerMode(gunIndex, MODE_IDLE);
+                    systemPageRestoreInit();
                 }
 
                 break;

+ 5 - 5
EVSE/Projects/DD360Tcci/Apps/DataBase/DataBase.c

@@ -67,7 +67,7 @@ int DB_Open(void)
         log_info( "Can't open database: %s", sqlite3_errmsg(localDb));
         sqlite3_close(localDb);
     } else {
-        log_info( "Local charging record database open successfully.");
+        //log_info( "Local charging record database open successfully.");
 
         if (sqlite3_exec(localDb, createRecordSql, 0, 0, &errMsg) != SQLITE_OK) {
             result = FAIL;
@@ -168,14 +168,14 @@ int DB_Update_Operactive(uint8_t gunIndex, uint8_t IsAvailable)
         log_info( "Can't open database: %s", sqlite3_errmsg(localDb));
         sqlite3_close(localDb);
     } else {
-        log_info( "Local charging record database open successfully (%d).", IsAvailable);
+        //log_info( "Local charging record database open successfully (%d).", IsAvailable);
 
         //sprintf(sqlStr, "insert or replace into config (IsAvailable, connector, val) values('IsAvailable', %d, %d);", gunIndex, IsAvailable);
         sprintf(sqlStr,
                 "insert or replace into config (item, connector, val) values('IsAvailable', %d, %d);",
                 gunIndex,
                 IsAvailable); //DS60-120 add
-        log_info("sqlStr= %s", sqlStr);
+        //log_info("sqlStr= %s", sqlStr);
         if (sqlite3_exec(localDb, sqlStr, 0, 0, &errMsg) != SQLITE_OK) {
             result = FAIL;
             log_info( "update config error message: %s", errMsg);
@@ -239,7 +239,7 @@ int DB_Reboot_Record(void)
         log_info( "Can't open database: %s", sqlite3_errmsg(localDb));
         sqlite3_close(localDb);
     } else {
-        log_info( "Local charging record database open successfully.");
+        //log_info( "Local charging record database open successfully.");
         if (sqlite3_exec(localDb, insertSql, 0, 0, &errMsg) != SQLITE_OK) {
             result = FAIL;
             log_info( "Insert reboot record error message: %s", errMsg);
@@ -899,7 +899,7 @@ int DB_Get_PowerConsumption(uint8_t gunIndex)
         log_info("Can't open database: %s", sqlite3_errmsg(powerDb));
         sqlite3_close(powerDb);
     } else {
-        log_info("Local config query database open successfully.");
+        //log_info("Local config query database open successfully.");
         sqlite3_get_table(powerDb, sqlStr, &rs, &rows, &cols, &errMsg);
         if (rows > 0) {
             for (int idxRow = 1; idxRow <= rows; idxRow++) {

+ 4 - 4
EVSE/Projects/DD360Tcci/Apps/Log/log.h

@@ -2,11 +2,11 @@
 #define _LOG_H_
 
 //------------------------------------------------------------------------------
-#define log_info(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
-#define log_warn(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
-#define log_error(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define log_info(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
+#define log_warn(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
+#define log_error(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
 
-#define event_info(format, args...) StoreEventLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args) //DS60-120 add
+#define event_info(format, args...) StoreEventLogMsg("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args) //DS60-120 add
 //------------------------------------------------------------------------------
 int StoreLogMsg(const char *fmt, ...);
 int StoreEventLogMsg(const char *fmt, ...);

+ 2 - 2
EVSE/Projects/DD360Tcci/Apps/ModuleDoComm/DoComm.c

@@ -1417,13 +1417,13 @@ static int responsePackeHandle(int fd, uint8_t *pResult, uint8_t plugNum, uint8_
         ShmDcCommonData->Location = atoi(_stationInfo.StationName);
 
         CheckTaiwanEastWest(ShmDcCommonData->Location);
-        /*
+        
         log_info("Station Name: %s, ID: %d, Weather: %d, Temperature: %.1f",
                 _stationInfo.StationName,
                 _stationInfo.StationID,
                 _stationInfo.WeatherID,
                 _stationInfo.Temperature);
-        */
+        
         break;
 
     case REG_DEDUCT_INFO:

+ 3 - 3
EVSE/Projects/DD360Tcci/Apps/ModuleInternalComm/Module_InternalComm.h

@@ -85,9 +85,9 @@
 #define AC_ROTARY_SWITCH_FAULT                  (131072)
 #define AC_RELAY_DRIVE_FAULT                    (262144)
 
-#define log_info(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
-#define log_warn(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
-#define log_error(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define log_info(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
+#define log_warn(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
+#define log_error(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
 
 //------------------------------------------------------------------------------
 

+ 3 - 1
EVSE/Projects/DD360Tcci/Apps/ModuleLcmCtrl/Module_LcmControl.c

@@ -1322,7 +1322,9 @@ void ProcessPageInfo()
 
         if (pSysInfo->CurGunSelected == i) {
             pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(pSysInfo->CurGunSelected);
-
+            if (pDcChargingInfo->SystemStatus == S_AUTHORIZING) {
+                _everyPageRollChange = 0;
+            }
             switch (pSysInfo->SystemPage) {
             case _PAGE_IDLE:
                 ShowSelectGun();

+ 0 - 2
EVSE/Projects/DD360Tcci/Apps/ModulePrimary/Module_PrimaryComm.c

@@ -272,8 +272,6 @@ static void checkChillerStatus(Gpio_out *gpio)
 
         }
     }
-    if (ShmDcCommonData->DebugFlag == YES) 
-        _chillerNeedOn = ShmDcCommonData->chillerCtrl;
 
     if(_chiller.ChillerSwitch != _chillerNeedOn)
     {

+ 20 - 2
EVSE/Projects/DD360Tcci/Apps/ModuleUpdateFW/Module_UpdateFW.c

@@ -225,6 +225,14 @@ bool CreateBufferForLcmFile(char *file)
 
 	return result;
 }
+
+unsigned long long getAvailableMemory()
+{
+    long pages = sysconf(_SC_AVPHYS_PAGES);
+    long page_size = sysconf(_SC_PAGE_SIZE);
+    return pages * page_size;
+}
+
 static int CheckUpdateProcess(void)
 {
     //bool isPass = true;
@@ -246,6 +254,13 @@ static int CheckUpdateProcess(void)
     struct ChargingInfoData *pDcChargingInfo = NULL;
     
     pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
+
+    if (getAvailableMemory() < (200 * 1024 * 1024))
+    {
+        log_info("Available memory (%.2f Bytes) less than 200 MBytes, free cache first.\n", getAvailableMemory() / (1024 * 1024.0));
+        system("echo 3 > /proc/sys/vm/drop_caches");
+    }
+
     d = opendir("/mnt/");
     if (d) {
         log_info("Open /mnt success");
@@ -284,7 +299,7 @@ static int CheckUpdateProcess(void)
                         ((unsigned int)ptr[18]) << 8  |
                         ((unsigned int)ptr[19]));
                 log_info("Typed...%x ", Type);
-
+                free(ptr);
                 switch (Type) {
                 case 0x10000001:
                 case 0x10000002:
@@ -456,9 +471,12 @@ static int CheckUpdateProcess(void)
                     }
                     break;
                 }
+            } else { 
+                free(ptr);
             }
+
             free(new_str);
-            free(ptr);
+
         }
     }
     free(dir);

BIN
EVSE/Projects/DD360Tcci/Images/ramdisk.gz


BIN
EVSE/Projects/DD360Tcci/output/Module_ChkSysTask


BIN
EVSE/Projects/DD360Tcci/output/Module_DoComm


BIN
EVSE/Projects/DD360Tcci/output/Module_EvComm


BIN
EVSE/Projects/DD360Tcci/output/Module_EventLogging


BIN
EVSE/Projects/DD360Tcci/output/Module_InternalComm


BIN
EVSE/Projects/DD360Tcci/output/Module_LcmControl


BIN
EVSE/Projects/DD360Tcci/output/Module_PrimaryComm


BIN
EVSE/Projects/DD360Tcci/output/Module_UpdateFW


BIN
EVSE/Projects/DD360Tcci/output/ReadCmdline


BIN
EVSE/Projects/DD360Tcci/output/main


BIN
EVSE/rootfs/root/Module_Payment_Enegate