Kaynağa Gözat

2022-03-02 / Wendell

Actions
1. [mod] improve log logic
2. [mod] improve IsStandbyEnable function
3. [mod] set Authorize pass when SystemStatus is S_AUTHORIZING and has the same IdTag
4. [fix] clean ocpp error code before set SystemStatus to idle
5. [fix] UserId length is over 20
6. modify subVersion to 03

Files
1. As follow commit history

Image version : V1.10.XX.XXXX.XX
Wendell 3 yıl önce
ebeveyn
işleme
979ac3f710

+ 21 - 3
EVSE/Projects/DO360/Apps/Module_Authorize.c

@@ -688,8 +688,7 @@ int main(void)
                     {
                         if(strcmp((char *)ShmSysConfigAndInfo->SysConfig.UserId, AUTO_START_CHARGING) == EQUAL)
                         {
-                            sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%s%s",
-                                ShmSysConfigAndInfo->SysConfig.ModelName, ShmSysConfigAndInfo->SysConfig.SerialNumber);
+                            sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%s", ShmSysConfigAndInfo->SysConfig.SerialNumber);
                         }
                         memcpy(chargingInfo[connector]->StartUserId, ShmSysConfigAndInfo->SysConfig.UserId, 32);
 
@@ -717,9 +716,28 @@ int main(void)
                             Set_Connector_MiscCommand(connector, MISC_CONN_REMOTE_START);
                         }
                     }
+                    else if(chargingInfo[connector]->SystemStatus == S_AUTHORIZING && _authResult == _AuthResult_Valid)
+                    {
+                        if(strcmp((char *)chargingInfo[connector]->StartUserId, (char *)ShmSysConfigAndInfo->SysConfig.UserId) == EQUAL)
+                        {
+                            if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[connector].AuthInfo.AuthType == _AuthType_RFID)
+                            {
+                                AUTH_INFO("*********** Gun %d RFID Authorize Already OK ***********", connector + 1);
+                            }
+                            if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[connector].AuthInfo.AuthType == _AuthType_RemoteStart)
+                            {
+                                AUTH_INFO("*********** Gun %d RemoteAuthorize Already OK ***********", connector + 1);
+                            }
+                        }
+                        else
+                        {
+                            _authResult = _AuthResult_Invalid;
+                        }
+                    }
                     else
                     {
-                        AUTH_INFO("*********** Gun %d Authorize OK But Status Fail (%d) ***********", connector + 1, chargingInfo[connector]->SystemStatus);
+                        AUTH_INFO("*********** Gun %d Authorize %s Status Fail (%d) ***********",
+                            connector + 1, _authResult == _AuthResult_Valid ? "OK But" : "NG Or", chargingInfo[connector]->SystemStatus);
                         _authResult = _AuthResult_Invalid;
                     }
                     ShmSysConfigAndInfo->SysInfo.ConnectorInfo[connector].AuthInfo.AuthResult = _authResult;

+ 24 - 16
EVSE/Projects/DO360/Apps/main.c

@@ -384,7 +384,7 @@ bool isModelNameMatch = true;
 //int rfidFd = -1;
 //char* rfidPortName = "/dev/ttyS2";
 char* fwVersion = "V1.10.00.0000.00";
-char* subVersion = "02";
+char* subVersion = "03";
 
 sqlite3 *localDb;
 bool isDb_ready;
@@ -6403,6 +6403,19 @@ void TimeOffsetHandler(void)
 
         ShmChargerInfo->CabinetMiscValue.TimeOffset = offset;
 
+#if 0
+        time_t timep;
+        struct tm *tm;
+        time(&timep);
+        tm = localtime(&timep);
+        LOG_INFO("   NowTime: %d/%02d/%02d %02d:%02d:%02d",
+            tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
+        timep += (offset * 60);
+        tm = localtime(&timep);
+        LOG_INFO("OffsetTime: %d/%02d/%02d %02d:%02d:%02d",
+            tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
+#endif
+
         for(int i = 0; i < CONNECTOR_QUANTITY; i++)
         {
             if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].ConnectorQuantity > 0)
@@ -7571,25 +7584,19 @@ bool IsStandbyEnable(void)
 
     if(ShmChargerInfo->Control.CustomerCode == _CUSTOMER_CODE_TCC)
     {
-        time_t t = time(NULL);
-        struct tm *now = localtime(&t);
+        time_t timep;
+        struct tm *tm;
+        time(&timep);
 
-        int timeHour = now->tm_hour + (ShmChargerInfo->CabinetMiscValue.TimeOffset / 60);
-        if(timeHour >= 24)
-        {
-            timeHour -= 24;
-        }
-        else if(timeHour < 0)
-        {
-            timeHour += 24;
-        }
+        timep += (ShmChargerInfo->CabinetMiscValue.TimeOffset * 60);
+        tm = localtime(&timep);
 
-        if(timeHour >= 0 && timeHour < 8)
+        if(tm->tm_hour >= 0 && tm->tm_hour < 8)
         {
             if(!_isStandbyEnable)
             {
                 LOG_INFO("[TCC]Customer Enable Standby Function This Time[%02d:%02d:%02d], Offset[%d]",
-                    now->tm_hour, now->tm_min, now->tm_sec, ShmChargerInfo->CabinetMiscValue.TimeOffset);
+                    tm->tm_hour, tm->tm_min, tm->tm_sec, ShmChargerInfo->CabinetMiscValue.TimeOffset);
             }
             _isStandbyEnable = true;
             result = true;
@@ -7599,7 +7606,7 @@ bool IsStandbyEnable(void)
             if(_isStandbyEnable)
             {
                 LOG_INFO("[TCC]Customer Disable Standby Function This Time[%02d:%02d:%02d], Offset[%d]",
-                    now->tm_hour, now->tm_min, now->tm_sec, ShmChargerInfo->CabinetMiscValue.TimeOffset);
+                    tm->tm_hour, tm->tm_min, tm->tm_sec, ShmChargerInfo->CabinetMiscValue.TimeOffset);
             }
             _isStandbyEnable = false;
             result = false;
@@ -8375,7 +8382,7 @@ void ChkConnectorAction(void)
         if(ShmChargerInfo->ConnectorActReq[i].Flag.bits.ChargingCancel)
         {
             Clean_Ocpp_TcciSerialNo(i);
-            LOG_INFO("Gun %d Charging Canceled");
+            LOG_INFO("Gun %d Charging Canceled", i + 1);
             ShmChargerInfo->ConnectorActReq[i].Flag.bits.ChargingCancel = false;
         }
     }
@@ -9377,6 +9384,7 @@ int main(void)
                         if(IsAvailableBackToIdle(gun_index) == YES &&
                             ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun_index].Parameter.bits.PsuReleasable)
                         {
+                            ReleaseAlarmCode(gun_index);
                             setChargerMode(gun_index, MODE_IDLE);
                         }
                     }

BIN
EVSE/Projects/DO360/Images/FactoryDefaultConfig.bin


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