Эх сурвалжийг харах

2022-07-15 / Simon Xue

Action:
1. [Mod] Keep PowerConsumption when gun status from complete to idle.
2. [Add] ReadCmdline control backlight

Files
As the following commit history files

Imager Version: V2.13.XX.XXXX.XX
Simon Xue 2 жил өмнө
parent
commit
25b93dc79e

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

@@ -501,6 +501,7 @@ void CreateRfidFork(void)
                 if (checkRemoteStart(gunIndex) && ShmDcCommonData->AuthPass_flag[gunIndex] &&
                     !ShmDcCommonData->PayPass_flag[gunIndex]) {
                     RemoteStartCancelPreAuth(gunIndex);
+                    ShmDcCommonData->AuthPass_flag[gunIndex] = FALSE;
                 }
 
                 if (ShmDcCommonData->StopCharge[gunIndex] == TRUE && pDcChargingInfo->Replug_flag == TRUE) {
@@ -536,6 +537,8 @@ void CreateRfidFork(void)
                         // Remote Start of AutoStart ByPass Credit Card Reader
                         if (ShmDcCommonData->DebugFlag == TRUE || checkRemoteStart(gunIndex) ||
                             ShmDcCommonData->is_AutoStart[gunIndex]) {
+                            ShmDcCommonData->PayPass_flag[gunIndex] = TRUE;
+                            pSysInfo->SystemPage = _PAGE_COMPLETE;
                             continue;
                         }
                         // 實際扣款

+ 18 - 15
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.13.00.0000.00"; // Phihong version
-char* DebugVersion = "V2.13.00";      // Software debug version
+char* DebugVersion = "V2.13.01";      // Software debug version
 //sqlite3 *localDb;
 bool isDb_ready;
 
@@ -3920,7 +3920,7 @@ void ResetIdleData(uint8_t gunIndex)
     pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(gunIndex);
     ShmOCPP16Data = (struct OCPP16Data *)GetShmOCPP16Data();
     ShmSelectGunInfo = (SelectGunInfo *)GetShmSelectGunInfo();
-
+    float powerconsumption = ShmDcCommonData->pGunInfo[gunIndex].PowerConsumption;
     pDcChargingInfo->PresentChargedDuration = 0;
     pDcChargingInfo->RemainChargingDuration = 0;
     pDcChargingInfo->PresentChargingVoltage = 0;//DS60-120 add
@@ -3937,7 +3937,7 @@ void ResetIdleData(uint8_t gunIndex)
     memset(&ShmSelectGunInfo->PricesInfo[gunIndex], 0, sizeof(PricesInfo));
     memset(&ShmDcCommonData->TransactionInfo[gunIndex], 0, sizeof(RecordTransactionInfo));
     memset(&ShmDcCommonData->pGunInfo[gunIndex], 0, sizeof(GunInfo));
-    DB_Get_PowerConsumption(gunIndex);
+    ShmDcCommonData->pGunInfo[gunIndex].PowerConsumption = powerconsumption;
     ShmDcCommonData->finalcost_flag[gunIndex] = FALSE;
     ShmDcCommonData->AuthPass_flag[gunIndex] = FALSE;
     ShmDcCommonData->PayPass_flag[gunIndex] = FALSE;
@@ -4255,11 +4255,8 @@ int main(void)
         isDb_ready = true;
         for (int _index = 0; _index < pSysConfig->TotalConnectorCount; _index++) {
             pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(_index);
-
             pDcChargingInfo->IsAvailable = DB_Get_Operactive(_index);
-            if (!DB_Get_PowerConsumption(_index)) {
-                DB_Insert_PowerConsumption(_index, 0);
-            }
+
         }
         DB_Reboot_Record();
     }
@@ -4268,14 +4265,22 @@ int main(void)
         log_info("Power DB_Open fail. ");
         isDb_ready = false;
     } else {
+        int _retry = 0;
         isDb_ready = true;
         for (int _index = 0; _index < pSysConfig->TotalConnectorCount; _index++) {
             pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(_index);
-
-            if (!DB_Get_PowerConsumption(_index)) {
-                DB_Insert_PowerConsumption(_index, 0);
-            }
-        }
+            while (_retry < 3) {
+                if (DB_Get_PowerConsumption(_index)) {
+                    break;
+                } else {
+                    sleep(1);
+                    _retry++;
+                    if (_retry == 3) {
+                        DB_Insert_PowerConsumption(_index, 0);
+                    }
+                }
+            } // while
+        } // for
     }
     log_info("===== Create DB End ===== ");
 
@@ -4505,9 +4510,7 @@ int main(void)
                 }
                 if (isDetectPlugin(gunIndex)) {
                     StartGunInfoTimeoutDet(gunIndex, Timeout_WaitPlug);
-                    if (pSysInfo->CurGunSelected == gunIndex) {
-                        pSysInfo->SystemPage = _PAGE_PLUGIN;
-                    }
+
                     // 卡號驗證成功後,等待充電槍插入充電車
                     if (pDcChargingInfo->RemoteStartFlag == YES) {
                         if (pDcChargingInfo->ConnectorPlugIn == YES &&

+ 1 - 0
EVSE/Projects/DD360Tcci/Apps/Config.h

@@ -581,6 +581,7 @@ typedef struct StDcCommonInfo {
     uint8_t TaiwanEast;
     uint8_t lcmtest;
     char DebugVersion[32];
+    uint8_t BackLight;
 } DcCommonInfo;
 
 #endif /* CONFIG_H_ */

+ 23 - 17
EVSE/Projects/DD360Tcci/Apps/ModuleLcmCtrl/Module_LcmControl.c

@@ -235,6 +235,9 @@ void ReadMsgFromLcm(uint8_t* msg, uint8_t readLen)
                 strcpy((char*)pSysInfo->LcmHwRev, moduleName);
             if (key == 0x0014)
                 _currentPage = *(msg + 8);
+            if (key == 0x0031) {
+                log_info("Get LCM Backlight change to 0x%x", *(msg + 8));
+            }
             if (key >= _Touch_IDLE && key <= _Touch_Pay_LinePay) {
 
                 _btn_press_id = key;
@@ -728,26 +731,22 @@ void ChangeToOtherPage(short newPage)
     ReadMsgFromLcm(msg, ARRAY_SIZE(msg));
 }
 
-void ChangeBackLight(bool islight)
+void ChangeBackLight(uint8_t value)
 {
-    uint8_t value = 0x01;
+    //uint8_t value = 0x01;
     uint8_t msg[9];
     memset(msg, 0x00, sizeof(msg));
 
-    // 0x00 ~ 0x40
-    if (islight)
-    {
-        value = 0x20;
-    }
     uint8_t cmd[7];
     memset(cmd, 0x00, sizeof(cmd));
 
     cmd[0] = CMD_TITLE_1;
     cmd[1] = CMD_TITLE_2;
-    cmd[2] = 0x03;
-    cmd[3] = CMD_READ;
-    cmd[4] = CMD_BACKLIGHT;
-    cmd[5] = value;
+    cmd[2] = 0x05;
+    cmd[3] = CMD_MULTI_WRITE;
+    cmd[4] = 0x00;
+    cmd[5] = 0x82;
+    cmd[6] = value;
 
     WriteCmdToLcm(cmd, ARRAY_SIZE(cmd));
     usleep(10000);
@@ -1322,9 +1321,11 @@ void ProcessPageInfo()
     for (uint8_t i = 0; i < pSysConfig->TotalConnectorCount; i++) {
 
         if (pSysInfo->CurGunSelected == i) {
-            pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(pSysInfo->CurGunSelected);
-            if (pDcChargingInfo->SystemStatus == S_AUTHORIZING) {
+            pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(i);
+
+            if (pDcChargingInfo->SystemStatus == S_IDLE) {
                 _everyPageRollChange = 0;
+                _Text_Running_Count = 1;
             }
             switch (pSysInfo->SystemPage) {
             case _PAGE_IDLE:
@@ -1354,7 +1355,7 @@ void ProcessPageInfo()
 
 		        ChangeChargingRateValue((int)ShmDcCommonData->ChargingRate);
                 ShowAuthorizeCountDown();
-            	_Text_Running_Count = 1;
+
                 break;
             case _PAGE_SENSING:
                 if (ShmDcCommonData->TradeCancel == TRUE) {
@@ -1371,8 +1372,6 @@ void ProcessPageInfo()
                 ShowLineRegisterCountDown();
                 break;
             case _PAGE_PRECHARGE:
-            	//ChangeDisplay2Value(_Icon_Precharge,1);
-
             	RefreshProgressAnimation();
             	if (_everyPageRollChange == 0) {
             		ChangeDisplay2Value(_Icon_Precharge,_Text_Running_Count);
@@ -1765,7 +1764,9 @@ int main(void)
     _port = CreateCommunicationLcmPort();
     uint8_t changeWarningPriority = 0;
     uint8_t curWarningCount = 255;
-    ChangeBackLight(true);
+    uint8_t light = 0x64;
+    ShmDcCommonData->BackLight = light;
+    ChangeBackLight(light);
     _totalCount = pSysConfig->TotalConnectorCount;
     _everyPageRollChange = 0;
     //Initialization();
@@ -1794,6 +1795,11 @@ int main(void)
         } else {
             UpdateLcmFunction(ShmDcCommonData,_port);
 
+            if (ShmDcCommonData->BackLight != light) {
+                ChangeBackLight(ShmDcCommonData->BackLight);
+                light = ShmDcCommonData->BackLight;
+                log_info("Set Backlight:%d",light);
+            }
             /*
             // Warning 處理
             if (curWarningCount != pSysWarning->WarningCount) {

+ 11 - 0
EVSE/Projects/DD360Tcci/Apps/ReadCmdline.c

@@ -541,6 +541,14 @@ void writeChillerStatus(char* v1)
     else
         printf("Please open Debug mode\n");
 }
+void writeBackLight(char* v1)
+{
+    uint8_t light = atoi(v1);
+    if (light >= 0 && light <= 0x64) {
+        ShmDcCommonData->BackLight = light;
+    } else
+        printf("Error para.");
+}
 void writeTccdev()
 {
     ShmDcCommonData->tccdev = !ShmDcCommonData->tccdev;
@@ -1324,6 +1332,7 @@ int main(void)
                      "       tccdev                            : print TCC dev QR Code\n"
                      "       lcmtest                           : Only For LCM Demo\n"
                      "       billtest                          : Rededuct Transcation id amount\n"
+                     "       backlight                         : Change Lcm Backlight\n"
                      "\r\n";
 
     if (CreateAllCsuShareMemory() == FAIL) {
@@ -1521,6 +1530,8 @@ int main(void)
                 continue;
             }
             setbilltest(newString[1], newString[2]);
+        } else if (strcmp(newString[0], "backlight") == 0) { //測試槍頭和水冷機溫度
+            writeBackLight(newString[1]);
         } else {
             printf("%s\n", usageMsg);
         }

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


BIN
EVSE/Projects/DD360Tcci/output/FactoryConfig


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