Browse Source

2021.04.09 / Jerry add

Actions:
1. merge DD360ComBox/Apps project to DD360Audi and DD360 project.

Files:
1. As follow as commit history.
Jerry_Wang 4 years ago
parent
commit
38ff6cf602
30 changed files with 1032 additions and 1453 deletions
  1. 0 516
      EVSE/Modularization/Module_RatingCurrent.c
  2. 0 298
      EVSE/Modularization/Module_RatingCurrent.h
  3. 1 1
      EVSE/Projects/DD360/Apps/FactoryConfig.c
  4. 1 1
      EVSE/Projects/DD360/Apps/Module_InternalComm.c
  5. 2 2
      EVSE/Projects/DD360/Apps/Module_LcmControl.c
  6. 3 3
      EVSE/Projects/DD360/Apps/Module_PrimaryComm.c
  7. 158 34
      EVSE/Projects/DD360/Apps/ReMain.c
  8. 12 9
      EVSE/Projects/DD360/Apps/ReModule_EvComm.c
  9. 188 176
      EVSE/Projects/DD360/Apps/ReModule_InternalComm.c
  10. 2 2
      EVSE/Projects/DD360/Apps/ReModule_LcmControl.c
  11. 147 90
      EVSE/Projects/DD360/Apps/ReModule_PrimaryComm.c
  12. BIN
      EVSE/Projects/DD360/Apps/UnsafetyOutputTask
  13. 1 1
      EVSE/Projects/DD360/Apps/internalComm.c
  14. 1 1
      EVSE/Projects/DD360Audi/Apps/FactoryConfig.c
  15. 1 1
      EVSE/Projects/DD360Audi/Apps/Module_InternalComm.c
  16. 2 2
      EVSE/Projects/DD360Audi/Apps/Module_LcmControl.c
  17. 3 3
      EVSE/Projects/DD360Audi/Apps/Module_PrimaryComm.c
  18. 158 34
      EVSE/Projects/DD360Audi/Apps/ReMain.c
  19. 12 9
      EVSE/Projects/DD360Audi/Apps/ReModule_EvComm.c
  20. 188 176
      EVSE/Projects/DD360Audi/Apps/ReModule_InternalComm.c
  21. 2 2
      EVSE/Projects/DD360Audi/Apps/ReModule_LcmControl.c
  22. 147 90
      EVSE/Projects/DD360Audi/Apps/ReModule_PrimaryComm.c
  23. 1 1
      EVSE/Projects/DD360Audi/Apps/internalComm.c
  24. BIN
      EVSE/Projects/DD360Audi/Images/ramdisk.gz
  25. BIN
      EVSE/Projects/DD360Audi/output/FactoryConfig
  26. BIN
      EVSE/Projects/DD360Audi/output/Module_EvComm
  27. BIN
      EVSE/Projects/DD360Audi/output/Module_InternalComm
  28. BIN
      EVSE/Projects/DD360Audi/output/Module_PrimaryComm
  29. BIN
      EVSE/Projects/DD360Audi/output/main
  30. 2 1
      EVSE/Projects/DD360ComBox/Apps/ReModule_EvComm.c

+ 0 - 516
EVSE/Modularization/Module_RatingCurrent.c

@@ -1,516 +0,0 @@
-/*
- *  Module_RatingCurrent.c
- *
- *  Created on: 2021-03-15
- *  Update:
- *  Author: Jerry Wang
- *  Version: V0.01
- *
- * History
- * 1. Create Parsing Rated Current Parameter, reference model name 7, 8, 9 field gun type,
- *    GunRateCurInfo arrays 0 and 1 represent DC guns of 7 and 9 fields, and array 2 represents AC guns of 8 fields.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include <stdarg.h>
-#include <time.h>
-
-#include <sys/timeb.h>
-
-#include "Module_RatingCurrent.h"
-
-//------------------------------------------------------------------------------
-#define PASS                                    (1)
-#define FAIL                                    (-1)
-
-#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)
-
-//------------------------------------------------------------------------------
-static SymStruct modelTable[] = {
-    { "AC", MODEL_AC },
-    { "AW", MODEL_AW },
-    { "AP", MODEL_AP },
-    { "DW", MODEL_DW },
-    { "DS", MODEL_DS },
-    { "DM", MODEL_DM },
-    { "DR", MODEL_DR },
-    //{ "DM", MODEL_DM },
-    { "DD", MODEL_DD },
-    { "DO", MODEL_DO },
-};
-
-static SymStruct regulationTable[] = {
-    {"E", REG_CE},
-    {"U", REG_UL},
-    {"G", REG_GB},
-    {"C", REG_CNS},
-    {"J", REG_JARI},
-    {"T", REG_TR25},
-    {"K", REG_KC},
-    {"B", REG_B},
-    {"Z", REG_Z},
-    {"M", REG_M},
-    {"P", REG_P},
-    {"I", REG_I},
-    {"F", REG_F},
-    {"L", REG_L},
-};
-
-static SymStruct powerTable[] = {
-    {"30", POWER_30W},
-    {"60", POWER_60W},
-    {"90", POWER_90W},
-    {"12", POWER_120W},
-    {"15", POWER_150W},
-    {"18", POWER_180W},
-    {"24", POWER_240W},
-    {"36", POWER_360W},
-    {"48", POWER_480W},
-    {"72", POWER_720W},
-};
-
-static SymStruct gunTypeTable[] = {
-    {"0", GUN_TYPE_0},
-    {"1", GUN_TYPE_1},
-    {"2", GUN_TYPE_2},
-    {"3", GUN_TYPE_3},
-    {"4", GUN_TYPE_4},
-    {"5", GUN_TYPE_5},
-    {"6", GUN_TYPE_6},
-    {"7", GUN_TYPE_7},
-    {"8", GUN_TYPE_8},
-    {"J", GUN_TYPE_J},
-    {"U", GUN_TYPE_U},
-    {"V", GUN_TYPE_V},
-    {"E", GUN_TYPE_E},
-    {"F", GUN_TYPE_F},
-    {"G", GUN_TYPE_G},
-};
-
-//------------------------------------------------------------------------------
-static int StoreLogMsg(const char *fmt, ...)
-{
-    char Buf[4096 + 256] = {0};
-    char buffer[4096] = {0};
-    int rc = 0;
-    va_list args;
-    struct timeb  SeqEndTime;
-    struct tm *tm;
-
-    va_start(args, fmt);
-    rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
-    va_end(args);
-
-    ftime(&SeqEndTime);
-    SeqEndTime.time = time(NULL);
-    tm = localtime(&SeqEndTime.time);
-
-    //if (ShmSysConfigAndInfo->SysConfig.SwitchDebugFlag == YES) {
-    //    sprintf(Buf, "%02d:%02d:%02d:%03d - %s",
-    //            tm->tm_hour, tm->tm_min, tm->tm_sec, SeqEndTime.millitm, buffer);
-    //    printf("%s \n", Buf);
-    //} else {
-    sprintf(Buf, "echo \"%04d-%02d-%02d %02d:%02d:%02d:%03d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-            tm->tm_year + 1900,
-            tm->tm_mon + 1,
-            tm->tm_mday,
-            tm->tm_hour,
-            tm->tm_min,
-            tm->tm_sec,
-            SeqEndTime.millitm,
-            buffer,
-            tm->tm_year + 1900,
-            tm->tm_mon + 1);
-    system(Buf);
-    //}
-
-    return rc;
-}
-
-static int keyfromstring(char *key, SymStruct *table, int tableCount)
-{
-    int i = 0;
-    //int loop = sizeof(table) / sizeof(SymStruct);
-    SymStruct *sym = NULL;
-
-    for (i = 0; i < tableCount; i++) {
-        sym = (SymStruct *)&table[i];
-        if (strcmp(sym->key, key) == 0) {
-            //printf("val = %x\r\n", sym->val);
-            return sym->val;
-        }
-    }
-
-    return BADKEY;
-}
-
-//------------------------------------------------------------------------------
-static uint16_t exchangeRatingCur(uint32_t key)
-{
-    switch (key) {
-    //60A J
-    case DW_CE_30_J:
-    case DM_CE_30_J:
-
-    case DW_CE_30_E:
-    case DM_CE_30_E:
-        return RC_60A; //rating current 60A
-
-    //65A U
-    case DW_UL_30_U:
-    case DM_UL_30_U:
-
-    case DW_CNS_30_U:
-    case DM_CNS_30_U:
-        return RC_65A;
-
-    //80A J
-    case DW_UL_30_J:
-    case DM_UL_30_J:
-    case DW_CNS_30_J:
-    case DM_CNS_30_J:
-
-    //80A G
-    case DM_CNS_30_G:
-    case DS_UL_30_G:
-
-    //80A M
-    case DW_CE_30_M:
-    case DM_CE_30_M:
-
-    //80A N
-    case DW_UL_30_N:
-    case DM_UL_30_N:
-    case DW_CNS_30_N:
-    case DM_CNS_30_N:
-        return RC_80A; //rating current 80A
-
-    //125A J
-    case DS_CE_60_J:
-    case DS_CE_90_J:
-    case DS_CE_120_J:
-    case DS_CE_150_J:
-    case DS_CE_180_J:
-
-    case DS_UL_60_J:
-    case DS_UL_90_J:
-    case DS_UL_120_J:
-    case DS_UL_150_J:
-    case DS_UL_180_J:
-
-    case DS_CNS_60_J:
-    case DS_CNS_90_J:
-    case DS_CNS_120_J:
-    case DS_CNS_150_J:
-    case DS_CNS_180_J:
-
-    //125A U
-    case DS_UL_60_U:
-
-    case DS_CNS_60_U:
-
-    //125A E
-    case DS_CE_60_E:
-        return RC_125A; //rating current 125A
-
-    //200A U
-    case DS_UL_90_U:
-    case DS_UL_120_U:
-    case DS_UL_150_U:
-    case DS_UL_180_U:
-    case DD_UL_360_U:
-
-    case DS_CNS_90_U:
-    case DS_CNS_120_U:
-    case DS_CNS_150_U:
-    case DS_CNS_180_U:
-    case DD_CNS_360_U:
-
-    //200A E
-    case DS_CE_90_E:
-    case DS_CE_120_E:
-    case DS_CE_150_E:
-    case DS_CE_180_E:
-
-    //200A K
-    case DS_CE_90_K:
-    case DS_CE_120_K:
-    case DS_CE_150_K:
-    case DS_CE_180_K:
-
-    case DD_CE_360_K:
-
-    case DS_UL_90_K:
-    case DS_UL_120_K:
-    case DS_UL_150_K:
-    case DS_UL_180_K:
-
-    case DD_UL_360_K:
-        return RC_200A; //rating current 200A
-
-    //250A G
-    case DS_CNS_120_G:
-        return RC_250A;
-
-    //300A T
-    case DS_CE_90_T:
-    case DS_CE_120_T:
-    case DS_CE_150_T:
-    case DS_CE_180_T:
-
-    case DD_CE_360_T:
-
-    case DS_UL_90_T:
-    case DS_UL_120_T:
-    case DS_UL_150_T:
-    case DS_UL_180_T:
-
-    case DD_UL_360_T:
-
-    case DS_CNS_90_T:
-    case DS_CNS_120_T:
-    case DS_CNS_150_T:
-    case DS_CNS_180_T:
-
-    case DD_CNS_360_T:
-
-    //300A D
-    case DS_CE_90_D:
-    case DS_CE_120_D:
-    case DS_CE_150_D:
-    case DS_CE_180_D:
-    case DD_CE_360_D:
-
-    case DS_UL_90_D:
-    case DS_UL_120_D:
-    case DS_UL_150_D:
-    case DS_UL_180_D:
-
-    case DD_UL_360_D:
-
-    case DS_CNS_90_D:
-    case DS_CNS_120_D:
-    case DS_CNS_150_D:
-    case DS_CNS_180_D:
-
-    case DD_CNS_360_D:
-        return RC_300A;
-
-    //500A V
-    case DD_UL_360_V:
-
-    case DD_CNS_360_V:
-
-    case DO_UL_360_V:
-    case DO_CNS_360_V:
-
-    //500A F
-    case DD_CE_360_F:
-    case DO_CE_360_F:
-
-    //P
-    case DD_CE_360_P:
-
-    case DD_UL_360_R:
-    case DD_CNS_360_R:
-        return RC_500A; //rating current 500A
-
-    default:
-        return RC_0A; //rating current 200A
-    }
-}
-
-static void exchangeGunTypeAndVolValue(uint8_t key, GunTypeAndVolInfo *gunAndVol)
-{
-    GunTypeAndVolInfo *pGunAndVol = (GunTypeAndVolInfo *)gunAndVol;
-
-    switch (key) {
-    case GUN_TYPE_0:// : none
-    case GUN_TYPE_1:// : IEC 62196-2 Type 1/SAE J1772 Plug
-    case GUN_TYPE_2:// : IEC 62196-2 Type 1/SAE J1772 Socket
-    case GUN_TYPE_3:// : IEC 62196-2 Type 2 Plug
-    case GUN_TYPE_4:// : IEC 62196-2 Type 2 Socket
-    case GUN_TYPE_5:// : GB/T AC Plug
-    case GUN_TYPE_6:// : GB/T AC Socket
-    case GUN_TYPE_7:// :CCS2 AC Plug
-        pGunAndVol->GunType = Gun_Type_AC;
-        pGunAndVol->GunVoltage = VOL_CHADEMO;
-        break;
-
-    case GUN_TYPE_8:// :Type E socket
-        break;
-
-    case GUN_TYPE_J:// : CHAdeMO
-        pGunAndVol->GunType = Gun_Type_Chademo;
-        pGunAndVol->GunVoltage = VOL_CHADEMO;
-        break;
-
-    case GUN_TYPE_U:// : Natural cooling CCS1 combo
-    case GUN_TYPE_V:// : Liquid cooling CCS1 combo
-    case GUN_TYPE_E:// : Natural cooling CCS2 combo
-    case GUN_TYPE_F:// : Liquid cooling CCS2 combo
-        pGunAndVol->GunType = Gun_Type_CCS_2;
-        pGunAndVol->GunVoltage = VOL_CCS;
-        break;
-
-    case GUN_TYPE_G:// : GBT DC
-        pGunAndVol->GunType = Gun_Type_GB;
-        pGunAndVol->GunVoltage = VOL_GBT;
-        break;
-    }
-}
-
-static int exchangePowerValue(uint8_t key)
-{
-    switch (key) {
-    case POWER_30W:
-        return 300;
-
-    case POWER_60W:
-        return 600;
-
-    case POWER_90W:
-        return 900;
-
-    case POWER_120W:
-        return 1200;
-
-    case POWER_150W:
-        return 1500;
-
-    case POWER_180W:
-        return 1800;
-
-    case POWER_240W:
-        return 2400;
-
-    case POWER_360W:
-        return 3600;
-
-    case POWER_480W:
-        return 4800;
-
-    case POWER_720W:
-        return 7200;
-
-    default:
-        return 600;
-        break;
-    }
-}
-
-/**
- * [ModuleRatedCurrentParsing : Parsing Rating Current]
- * @param  pModuleName  [description]
- * @param  pDestStruct  [save parameter structure array]
- * @param  parsingCount [parameter structure array count, array 0, 1 for DC Gun, 2 for AC Gun]
- * @return              [return -1 is module name format non match.]
- */
-int ModuleRatedCurrentParsing(char *pModuleName, void *pDestStruct, uint8_t parsingCount)
-{
-    uint8_t gunTypeIndex = 0;
-
-    uint8_t modelKey = 0;
-    uint8_t reguKey = 0;
-    uint8_t powerKey = 0;
-    uint8_t gunTypeKey = 0;
-
-    uint16_t powerVal = 0;
-    uint16_t ratingCurVal = 0;
-    int i = 0;
-    uint32_t ret = 0;
-    char model[2] = {'\0'};
-    char regulation[1] = {'\0'};
-    char power[2] = {'\0'};
-    char gunType[1] = {'\0'};
-    GunRateCurInfo *pGunRateCurInfo = NULL;
-    GunTypeAndVolInfo fGunAndVol = {0};
-
-    if (pModuleName == NULL || pDestStruct == NULL || parsingCount <= 0) {
-        log_error("Failed to parse source data\r\n");
-        return FAIL;
-    }
-
-    if (parsingCount > 3) {
-        parsingCount = 3;
-    }
-
-    strncpy(model, &pModuleName[0], 2);
-    model[2] = '\0';
-    strncpy(regulation, &pModuleName[3], 1);
-    regulation[1] = '\0';
-    strncpy(power, &pModuleName[4], 2);
-    power[2] = '\0';
-
-    for (i = 0; i < parsingCount; i++) {
-        pGunRateCurInfo = (GunRateCurInfo *)pDestStruct + i;
-
-        if (i == 0) {
-            gunTypeIndex = DC_ONE;
-        } else if (i == 1) {
-            gunTypeIndex = DC_SEC;
-        } else if (i == 2) {
-            gunTypeIndex = AC_ONE;
-        }
-
-        strncpy(gunType, &pModuleName[gunTypeIndex], 1);
-        gunType[1] = '\0';
-
-        modelKey = keyfromstring(&model[0], &modelTable[0], sizeof(modelTable) / sizeof(SymStruct));
-        reguKey = keyfromstring(&regulation[0], &regulationTable[0], sizeof(regulationTable) / sizeof(SymStruct));
-        powerKey = keyfromstring(&power[0], &powerTable[0], sizeof(powerTable) / sizeof(SymStruct));
-        if ((gunTypeKey = keyfromstring(&gunType[0], &gunTypeTable[0], sizeof(gunTypeTable) / sizeof(SymStruct))) == GUN_TYPE_0) {
-            log_error("The type of gun is none\r\n");
-            continue;
-        }
-
-        ret = 0;
-        ret = ((modelKey << 24) | (reguKey << 16) | (powerKey << 8) | gunTypeKey);
-        ratingCurVal = exchangeRatingCur(ret);
-        if (ratingCurVal == RC_0A) {
-            log_error("Model name format none match\r\n");
-            return FAIL;
-        }
-
-        memset((uint8_t *)&fGunAndVol, 0, sizeof(GunTypeAndVolInfo));
-        exchangeGunTypeAndVolValue(gunTypeKey, &fGunAndVol);
-        powerVal = exchangePowerValue(powerKey);
-
-        pGunRateCurInfo->GunType = fGunAndVol.GunType;
-        pGunRateCurInfo->RatingCurrent = ratingCurVal;
-        pGunRateCurInfo->Voltage = fGunAndVol.GunVoltage;
-        pGunRateCurInfo->Power = powerVal;
-
-        log_info("%d GunType = %d, Rating current = %d, Vol = %d, Power = %d\r\n",
-                 i,
-                 pGunRateCurInfo->GunType,
-                 pGunRateCurInfo->RatingCurrent,
-                 pGunRateCurInfo->Voltage,
-                 pGunRateCurInfo->Power);
-
-    }
-
-    return PASS;
-}
-
-//------------------------------------------------------------------------------
-//Test function
-//------------------------------------------------------------------------------
-void TestRatedCurrentParsing(void)
-{
-    GunRateCurInfo fGunRateCurInfo[3] = {0};
-
-    ModuleRatedCurrentParsing("DDYC362V0UE2AD", &fGunRateCurInfo[0], sizeof(fGunRateCurInfo) / sizeof(GunRateCurInfo));
-    //log_info("%d GunType = %d, Rating current = %d, Vol = %d, Power = %d\r\n",
-    //         0,
-    //         fGunRateCurInfo[0].GunType,
-    //         fGunRateCurInfo[0].RatingCurrent,
-    //         fGunRateCurInfo[0].Voltage,
-    //         fGunRateCurInfo[0].Power);
-
-    ModuleRatedCurrentParsing("DSYE301E00D2PH", &fGunRateCurInfo[0], sizeof(fGunRateCurInfo) / sizeof(GunRateCurInfo));
-}

+ 0 - 298
EVSE/Modularization/Module_RatingCurrent.h

@@ -1,298 +0,0 @@
-#ifndef _MODULE_NAME_PARSING_H_
-#define _MODULE_NAME_PARSING_H_
-
-#define BADKEY                                  (-1)
-
-//------------------------------------------------------------------------------
-// model type key
-//------------------------------------------------------------------------------
-#define MODEL_AC                                (0x01) //Ac EVse Cordset
-#define MODEL_AW                                (0x02) //Ac EVse Wallmount
-#define MODEL_AP                                (0x03) //Ac EVse Pedestal
-#define MODEL_DW                                (0x04) //Dc EVse Wallmount
-#define MODEL_DS                                (0x05) //Dc EVse Standalone
-#define MODEL_DM                                (0x06) //Dc EVse Moveable (Battery equipped)
-#define MODEL_DR                                (0x07) //Dc EVse Power Rack (without cabinet)
-//#define MODEL_DM                                (0x08) //Dc EVse Moveable (移動)
-#define MODEL_DD                                (0x09) //Dc EVse Dispenser
-#define MODEL_DO                                (0x0A) //Dc EVse Output power cabinet
-
-//------------------------------------------------------------------------------
-// regulation key
-//------------------------------------------------------------------------------
-#define REG_CE                                  (0x01) // CE / European Market
-#define REG_UL                                  (0x02) // UL / North America Market
-#define REG_GB                                  (0x03) // GB / China Market
-#define REG_CNS                                 (0x04) // CNS / Taiwan Market
-#define REG_JARI                                (0x05) // JARI / Japan Market
-#define REG_TR25                                (0x06) // TR25 / Singapor Market
-#define REG_KC                                  (0x07) // KC / Korea Market
-#define REG_B                                   (0x08) // British / UK Market
-#define REG_Z                                   (0x09) // EV ready / French Market
-#define REG_M                                   (0x0A) // E + MID Meter
-#define REG_P                                   (0x0B) // E + PTB certification
-#define REG_I                                   (0x0C) // Z + TIC Meter pcb
-#define REG_F                                   (0x0D) // Z + MID Meter
-#define REG_L                                   (0x0E) // U + UL meter
-
-//------------------------------------------------------------------------------
-// rate power key
-//------------------------------------------------------------------------------
-#define POWER_30W                               (0x01)
-#define POWER_60W                               (0x02)
-#define POWER_90W                               (0x03)
-#define POWER_120W                              (0x04)
-#define POWER_150W                              (0x05)
-#define POWER_180W                              (0x06)
-#define POWER_240W                              (0x07)
-#define POWER_360W                              (0x08)
-#define POWER_480W                              (0x09)
-#define POWER_720W                              (0x0A)
-
-//------------------------------------------------------------------------------
-// gun type key
-//------------------------------------------------------------------------------
-#define GUN_TYPE_0                              (0x00) //none
-#define GUN_TYPE_1                              (0x01) //IEC 62196-2 Type 1/SAE J1772 Plug
-#define GUN_TYPE_2                              (0x02) //IEC 62196-2 Type 1/SAE J1772 Socket
-#define GUN_TYPE_3                              (0x03) //IEC 62196-2 Type 2 Plug
-#define GUN_TYPE_4                              (0x04) //IEC 62196-2 Type 2 Socket
-#define GUN_TYPE_5                              (0x05) //GB/T AC Plug
-#define GUN_TYPE_6                              (0x06) //GB/T AC Socket
-#define GUN_TYPE_7                              (0x07) //CS2 AC Plug
-#define GUN_TYPE_8                              (0x08) //Type E socket
-#define GUN_TYPE_J                              (0x09) //CHAdeMO
-#define GUN_TYPE_U                              (0x0A) //Natural cooling CCS1 combo
-#define GUN_TYPE_V                              (0x0B) //Liquid cooling CCS1 combo
-#define GUN_TYPE_E                              (0x0C) //Natural cooling CCS2 combo
-#define GUN_TYPE_F                              (0x0D) //Liquid cooling CCS2 combo
-#define GUN_TYPE_G                              (0x0E) //GBT DC
-#define GUN_TYPE_T                              (0x0F) //Rema CCS1
-#define GUN_TYPE_D                              (0x10) //Rema CCS2
-#define GUN_TYPE_K                              (0x11) //CHAdeMO 200A/500V
-#define GUN_TYPE_M                              (0x12) //CCS2 80A
-#define GUN_TYPE_N                              (0x13) //CCS1 80A
-#define GUN_TYPE_P                              (0x14) //Phoenix CCS2 500A 水冷
-#define GUN_TYPE_R                              (0x15) //Phoenix CCS1 500A 水冷
-
-//------------------------------------------------------------------------------
-// rating current parameters
-//------------------------------------------------------------------------------
-#define RC_0A                                   (0)
-#define RC_60A                                  (600)
-#define RC_65A                                  (650)
-#define RC_80A                                  (800)
-#define RC_125A                                 (1250)
-#define RC_200A                                 (2000)
-#define RC_250A                                 (2500)
-#define RC_300A                                 (3000)
-#define RC_500A                                 (5000)
-
-//------------------------------------------------------------------------------
-// maximum voltage parameters
-//------------------------------------------------------------------------------
-#define VOL_CHADEMO                             (5000)
-#define VOL_CCS                                 (9500)
-#define VOL_GBT                                 (7500)
-
-#define DC_ONE                                  (7)
-#define DC_SEC                                  (9)
-#define AC_ONE                                  (8)
-
-//------------------------------------------------------------------------------
-// power parameters
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-// rating current case
-//------------------------------------------------------------------------------
-//J
-#define DW_CE_30_J                              ((uint32_t)((MODEL_DW << 24) | (REG_CE << 16) | (POWER_30W << 8) | GUN_TYPE_J))
-#define DM_CE_30_J                              ((uint32_t)((MODEL_DM << 24) | (REG_CE << 16) | (POWER_30W << 8) | GUN_TYPE_J))
-
-#define DW_UL_30_J                              ((uint32_t)((MODEL_DW << 24) | (REG_UL << 16) | (POWER_30W << 8) | GUN_TYPE_J))
-#define DM_UL_30_J                              ((uint32_t)((MODEL_DM << 24) | (REG_UL << 16) | (POWER_30W << 8) | GUN_TYPE_J))
-
-#define DW_CNS_30_J                             ((uint32_t)((MODEL_DW << 24) | (REG_CNS << 16) | (POWER_30W << 8) | GUN_TYPE_J))
-#define DM_CNS_30_J                             ((uint32_t)((MODEL_DM << 24) | (REG_CNS << 16) | (POWER_30W << 8) | GUN_TYPE_J))
-
-#define DS_CE_60_J                              ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_60W << 8) | GUN_TYPE_J))
-#define DS_CE_90_J                              ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_90W << 8) | GUN_TYPE_J))
-#define DS_CE_120_J                             ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_120W << 8) | GUN_TYPE_J))
-#define DS_CE_150_J                             ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_150W << 8) | GUN_TYPE_J))
-#define DS_CE_180_J                             ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_180W << 8) | GUN_TYPE_J))
-
-#define DS_UL_60_J                              ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_60W << 8) | GUN_TYPE_J))
-#define DS_UL_90_J                              ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_90W << 8) | GUN_TYPE_J))
-#define DS_UL_120_J                             ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_120W << 8) | GUN_TYPE_J))
-#define DS_UL_150_J                             ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_150W << 8) | GUN_TYPE_J))
-#define DS_UL_180_J                             ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_180W << 8) | GUN_TYPE_J))
-
-#define DS_CNS_60_J                             ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_60W << 8) | GUN_TYPE_J))
-#define DS_CNS_90_J                             ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_90W << 8) | GUN_TYPE_J))
-#define DS_CNS_120_J                            ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_120W << 8) | GUN_TYPE_J))
-#define DS_CNS_150_J                            ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_150W << 8) | GUN_TYPE_J))
-#define DS_CNS_180_J                            ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_180W << 8) | GUN_TYPE_J))
-
-//U
-#define DW_UL_30_U                              ((uint32_t)((MODEL_DW << 24) | (REG_UL << 16) | (POWER_30W << 8) | GUN_TYPE_U))
-#define DM_UL_30_U                              ((uint32_t)((MODEL_DM << 24) | (REG_UL << 16) | (POWER_30W << 8) | GUN_TYPE_U))
-
-#define DW_CNS_30_U                             ((uint32_t)((MODEL_DW << 24) | (REG_CNS << 16) | (POWER_30W << 8) | GUN_TYPE_U))
-#define DM_CNS_30_U                             ((uint32_t)((MODEL_DM << 24) | (REG_CNS << 16) | (POWER_30W << 8) | GUN_TYPE_U))
-
-#define DS_UL_60_U                              ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_60W << 8) | GUN_TYPE_U))
-#define DS_UL_90_U                              ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_90W << 8) | GUN_TYPE_U))
-#define DS_UL_120_U                             ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_120W << 8) | GUN_TYPE_U))
-#define DS_UL_150_U                             ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_150W << 8) | GUN_TYPE_U))
-#define DS_UL_180_U                             ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_180W << 8) | GUN_TYPE_U))
-
-#define DD_UL_360_U                             ((uint32_t)((MODEL_DD << 24) | (REG_UL << 16) | (POWER_360W << 8) | GUN_TYPE_U))
-
-#define DS_CNS_60_U                             ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_60W << 8) | GUN_TYPE_U))
-#define DS_CNS_90_U                             ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_90W << 8) | GUN_TYPE_U))
-#define DS_CNS_120_U                            ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_120W << 8) | GUN_TYPE_U))
-#define DS_CNS_150_U                            ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_150W << 8) | GUN_TYPE_U))
-#define DS_CNS_180_U                            ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_180W << 8) | GUN_TYPE_U))
-
-#define DD_CNS_360_U                             ((uint32_t)((MODEL_DD << 24) | (REG_CNS << 16) | (POWER_360W << 8) | GUN_TYPE_U))
-
-//V
-#define DD_UL_360_V                             ((uint32_t)((MODEL_DD << 24) | (REG_UL << 16) | (POWER_360W << 8) | GUN_TYPE_V))
-
-#define DD_CNS_360_V                            ((uint32_t)((MODEL_DD << 24) | (REG_CNS << 16) | (POWER_360W << 8) | GUN_TYPE_V))
-
-#define DO_UL_360_V                             ((uint32_t)((MODEL_DO << 24) | (REG_UL << 16) | (POWER_360W << 8) | GUN_TYPE_V))
-
-#define DO_CNS_360_V                            ((uint32_t)((MODEL_DO << 24) | (REG_CNS << 16) | (POWER_360W << 8) | GUN_TYPE_V))
-
-//E
-#define DW_CE_30_E                              ((uint32_t)((MODEL_DW << 24) | (REG_CE << 16) | (POWER_30W << 8) | GUN_TYPE_E))
-#define DM_CE_30_E                              ((uint32_t)((MODEL_DM << 24) | (REG_CE << 16) | (POWER_30W << 8) | GUN_TYPE_E))
-
-#define DS_CE_60_E                              ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_60W << 8) | GUN_TYPE_E))
-#define DS_CE_90_E                              ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_90W << 8) | GUN_TYPE_E))
-#define DS_CE_120_E                             ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_120W << 8) | GUN_TYPE_E))
-#define DS_CE_150_E                             ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_150W << 8) | GUN_TYPE_E))
-#define DS_CE_180_E                             ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_180W << 8) | GUN_TYPE_E))
-
-//F
-#define DD_CE_360_F                             ((uint32_t)((MODEL_DD << 24) | (REG_CE << 16) | (POWER_360W << 8) | GUN_TYPE_F))
-
-#define DO_CE_360_F                             ((uint32_t)((MODEL_DO << 24) | (REG_CE << 16) | (POWER_360W << 8) | GUN_TYPE_F))
-
-//G
-#define DM_CNS_30_G                             ((uint32_t)((MODEL_DM << 24) | (REG_CNS << 16) | (POWER_30W << 8) | GUN_TYPE_G))
-
-#define DS_UL_30_G                              ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_30W << 8) | GUN_TYPE_G))
-#define DS_CNS_120_G                            ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_120W << 8) | GUN_TYPE_G))
-
-//T
-#define DS_CE_90_T                              ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_90W << 8) | GUN_TYPE_T))
-#define DS_CE_120_T                             ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_120W << 8) | GUN_TYPE_T))
-#define DS_CE_150_T                             ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_150W << 8) | GUN_TYPE_T))
-#define DS_CE_180_T                             ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_180W << 8) | GUN_TYPE_T))
-
-#define DD_CE_360_T                             ((uint32_t)((MODEL_DD << 24) | (REG_CE << 16) | (POWER_360W << 8) | GUN_TYPE_T))
-
-#define DS_UL_90_T                              ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_90W << 8) | GUN_TYPE_T))
-#define DS_UL_120_T                             ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_120W << 8) | GUN_TYPE_T))
-#define DS_UL_150_T                             ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_150W << 8) | GUN_TYPE_T))
-#define DS_UL_180_T                             ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_180W << 8) | GUN_TYPE_T))
-
-#define DD_UL_360_T                             ((uint32_t)((MODEL_DD << 24) | (REG_UL << 16) | (POWER_360W << 8) | GUN_TYPE_T))
-
-#define DS_CNS_90_T                             ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_90W << 8) | GUN_TYPE_T))
-#define DS_CNS_120_T                            ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_120W << 8) | GUN_TYPE_T))
-#define DS_CNS_150_T                            ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_150W << 8) | GUN_TYPE_T))
-#define DS_CNS_180_T                            ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_180W << 8) | GUN_TYPE_T))
-
-#define DD_CNS_360_T                            ((uint32_t)((MODEL_DD << 24) | (REG_CNS << 16) | (POWER_360W << 8) | GUN_TYPE_T))
-
-//D
-#define DS_CE_90_D                              ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_90W << 8) | GUN_TYPE_D))
-#define DS_CE_120_D                             ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_120W << 8) | GUN_TYPE_D))
-#define DS_CE_150_D                             ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_150W << 8) | GUN_TYPE_D))
-#define DS_CE_180_D                             ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_180W << 8) | GUN_TYPE_D))
-
-#define DD_CE_360_D                             ((uint32_t)((MODEL_DD << 24) | (REG_CE << 16) | (POWER_360W << 8) | GUN_TYPE_D))
-
-#define DS_UL_90_D                              ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_90W << 8) | GUN_TYPE_D))
-#define DS_UL_120_D                             ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_120W << 8) | GUN_TYPE_D))
-#define DS_UL_150_D                             ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_150W << 8) | GUN_TYPE_D))
-#define DS_UL_180_D                             ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_180W << 8) | GUN_TYPE_D))
-
-#define DD_UL_360_D                             ((uint32_t)((MODEL_DD << 24) | (REG_UL << 16) | (POWER_360W << 8) | GUN_TYPE_D))
-
-#define DS_CNS_90_D                             ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_90W << 8) | GUN_TYPE_D))
-#define DS_CNS_120_D                            ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_120W << 8) | GUN_TYPE_D))
-#define DS_CNS_150_D                            ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_150W << 8) | GUN_TYPE_D))
-#define DS_CNS_180_D                            ((uint32_t)((MODEL_DS << 24) | (REG_CNS << 16) | (POWER_180W << 8) | GUN_TYPE_D))
-
-#define DD_CNS_360_D                            ((uint32_t)((MODEL_DD << 24) | (REG_CNS << 16) | (POWER_360W << 8) | GUN_TYPE_D))
-
-//K
-#define DS_CE_90_K                              ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_90W << 8) | GUN_TYPE_K))
-#define DS_CE_120_K                             ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_120W << 8) | GUN_TYPE_K))
-#define DS_CE_150_K                             ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_150W << 8) | GUN_TYPE_K))
-#define DS_CE_180_K                             ((uint32_t)((MODEL_DS << 24) | (REG_CE << 16) | (POWER_180W << 8) | GUN_TYPE_K))
-
-#define DD_CE_360_K                             ((uint32_t)((MODEL_DD << 24) | (REG_CE << 16) | (POWER_360W << 8) | GUN_TYPE_K))
-
-#define DS_UL_90_K                              ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_90W << 8) | GUN_TYPE_K))
-#define DS_UL_120_K                             ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_120W << 8) | GUN_TYPE_K))
-#define DS_UL_150_K                             ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_150W << 8) | GUN_TYPE_K))
-#define DS_UL_180_K                             ((uint32_t)((MODEL_DS << 24) | (REG_UL << 16) | (POWER_180W << 8) | GUN_TYPE_K))
-
-#define DD_UL_360_K                             ((uint32_t)((MODEL_DD << 24) | (REG_UL << 16) | (POWER_360W << 8) | GUN_TYPE_K))
-
-//M
-#define DW_CE_30_M                              ((uint32_t)((MODEL_DW << 24) | (REG_CE << 16) | (POWER_30W << 8) | GUN_TYPE_M))
-#define DM_CE_30_M                              ((uint32_t)((MODEL_DM << 24) | (REG_CE << 16) | (POWER_30W << 8) | GUN_TYPE_M))
-
-//N
-#define DW_UL_30_N                              ((uint32_t)((MODEL_DW << 24) | (REG_UL << 16) | (POWER_30W << 8) | GUN_TYPE_N))
-#define DM_UL_30_N                              ((uint32_t)((MODEL_DM << 24) | (REG_UL << 16) | (POWER_30W << 8) | GUN_TYPE_N))
-
-#define DW_CNS_30_N                             ((uint32_t)((MODEL_DW << 24) | (REG_CNS << 16) | (POWER_30W << 8) | GUN_TYPE_N))
-#define DM_CNS_30_N                             ((uint32_t)((MODEL_DM << 24) | (REG_CNS << 16) | (POWER_30W << 8) | GUN_TYPE_N))
-
-//P
-#define DD_CE_360_P                             ((uint32_t)((MODEL_DD << 24) | (REG_CE << 16) | (POWER_360W << 8) | GUN_TYPE_P))
-
-//R
-#define DD_UL_360_R                             ((uint32_t)((MODEL_DD << 24) | (REG_UL << 16) | (POWER_360W << 8) | GUN_TYPE_R))
-
-#define DD_CNS_360_R                            ((uint32_t)((MODEL_DD << 24) | (REG_CNS << 16) | (POWER_360W << 8) | GUN_TYPE_R))
-
-//------------------------------------------------------------------------------
-typedef enum EnGunType {
-    Gun_Type_Chademo = 0,
-    Gun_Type_CCS_2,
-    Gun_Type_GB,
-    Gun_Type_AC,
-} GunType;
-
-typedef struct StSymStruct {
-    char *key;
-    int val;
-} SymStruct;
-
-typedef struct StGunTypeAndVolInfo {
-    uint8_t GunType;
-    uint16_t GunVoltage;
-} GunTypeAndVolInfo;
-
-typedef struct StGunRateCurInfo {
-    uint8_t GunType;
-    uint16_t RatingCurrent; //* 0.1A
-    uint16_t Voltage;       //* 0.1V
-    uint16_t Power;
-    uint8_t Reserved;
-} GunRateCurInfo;
-
-//------------------------------------------------------------------------------
-int ModuleRatedCurrentParsing(char *pModuleName, void *pDestStruct, uint8_t parsingCount);
-void TestRatedCurrentParsing(void);
-
-#endif /* _MODULE_NAME_PARSING_H_ */

+ 1 - 1
EVSE/Projects/DD360/Apps/FactoryConfig.c

@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
     */
     //********** System **********// udhcpc -i eth1 -s ./dhcp_script/eth1.script
     //
-    strcpy((char *)SysConfig.ModelName, "DDYC182V0UE2AD");
+    strcpy((char *)SysConfig.ModelName, "DXYE18200EE1E4");
     strcpy((char *)SysConfig.SerialNumber, "SERIALFORRD");
 
     memset(SysConfig.SystemId, 0x00, sizeof(SysConfig.SystemId));

+ 1 - 1
EVSE/Projects/DD360/Apps/Module_InternalComm.c

@@ -2321,7 +2321,7 @@ int main(void)
 //              printRelayStatus = true;
 //          }
         }
-#ifndef NO_FAN_BOARD
+#if !defined NO_FAN_BOARD && !defined DD360ComBox
         if (ShmFanModuleData->SelfTest_Comp == YES) {
             if (GetTimeoutValue(_priority_time) / 1000 >= 1000) {
                 //GetPsuTempForFanSpeed();

+ 2 - 2
EVSE/Projects/DD360/Apps/Module_LcmControl.c

@@ -336,7 +336,7 @@ void ChangeWarningFunc()
     // 最多一次五筆
     //PRINTF_FUNC("LCM PageIndex = %d \n", ShmSysConfigAndInfo->SysWarningInfo.PageIndex);
     //PRINTF_FUNC("WarningCount = %d \n", ShmSysConfigAndInfo->SysWarningInfo.WarningCount);
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     for (i = 0; (i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5) < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; i++) {
         memset(cmd, 0x00, sizeof(cmd));
         if ((i) >= 5) {
@@ -918,7 +918,7 @@ void RefreshPageAnimation(byte value)
 void RefreshConnStatus()
 {
     // Wifi priority is higher than Ethernet
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
     uint8_t i = 0;
     unsigned char flag[4] = {0};
 

+ 3 - 3
EVSE/Projects/DD360/Apps/Module_PrimaryComm.c

@@ -257,7 +257,7 @@ void GetInputGpioStatus()
 {
     //PRINTF_FUNC("GetInputGpioStatus \n");
     if (Query_Gpio_Input(Uart1Fd, Addr.IoExtend, &gpio_in) == PASS) {
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
         ShmSysConfigAndInfo->SysInfo.AcContactorStatus = ShmPrimaryMcuData->InputDet.bits.AcContactorDetec = gpio_in.AC_Connector;
         ShmPrimaryMcuData->InputDet.bits.AcMainBreakerDetec = gpio_in.AC_MainBreaker;
 #else
@@ -284,7 +284,7 @@ void GetInputGpioStatus()
         //PRINTF_FUNC("left = %d \n", ShmPrimaryMcuData->InputDet.bits.Button1);
         //PRINTF_FUNC("right = %d \n", ShmPrimaryMcuData->InputDet.bits.Button2);
         //PRINTF_FUNC("ShmSysConfigAndInfo->SysInfo.AcContactorStatus = %d \n", ShmSysConfigAndInfo->SysInfo.AcContactorStatus);
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
         if (ShmPrimaryMcuData->InputDet.bits.AcMainBreakerDetec == YES) {
             DEBUG_ERROR("AC Mainbreaker occur. \n");
         }
@@ -303,7 +303,7 @@ void SetOutputGpio(byte flash)
     gpio.System_LED[2] = 0x00;
     gpio.System_LED[3] = 0x00;
 
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
     if ((ChargingData[0]->PresentChargingCurrent) >= 150) {
         ChillerSwitch = 1;
         ChillerOnTime = time((time_t *)NULL);

+ 158 - 34
EVSE/Projects/DD360/Apps/ReMain.c

@@ -33,7 +33,7 @@
 #include <dirent.h>
 #include "timeout.h"
 
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
 #include "AudiCust.h"
 #endif //defined DD360Audi
 
@@ -53,7 +53,7 @@
 #define MtdBlockSize                            0x600000
 #define SYSFS_GPIO_DIR                          "/sys/class/gpio"
 #define UPGRADE_FAN                             0x02
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
 #define UPGRADE_RB                              0x09 //0x09 for DD360 dispenser
 #else
 #define UPGRADE_RB                              0x03 //other module use
@@ -84,6 +84,18 @@
 #define GUN_COMP_WAIT_TIMEOUT                   10
 #define GUN_PRECHARGING_TIMEOUT                 60
 
+typedef struct StLedConfig {
+    //OutputDrvValue[0]
+    uint8_t LeftButtonLed: 1;                   //bit 0,    H: ON,      L:OFF
+    uint8_t RightButtonLed: 1;                  //bit 1,    H: ON,      L:OFF
+    uint8_t GreenLED: 1;                        //bit 2,    H: ON,      L:OFF
+    uint8_t YellowLED: 1;                       //bit 3,    H: ON,      L:OFF
+    uint8_t RedLED: 1;                          //bit 4,    H: ON,      L:OFF
+    uint8_t SystemLed4: 1;                      //bit 5,    H: ON,      L:OFF
+    uint8_t AcContactor: 1;                     //bit 6,    H: ON,      L:OFF
+    uint8_t Reserved: 1;                        //bit 7 reserved
+} LedConfig;
+
 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; // 10 ms
@@ -153,7 +165,7 @@ struct MeterInformation         *ShmCsuMeterData;
 struct DcCommonInformation      *ShmDcCommonData;
 #endif //defined METER_ENABLE
 
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
 static AudiCustInfo             *gAudiCustInfo = NULL; //Jerry add
 #endif //defined DD360Audi
 
@@ -317,6 +329,100 @@ static void confirmSelGun(uint8_t selGun)
 }
 #endif // defined DD360Audi
 
+static void startPrimaryLedIndicatorCtrlFork(void)
+{
+    pid_t pid = fork();
+    if (pid == 0) {
+        uint8_t totalGun = ShmSysConfigAndInfo->SysConfig.TotalConnectorCount;
+        uint8_t gunIndex = 0;
+        int isContinue = 1;
+        LedConfig *pLedConfig = (LedConfig *)&ShmPrimaryMcuData->OutputDrv.OutputDrvValue[0];
+
+        while (isContinue) {
+            for (gunIndex = 0; gunIndex < totalGun; gunIndex++) {
+                //printf("led indicator status = %d\r\n", chargingInfo[gunIndex]->SystemStatus);
+                //printf("level = %d\r\n", ShmSysConfigAndInfo->SysWarningInfo.Level);
+                switch (chargingInfo[gunIndex]->SystemStatus) {
+                case S_BOOTING:
+                    pLedConfig->RedLED = YES;
+                    pLedConfig->YellowLED = YES;
+                    pLedConfig->GreenLED = YES;
+                    break;
+
+                case S_IDLE:
+                case S_RESERVATION:
+                case S_AUTHORIZING:
+                case S_REASSIGN_CHECK:
+                case S_REASSIGN:
+                case S_PREPARNING:
+                case S_PREPARING_FOR_EV:
+                case S_PREPARING_FOR_EVSE:
+                case S_CCS_PRECHARGE_ST0:
+                case S_CCS_PRECHARGE_ST1:
+                    pLedConfig->RedLED = NO;
+                    pLedConfig->YellowLED = NO;
+
+                    if (pLedConfig->GreenLED == YES) {
+                        pLedConfig->GreenLED = NO;
+                    } else {
+                        pLedConfig->GreenLED = YES;
+                    }
+                    break;
+
+                case S_CHARGING:
+                    pLedConfig->RedLED = NO;
+                    if (pLedConfig->YellowLED == YES) {
+                        pLedConfig->YellowLED = NO;
+                    } else {
+                        pLedConfig->YellowLED = YES;
+                    }
+                    pLedConfig->GreenLED = NO;
+                    break;
+
+                case S_ALARM:
+                case S_TERMINATING:
+                case S_COMPLETE:
+                    if (ShmSysConfigAndInfo->SysWarningInfo.Level == 2) {
+                        pLedConfig->YellowLED = NO;
+                        pLedConfig->GreenLED = NO;
+                        if (pLedConfig->RedLED == YES) {
+                            pLedConfig->RedLED = NO;
+                        } else {
+                            pLedConfig->RedLED = YES;
+                        }
+                    } else {
+                        pLedConfig->RedLED = NO;
+                        pLedConfig->YellowLED = NO;
+                        pLedConfig->GreenLED = YES;
+                    }
+                    break;
+
+                case S_MAINTAIN:
+                case S_FAULT:
+                    pLedConfig->YellowLED = NO;
+                    pLedConfig->GreenLED = NO;
+                    if (ShmSysConfigAndInfo->SysWarningInfo.Level == 2) {
+                        if (pLedConfig->RedLED == YES) {
+                            pLedConfig->RedLED = NO;
+                        } else {
+                            pLedConfig->RedLED = YES;
+                        }
+                    }
+                    break;
+
+                case S_BOOKING:
+                case S_DEBUG:
+                case S_UPDATE:
+                case S_NONE:
+                    break;
+                }
+
+                usleep(500000);
+            }//switch
+        }//for
+    }//while
+}
+
 //================================================
 // initial can-bus
 //================================================
@@ -702,7 +808,7 @@ int CreateShareMemory()
     memset(ShmDcCommonData, 0, sizeof(struct DcCommonInformation));
 #endif //defined METER_ENABLE
 
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
     //creat Audi customization info
     if ((MeterSMId = shmget(ShmAudiCustInfoKey, sizeof(AudiCustInfo), IPC_CREAT | 0777)) < 0) {
         return FAIL;
@@ -820,7 +926,7 @@ void InitGPIO()
     system("echo \"out\" > /sys/class/gpio/gpio116/direction");
     system("echo 0 > /sys/class/gpio/gpio116/value");
 
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     /* (C14) EMU0.gpio3[7] */  /*CP open/short feature enable/disable, pull low for default enable*/
     system("echo 103 > /sys/class/gpio/export");
     system("echo \"out\" > /sys/class/gpio/gpio103/direction");
@@ -1027,7 +1133,7 @@ int isReachableInternet()
     }
     pclose(fp);
 
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
     if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.DisconnectedFromDo == NORMAL) {
         result = FAIL;
     } else {
@@ -1063,7 +1169,7 @@ int isReachableInternet()
 void InitEthernet()
 {
     char tmpbuf[256];
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     bool ethResult = false;
     uint8_t cnt_pingDNS_Fail = 0;
 #endif //!defined DD360 && !defined DD360Audi
@@ -1117,7 +1223,7 @@ void InitEthernet()
     if (pid == 0) {
         log_info("InitEthernet = %d\r\n", pid);
         for (;;) {
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
             if (isRouteFail()) {
                 //PRINTF_FUNC("eth0 not in route, restart eht0. \n");
                 system("/sbin/ifconfig eth0 down;/sbin/ifconfig eth0 up");
@@ -1597,7 +1703,7 @@ bool DisplaySelfTestFailReason()
     }
 
     if (ShmSysConfigAndInfo->SysInfo.AcContactorStatus == NO) {
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
         // AC Contact 未搭上
         ShmStatusCodeData->AlarmCode.AlarmEvents.bits.AcContactStestFail = true;
         result = true;
@@ -1650,7 +1756,7 @@ void SelfTestRun()
                     log_info("Relay Board FW Rev = %s", ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev);
                     ShmRelayModuleData->SelfTest_Comp = YES;
                 }
-#ifndef NO_FAN_BOARD
+#if !defined NO_FAN_BOARD && !defined DD360ComBox
                 if ((strlen((char *)ShmSysConfigAndInfo->SysInfo.FanModuleFwRev) != 0 ||
                         ShmSysConfigAndInfo->SysInfo.FanModuleFwRev[0] != '\0')
                         && (ShmFanModuleData->SelfTest_Comp != YES)
@@ -1756,7 +1862,7 @@ void SelfTestRun()
             case _STEST_AC_CONTACTOR: {
                 //ShmPsuData->Work_Step = _TEST_COMPLETE;
                 // 因為 30KW 以下沒有 Relay feedback 功能,所以暫時先直接跳過
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                 if (ShmSysConfigAndInfo->SysInfo.AcContactorStatus == YES) {
                     ShmSysConfigAndInfo->SysInfo.SelfTestSeq = _STEST_PSU_DETECT;
                     log_info("AC contactor self test OK");
@@ -1768,7 +1874,7 @@ void SelfTestRun()
             }
             break;
             case _STEST_PSU_DETECT: {
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                 if (ShmPsuData->Work_Step >= GET_SYS_CAP) {
                     ShmSysConfigAndInfo->SysInfo.SelfTestSeq = _STEST_PSU_CAP;
                 }
@@ -1778,7 +1884,7 @@ void SelfTestRun()
             }
             break;
             case _STEST_PSU_CAP: {
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                 // 此測試是要確認當前總輸出能力
                 // 如果沒有 PSU 模組請 bypass
                 if (ShmPsuData->Work_Step == BOOTING_COMPLETE) {
@@ -1813,7 +1919,7 @@ int SpawnTask()
     system("/root/Module_InternalComm &");
     system("/root/Module_ProduceUtils &");
 
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
     system("/root/DoComm &");
 #else
     system("/root/Module_PsuComm &");
@@ -2398,7 +2504,7 @@ void EmcOccureByString(char *code)
     // 嚴重的急停有以下幾種 : EMC 按鈕、Mainbreak、Dooropen
     // 其錯誤等級為 2
 
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
     //DS60-120 remove
     if (strncmp(code, "012251", 6) == EQUAL ||
             strncmp(code, "012252", 6) == EQUAL ||
@@ -2423,7 +2529,7 @@ void EmcOccureByString(char *code)
                 ChargingAlarmProcess(gun);
             }
         }
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
         StopChargingProcessByString(level);
         InformOcppErrOccur(4);
 #endif //defined DD360 || defined DD360Audi
@@ -2935,19 +3041,19 @@ void CheckGunTypeFromHw()
     for (i = 0; i < 2; i++) {
         switch (tmp[i]) {
         case 0x01:
-            log_info("BD%d(%s) = %s ", i + 1, i == 1 ? "Left" : "Right", "CHAdeMO");
+            log_info("BD%d(%s) = %s ", i + 1, i == 0 ? "Left" : "Right", "CHAdeMO");
             break;
 
         case 0x10:
-            log_info("BD%d(%s) = %s ", i + 1, i == 1 ? "Left" : "Right", "CCS");
+            log_info("BD%d(%s) = %s ", i + 1, i == 0 ? "Left" : "Right", "CCS");
             break;
 
         case 0x11:
-            log_info("BD%d(%s) = %s ", i + 1, i == 1 ? "Left" : "Right", "GBT");
+            log_info("BD%d(%s) = %s ", i + 1, i == 0 ? "Left" : "Right", "GBT");
             break;
 
         case 0x00:
-            log_info("BD%d(%s) = %s ", i + 1, i == 1 ? "Left" : "Right", "None");
+            log_info("BD%d(%s) = %s ", i + 1, i == 0 ? "Left" : "Right", "None");
             break;
         }
     }
@@ -3122,7 +3228,7 @@ void UserScanFunction()
                     } else {
                         _authorizeIndex = ShmSysConfigAndInfo->SysInfo.CurGunSelected;
                     }
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                     StartSystemTimeoutDet(Timeout_AuthorizingForStop);
                     AuthorizingStart();
 #else
@@ -3155,14 +3261,14 @@ void UserScanFunction()
     } else {
         // 透過後臺停止充電的判斷
         if (isAuthorizedComplete()
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                 || (ShmSysConfigAndInfo->SysInfo.OcppConnStatus == NO &&
                     ShmSysConfigAndInfo->SysConfig.OfflinePolicy == _OFFLINE_POLICY_FREE_CHARGING)
 #endif //!defined DD360 && !defined DD360Audi
            ) {
             // 判斷後台回覆狀態
             if (canStartCharging()
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                     || (ShmSysConfigAndInfo->SysInfo.OcppConnStatus == NO &&
                         ShmSysConfigAndInfo->SysConfig.OfflinePolicy == _OFFLINE_POLICY_FREE_CHARGING)
 #endif //!defined DD360 && !defined DD360Audi
@@ -3229,14 +3335,14 @@ void ScannerCardProcess()
 
         // 確認驗證卡號完成沒
         if (isAuthorizedComplete()
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                 || ShmSysConfigAndInfo->SysConfig.OfflinePolicy == _OFFLINE_POLICY_FREE_CHARGING
 #endif //!defined DD360 && !defined DD360Audi
            ) {
             StopSystemTimeoutDet();
             // 判斷後台回覆狀態
             if (canStartCharging()
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                     || ShmSysConfigAndInfo->SysConfig.OfflinePolicy == _OFFLINE_POLICY_FREE_CHARGING
 #endif //!defined DD360 && !defined DD360Audi
                ) {
@@ -3540,7 +3646,7 @@ void KillTask()
     system("killall Module_LcmControl");
     system("killall Module_InternalComm");
     //system("killall DoComm");
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     system("killall Module_PsuComm");
     system("killall OcppBackend &");
     system("killall Module_4g &");
@@ -3553,7 +3659,7 @@ void KillTaskExceptPrimary()
     ChangeLcmByIndex(_LCM_FIX);
     system("killall Module_EvComm");
     system("killall Module_InternalComm");
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     system("killall Module_PsuComm");
     system("killall Module_4g &");
     system("killall Module_Wifi &");
@@ -3568,7 +3674,7 @@ void KillAllTask()
     system("killall Module_EvComm");
     system("killall Module_LcmControl");
     system("killall Module_InternalComm");
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     system("killall Module_PsuComm");
     system("killall OcppBackend &");
     system("killall Module_4g &");
@@ -5421,6 +5527,20 @@ static void powerCabinetPsuAlarmStatus(void)
     }
 }
 
+static void autoStartChargingForComBox(uint8_t gunIndex)
+{
+#if defined DD360ComBox
+    if ((chargingInfo[gunIndex]->ConnectorPlugIn == YES) &&
+            (chargingInfo[gunIndex]->SystemStatus == S_IDLE)
+       ) {
+        ShmSysConfigAndInfo->SysInfo.CurGunSelected = gunIndex;
+        strcpy((char *)&ShmSysConfigAndInfo->SysConfig.UserId, "AutoStartCharging");
+    }
+#else
+    return;
+#endif //DD360ComBox
+}
+
 int main(void)
 {
     uint8_t evBoardStopState = 0;
@@ -5465,6 +5585,7 @@ int main(void)
     }
     CreateTimeoutFork();
     log_info("Start self test... \n");
+    startPrimaryLedIndicatorCtrlFork();
     SelfTestRun();
     StopSystemTimeoutDet();
     log_info("Self test finished : SelfTestSeq = %d, Work_Step = %d ",
@@ -5537,6 +5658,7 @@ int main(void)
     CheckFwSlotStatusLog();
     AdjustChargerCurrent();
     gettimeofday(&_cmdMainPriority_time, NULL);
+
     for (;;) {
         CheckOcppStatus();
         ChkPrimaryStatus();
@@ -5555,7 +5677,7 @@ int main(void)
         ClearAlarmCodeWhenAcOff();
         // 確認是否要回到充電中的槍畫面邏輯判斷
         CheckReturnToChargingConn();
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
         //確認Power cabinet PSU Status
         powerCabinetPsuAlarmStatus();
 #endif // defined DD360 || defined DD360Audi
@@ -5612,6 +5734,8 @@ int main(void)
 #endif //defined METER_ENABLE
 
         for (byte gun_index = 0; gun_index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; gun_index++) {
+            autoStartChargingForComBox(gun_index); //for DD360ComBox
+
             CheckGpioInStatus();
             CheckErrorOccurStatus(gun_index);
             ChkOcppStatus(gun_index);
@@ -5683,7 +5807,7 @@ int main(void)
                     }
 
                     ClearDetectPluginFlag();
-//#if !defined DD360 && !defined DD360Audi
+//#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                     UpdateErrorCodeToOcpp(gun_index);
 //#endif //!defined DD360 && !defined DD360Audi
                     setChargerMode(gun_index, MODE_FAULT);
@@ -5707,7 +5831,7 @@ int main(void)
 #endif //0
 
                     if (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_AVER) {
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                         if (ShmSysConfigAndInfo->SysInfo.AcContactorStatus == YES)
 #else
                         if (1)
@@ -5845,7 +5969,7 @@ int main(void)
                     }
                     StopSystemTimeoutDet();
                 }
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                 bool isRessign = false;
                 if (ShmSysConfigAndInfo->SysConfig.TotalConnectorCount > 1 && ShmSysConfigAndInfo->SysInfo.IsAlternatvieConf == NO) {
                     if (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_MAX) {
@@ -5884,7 +6008,7 @@ int main(void)
 #endif // !defined DD360 && !defined DD360Audi
 
                 if (0) { // if (isRessign)
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
                     setChargerMode(gun_index, MODE_PRECHARGE);
 #else
                     setChargerMode(gun_index, MODE_REASSIGN);
@@ -6136,7 +6260,7 @@ int main(void)
                     ftime(&startChargingTime[gun_index]);
                     strcpy((char *)ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.Status, ""); //DS60-120 add
                     ChangeStartOrStopDateTime(YES, gun_index);
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                     OcppStartTransation(gun_index);
 #endif //!defined DD360 && !defined DD360Audi
                 }

+ 12 - 9
EVSE/Projects/DD360/Apps/ReModule_EvComm.c

@@ -2578,14 +2578,14 @@ void SetPresentChargingOutputCap(struct ChargingInfoData *chargingData_1, struct
     float pow1 = 0, cur1 = 0;
     float pow2 = 0, cur2 = 0;
 
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     float vol = 0;
 #endif //!defined DD360 && !defined DD360Audi
 
     pow1 = chargingData_1->AvailableChargingPower;
     cur1 = chargingData_1->AvailableChargingCurrent;
 
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     vol = chargingData_1->MaximumChargingVoltage;
     GetMaxVolAndCurMethod(chargingData_1->Index, &vol, &cur1);
     GetMaxPowerMethod(chargingData_1->Index, &pow1);
@@ -2610,7 +2610,7 @@ void SetPresentChargingOutputCap(struct ChargingInfoData *chargingData_1, struct
     pow2 = chargingData_2->AvailableChargingPower;
     cur2 = chargingData_2->AvailableChargingCurrent;
 
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     vol = chargingData_2->MaximumChargingVoltage;
     GetMaxVolAndCurMethod(chargingData_2->Index, &vol, &cur2);
     GetMaxPowerMethod(chargingData_2->Index, &pow2);
@@ -3320,10 +3320,10 @@ int main(int argc, char *argv[])
                 // 計算 Power
                 _chargingData[_index]->PresentChargingPower = ((float)((_chargingData[_index]->PresentChargingVoltage) * (_chargingData[_index]->PresentChargingCurrent)) / 1000);
 
-                CalOutputPowerAndEnergy(_index); //DS60-120 add
+                //CalOutputPowerAndEnergy(_index); //DS60-120 add
 
                 //DS60-120 remove
-                /*if (chargingTime[_index] == 0 ||
+                if (chargingTime[_index] == 0 ||
                         chargingTime[_index] > _chargingData[_index]->PresentChargedDuration) {
                     chargingTime[_index] = _chargingData[_index]->PresentChargedDuration;
                 } else {
@@ -3339,7 +3339,7 @@ int main(int argc, char *argv[])
                         _chargingData[_index]->PowerConsumption += changingPow;
                         chargingTime[_index] = _chargingData[_index]->PresentChargedDuration;
                     }
-                }*/
+                }
 
                 // 開始確認車端是否同意開始充電
                 GetOutputReq(_index, _chargingData[_index]->Evboard_id);
@@ -3361,11 +3361,14 @@ int main(int argc, char *argv[])
                     }
                 }
 
-                if (_chargingData[_index]->GroundFaultStatus == GFD_FAIL) {
-                    SetIsolationStatus(_index, _chargingData[_index]->GroundFaultStatus, _chargingData[_index]->Evboard_id);
-                } else if (_chargingData[_index]->Type == _Type_CCS_2) {
+                if ((_chargingData[_index]->GroundFaultStatus == GFD_FAIL) ||
+                        (_chargingData[_index]->Type == _Type_CCS_2)) {
                     SetIsolationStatus(_index, _chargingData[_index]->GroundFaultStatus, _chargingData[_index]->Evboard_id);
                 }
+                /*
+                else if (_chargingData[_index]->Type == _Type_CCS_2) {
+                SetIsolationStatus(_index, _chargingData[_index]->GroundFaultStatus, _chargingData[_index]->Evboard_id);
+                }*/
 
                 // GFD 失敗再通知
                 if (priorityLow == 1) {

File diff suppressed because it is too large
+ 188 - 176
EVSE/Projects/DD360/Apps/ReModule_InternalComm.c


+ 2 - 2
EVSE/Projects/DD360/Apps/ReModule_LcmControl.c

@@ -339,7 +339,7 @@ void ChangeWarningFunc()
     // 最多一次五筆
     //PRINTF_FUNC("LCM PageIndex = %d \n", ShmSysConfigAndInfo->SysWarningInfo.PageIndex);
     //PRINTF_FUNC("WarningCount = %d \n", ShmSysConfigAndInfo->SysWarningInfo.WarningCount);
-//#if !defined DD360 && !defined DD360Audi
+//#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     for (i = 0; (i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5) < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; i++) {
         memset(cmd, 0x00, sizeof(cmd));
         if ((i) >= 5) {
@@ -927,7 +927,7 @@ void RefreshPageAnimation(byte value)
 void RefreshConnStatus()
 {
     // Wifi priority is higher than Ethernet
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
     uint8_t i = 0;
     uint8_t ehtStatus = 0;
 

+ 147 - 90
EVSE/Projects/DD360/Apps/ReModule_PrimaryComm.c

@@ -37,6 +37,24 @@
 #define YES                 1
 #define NO                  0
 
+typedef struct StChillerInfo {
+    uint8_t ChillerSwitch;
+    uint32_t ChillerOnTime;
+    uint8_t Reserved[3];
+} ChillerInfo;
+
+typedef struct StLedConfig {
+    //OutputDrvValue[0]
+    uint8_t LeftButtonLed: 1;                   //bit 0,    H: ON,      L:OFF
+    uint8_t RightButtonLed: 1;                  //bit 1,    H: ON,      L:OFF
+    uint8_t GreenLED: 1;                          //bit 2,    H: ON,      L:OFF
+    uint8_t YellowLED: 1;                       //bit 3,    H: ON,      L:OFF
+    uint8_t RedLED: 1;                        //bit 4,    H: ON,      L:OFF
+    uint8_t SystemLed4: 1;                      //bit 5,    H: ON,      L:OFF
+    uint8_t AcContactor: 1;                     //bit 6,    H: ON,      L:OFF
+    uint8_t Reserved: 1;                        //bit 7 reserved
+} LedConfig;
+
 typedef unsigned char       byte;
 
 struct SysConfigAndInfo         *ShmSysConfigAndInfo;
@@ -65,17 +83,15 @@ byte _curDeviceStatus[3] = {0, 0, 0}; //DS60-120 add
 byte _reCheckCount[3] = {0, 0, 0}; //DS60-120 add
 struct ChargingInfoData *ChargingData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
 
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
 unsigned char ChillerSwitch; //DS60-120 remove
 unsigned int ChillerOnTime; //DS60-120 remove
 #endif //defined DD360 || defined DD360Audi
 
-void PRINTF_FUNC(char *string, ...);
-
 int StoreLogMsg(const char *fmt, ...);
-#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
-#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
-#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#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)
 
 int StoreLogMsg(const char *fmt, ...)
 {
@@ -119,16 +135,6 @@ int DiffTimeb(struct timeb ST, struct timeb ET)
     return (StopTime - StartTime) * 1000 + ET.millitm - ST.millitm;
 }
 
-void PRINTF_FUNC(char *string, ...)
-{
-    va_list args;
-    char buffer[4096];
-    va_start(args, string);
-    vsnprintf(buffer, sizeof(buffer), string, args);
-    va_end(args);
-
-    DEBUG_INFO("%s \n", buffer);
-}
 //=================================
 // Common routine
 //=================================
@@ -244,20 +250,23 @@ int InitShareMemory()
 void GetFwAndHwVersion()
 {
     if (Query_FW_Ver(Uart1Fd, Addr.IoExtend, &ver) == PASS) {
-        //PRINTF_FUNC("Primary FW Rev = %s \n", ver.Version_FW);
+        //log_info("Primary FW Rev = %s \n", ver.Version_FW);
         strcpy((char *)ShmPrimaryMcuData->version, ver.Version_FW);
         strcpy((char *) ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ver.Version_FW);
     }
 
     //if (Query_HW_Ver(Uart1Fd, Addr.IoExtend, &ver) == PASS)
-    //    ;//PRINTF_FUNC("Primary HW Rev  = %s \n", ver.Version_HW);
+    //    ;//log_info("Primary HW Rev  = %s \n", ver.Version_HW);
 }
 
 void GetInputGpioStatus()
 {
-    //PRINTF_FUNC("GetInputGpioStatus \n");
+    uint8_t dispenserSwTmp = 0;
+    static uint8_t dispenserSw = 0;
+
+    //log_info("GetInputGpioStatus \n");
     if (Query_Gpio_Input(Uart1Fd, Addr.IoExtend, &gpio_in) == PASS) {
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
         //DS60-120 add
         if (_curDeviceStatus[_PRIMARY_CHECK_TAG_AC_CONTACT] != gpio_in.AC_Connector) {
             if (_reCheckCount[_PRIMARY_CHECK_TAG_AC_CONTACT] >= 3) {
@@ -300,20 +309,52 @@ void GetInputGpioStatus()
 #endif //!defined DD360 && !defined DD360Audi
 
         ShmPrimaryMcuData->InputDet.bits.SpdDetec = gpio_in.SPD;
-#if defined DD360 ||defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
+
+#if defined DD360ComBox
+        ShmPrimaryMcuData->InputDet.bits.DoorOpen = gpio_in.Door_Open;
+#else
         ShmPrimaryMcuData->InputDet.bits.DoorOpen = ~gpio_in.Door_Open;
+#endif //
 
         ShmPrimaryMcuData->InputDet.bits.Key0 = ~gpio_in.Key[0] & 0x01;
         ShmPrimaryMcuData->InputDet.bits.Key1 = ~gpio_in.Key[1] & 0x01;
         ShmPrimaryMcuData->InputDet.bits.Key2 = ~gpio_in.Key[2] & 0x01;
         ShmPrimaryMcuData->InputDet.bits.Key3 = ~gpio_in.Key[3] & 0x01;
+        //ShmPrimaryMcuData->InputDet.bits.EmergencyButton = gpio_in.Emergency_Btn;
 #else
+
+        ShmPrimaryMcuData->InputDet.bits.Key0 = gpio_in.Key[0] & 0x01;
+        ShmPrimaryMcuData->InputDet.bits.Key1 = gpio_in.Key[1] & 0x01;
+        ShmPrimaryMcuData->InputDet.bits.Key2 = gpio_in.Key[2] & 0x01;
+        ShmPrimaryMcuData->InputDet.bits.Key3 = gpio_in.Key[3] & 0x01;
+        //ShmPrimaryMcuData->InputDet.bits.EmergencyButton = ~gpio_in.Emergency_Btn;
         ShmPrimaryMcuData->InputDet.bits.DoorOpen = gpio_in.Door_Open;
 #endif //defined DD360 ||defined DD360Audi
 
+#if defined DD360ComBox
+        ShmPrimaryMcuData->InputDet.bits.EmergencyButton = ~gpio_in.Emergency_Btn;
+#else
+        ShmPrimaryMcuData->InputDet.bits.EmergencyButton = gpio_in.Emergency_Btn;
+#endif //
+
+        dispenserSwTmp |= (ShmPrimaryMcuData->InputDet.bits.Key0);
+        dispenserSwTmp |= (ShmPrimaryMcuData->InputDet.bits.Key1 << 1);
+        dispenserSwTmp |= (ShmPrimaryMcuData->InputDet.bits.Key2 << 2);
+        dispenserSwTmp |= (ShmPrimaryMcuData->InputDet.bits.Key3 << 3);
+
+        if (dispenserSwTmp != dispenserSw) {
+            dispenserSw = dispenserSwTmp;
+            log_info("Dispenser switch number =  %d, bit = %d, %d, %d, %d\r\n",
+                     dispenserSw,
+                     ShmPrimaryMcuData->InputDet.bits.Key3,
+                     ShmPrimaryMcuData->InputDet.bits.Key2,
+                     ShmPrimaryMcuData->InputDet.bits.Key1,
+                     ShmPrimaryMcuData->InputDet.bits.Key0);
+        }
+
         ShmPrimaryMcuData->InputDet.bits.Button1 = gpio_in.Button[0];
         ShmPrimaryMcuData->InputDet.bits.Button2 = gpio_in.Button[1];
-        ShmPrimaryMcuData->InputDet.bits.EmergencyButton = gpio_in.Emergency_Btn;
 
         /*printf(" gpio_in.Key[0]~ gpio_in.Key[3]=%d, %d, %d, %d\n",
         ShmPrimaryMcuData->InputDet.bits.Key0 , ShmPrimaryMcuData->InputDet.bits.Key1,
@@ -321,12 +362,12 @@ void GetInputGpioStatus()
         printf("ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CcsLiquidChillerWaterLevelWarning=%d\n", ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CcsLiquidChillerWaterLevelWarning);
         printf("ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsLiquidChillerWaterLevelFault=%d\n", ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsLiquidChillerWaterLevelFault);
         */
-        //PRINTF_FUNC("left = %d \n", ShmPrimaryMcuData->InputDet.bits.Button1);
-        //PRINTF_FUNC("right = %d \n", ShmPrimaryMcuData->InputDet.bits.Button2);
-        //PRINTF_FUNC("ShmSysConfigAndInfo->SysInfo.AcContactorStatus = %d \n", ShmSysConfigAndInfo->SysInfo.AcContactorStatus);
-#if !defined DD360 && !defined DD360Audi
+        //log_info("left = %d \n", ShmPrimaryMcuData->InputDet.bits.Button1);
+        //log_info("right = %d \n", ShmPrimaryMcuData->InputDet.bits.Button2);
+        //log_info("ShmSysConfigAndInfo->SysInfo.AcContactorStatus = %d \n", ShmSysConfigAndInfo->SysInfo.AcContactorStatus);
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
         if (ShmPrimaryMcuData->InputDet.bits.AcMainBreakerDetec == YES) {
-            DEBUG_ERROR("AC Mainbreaker occur. \n");
+            log_error("AC Mainbreaker occur. \n");
         }
 #endif //!defined DD360 && !defined DD360Audi
     }
@@ -374,51 +415,86 @@ void GetMeterConsumption(byte index)
 }
 #endif //defined METER_ENABLE
 
-void SetOutputGpio(byte flash)
+static void checkChillerStatus(Gpio_out *gpio)
 {
-    Gpio_out gpio;
-    gpio.Button_LED[0] = flash;
-    gpio.Button_LED[1] = flash;
+    uint8_t gunIndex = 0;
+    uint8_t chillerCount = 0;
+    static ChillerInfo fChillerInfo[2] = {0};
+    Gpio_out *pGpio = (Gpio_out *)gpio;
+
+    if ((strncmp((char *)&ShmSysConfigAndInfo->SysConfig.ModelName[7], "V", 1) == 0) ||
+            (strncmp((char *)&ShmSysConfigAndInfo->SysConfig.ModelName[7], "F", 1) == 0)) {
+        chillerCount++;
+    }
 
-    gpio.System_LED[0] = 0x00;
-    gpio.System_LED[1] = 0x00;
-    gpio.System_LED[2] = 0x00;
-    gpio.System_LED[3] = 0x00;
+    if ((strncmp((char *)&ShmSysConfigAndInfo->SysConfig.ModelName[9], "V", 1) == 0) ||
+            (strncmp((char *)&ShmSysConfigAndInfo->SysConfig.ModelName[9], "F", 1) == 0)) {
+        chillerCount++;
+    }
 
-#if defined DD360 || defined DD360Audi
-    if ((ChargingData[0]->PresentChargingCurrent) >= 150) {
-        ChillerSwitch = 1;
-        ChillerOnTime = time((time_t *)NULL);
-    } else {
-        if (ChillerSwitch == 1) {
-            if ((ChargingData[0]->PresentChargingCurrent) >= 100) {
-                ChillerSwitch = 1;
-                ChillerOnTime = time((time_t *)NULL);
-            } else {
-                if ((time((time_t *)NULL) - ChillerOnTime) >= 600) {
-                    ChillerSwitch = 0;
+    if (chillerCount == 0) {
+        pGpio->AC_Connector = 0x00;
+        return;
+    }
+
+    for (gunIndex = 0; gunIndex < chillerCount; gunIndex++) {
+        if ((ChargingData[gunIndex]->PresentChargingCurrent) >= 150) {
+            fChillerInfo[gunIndex].ChillerSwitch = YES;
+            fChillerInfo[gunIndex].ChillerOnTime = time((time_t *)NULL);
+        } else {
+            if (fChillerInfo[gunIndex].ChillerSwitch == YES) {
+                if ((ChargingData[gunIndex]->PresentChargingCurrent) >= 100) {
+                    fChillerInfo[gunIndex].ChillerSwitch = YES;
+                    fChillerInfo[gunIndex].ChillerOnTime = time((time_t *)NULL);
                 } else {
-                    ChillerSwitch = 1;
+                    if ((time((time_t *)NULL) - fChillerInfo[gunIndex].ChillerOnTime) >= 600) {
+                        fChillerInfo[gunIndex].ChillerSwitch = NO;
+                    } else {
+                        fChillerInfo[gunIndex].ChillerSwitch = YES;
+                    }
                 }
+            } else {
+                fChillerInfo[gunIndex].ChillerSwitch = NO;
             }
-        } else {
-            ChillerSwitch = 0;
         }
     }
-    gpio.AC_Connector = ChillerSwitch;//Chiller ON/OFF Control, "0: Chiller disable, 1: Chiller enable"
 
-    //printf("ChargingData[0]->PresentChargingCurrent=%f,ChargingData[1]->PresentChargingCurrent=%f,ChillerSwitch=%d\n",ChargingData[0]->PresentChargingCurrent,ChargingData[1]->PresentChargingCurrent,ChillerSwitch);
-#else
-    gpio.AC_Connector = 0x00;
-#endif //defined DD360 || DD360Audi
+    pGpio->AC_Connector = fChillerInfo[gunIndex].ChillerSwitch;//Chiller ON/OFF Control, "0: Chiller disable, 1: Chiller enable"
+}
 
-    gpio.AC_Breaker = 0x00;
+void SetOutputGpio(uint8_t outputValue)
+{
+    Gpio_out gpio;
+    LedConfig *pLedConfig = (LedConfig *)&outputValue;
 
-    if (Config_Gpio_Output(Uart1Fd, Addr.IoExtend, &gpio) == PASS) {
-        //PRINTF_FUNC("SetOutputGpio sucessfully. %d \n", flash);
+    if (strcmp((char *)ShmSysConfigAndInfo->SysInfo.LcmHwRev, " ") == 0x00) {
+        if (flash == NO) {
+            flash = YES;
+        } else {
+            flash = NO;
+        }
     } else {
-        //PRINTF_FUNC("SetOutputGpio fail. \n");
+        if (flash == NO) {
+            flash = YES;
+        }
     }
+
+    pLedConfig->LeftButtonLed = flash;
+    pLedConfig->RightButtonLed = flash;
+
+    gpio.Button_LED[0] = pLedConfig->LeftButtonLed;
+    gpio.Button_LED[1] = pLedConfig->RightButtonLed;
+
+    gpio.System_LED[0] = pLedConfig->GreenLED;
+    gpio.System_LED[1] = pLedConfig->YellowLED;
+    gpio.System_LED[2] = pLedConfig->RedLED;
+    gpio.System_LED[3] = 0x00;
+
+    checkChillerStatus(&gpio);
+
+    gpio.AC_Breaker = 0x00;
+
+    Config_Gpio_Output(Uart1Fd, Addr.IoExtend, &gpio);
 }
 
 void SetRtcData()
@@ -428,7 +504,7 @@ void SetRtcData()
 
     ftime(&csuTime);
     tmCSU = localtime(&csuTime.time);
-//  PRINTF_FUNC("Time : %04d-%02d-%02d %02d:%02d:%02d \n", tmCSU->tm_year + 1900,
+//  log_info("Time : %04d-%02d-%02d %02d:%02d:%02d \n", tmCSU->tm_year + 1900,
 //          tmCSU->tm_mon + 1, tmCSU->tm_mday, tmCSU->tm_hour, tmCSU->tm_min,
 //          tmCSU->tm_sec);
 
@@ -453,9 +529,9 @@ void SetRtcData()
     rtc.RtcData[13] = '0' + (tmCSU->tm_sec) / 1 % 10;
 
     if (Config_Rtc_Data(Uart1Fd, Addr.IoExtend, &rtc) == PASS) {
-        //PRINTF_FUNC("SetRtc sucessfully. \n");
+        //log_info("SetRtc sucessfully. \n");
     } else {
-        //PRINTF_FUNC("SetRtc fail. \n");
+        //log_info("SetRtc fail. \n");
     }
 }
 
@@ -476,7 +552,7 @@ int InitComPort()
     fd = open(priPortName, O_RDWR);
     if (fd <= 0) {
 #ifdef SystemLogMessage
-        DEBUG_ERROR("open 407 Communication port NG \n");
+        log_error("open 407 Communication port NG \n");
 #endif
         return -1;
     }
@@ -535,7 +611,7 @@ void Initialization() //DS60-120 add
         isPass = true;
         for (byte _index = 0; _index < gun_count; _index++) {
             if (!FindChargingInfoData(_index, &ChargingData[0])) {
-                DEBUG_ERROR("EvComm (main) : FindChargingInfoData false \n");
+                log_error("EvComm (main) : FindChargingInfoData false \n");
                 isPass = false;
                 break;
             }
@@ -547,7 +623,7 @@ void Initialization() //DS60-120 add
 int main(void)
 {
     if (InitShareMemory() == FAIL) {
-        DEBUG_ERROR("InitShareMemory NG\r\n");
+        log_error("InitShareMemory NG\r\n");
         if (ShmStatusCodeData != NULL) {
             ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory = 1;
         }
@@ -558,17 +634,17 @@ int main(void)
     //DS60-120 remove
     //for (byte _index = 0; _index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; _index++) {
     //    if (!FindChargingInfoData(_index, &ChargingData[0])) {
-    //        DEBUG_ERROR("FindChargingInfoData false \n");
+    //        log_error("FindChargingInfoData false \n");
     //        break;
     //    }
     //}
     ChillerSwitch = 0;
     Uart1Fd = InitComPort();
-    //PRINTF_FUNC("407 Port id = %d \n", Uart1Fd);
+    //log_info("407 Port id = %d \n", Uart1Fd);
 
     if (Uart1Fd < 0) {
 #ifdef SystemLogMessage
-        DEBUG_ERROR("InitComPort (Uart1 : AM3352 - STM32) NG");
+        log_error("InitComPort (Uart1 : AM3352 - STM32) NG");
 #endif
         if (ShmStatusCodeData != NULL) {
             ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed = 1;
@@ -586,35 +662,16 @@ int main(void)
     byte _count = 0;
 
     for (;;) {
-        if (strcmp((char *)ShmSysConfigAndInfo->SysInfo.LcmHwRev, " ") == 0x00) {
-            if ((GetTimeoutValue(_flash_time) / 1000) > 1000) {
-                if (flash == NO) {
-                    flash = YES;
-                } else {
-                    flash = NO;
-                }
-                SetOutputGpio(flash);
-                gettimeofday(&_flash_time, NULL);
-            }
-        } else {
-            if ((GetTimeoutValue(_flash_time) / 1000) > 5000) {
-                if (flash == NO) {
-                    flash = YES;
-                }
-
-                SetOutputGpio(flash);
-                gettimeofday(&_flash_time, NULL);
-            }
-        }
-
         // 程序開始之前~ 必須先確定 FW 版本與硬體版本,確認後!!~ 該模組才算是真正的 Initial Comp.
         // 模組更新 FW 後,需重新做
         if (ShmPrimaryMcuData->SelfTest_Comp != PASS) {
-            //PRINTF_FUNC("(407) Get Fw and Hw Ver. \n");
+            //log_info("(407) Get Fw and Hw Ver. \n");
             GetFwAndHwVersion();
             sleep(1);
             ShmPrimaryMcuData->SelfTest_Comp = PASS;
         } else {
+            SetOutputGpio(ShmPrimaryMcuData->OutputDrv.OutputDrvValue[0]);
+
             GetInputGpioStatus();
 
 #if defined METER_ENABLE //DS60-120 add

BIN
EVSE/Projects/DD360/Apps/UnsafetyOutputTask


+ 1 - 1
EVSE/Projects/DD360/Apps/internalComm.c

@@ -38,7 +38,7 @@
 #define PASS                1
 #define FAIL                -1
 
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
 struct Address Addr = {0x01, 0x02, 0x03, 0x05, 0x06, 0xFF};
 #else
 struct Address Addr = {0x01, 0x02, 0x09, 0x05, 0x06, 0xFF};

+ 1 - 1
EVSE/Projects/DD360Audi/Apps/FactoryConfig.c

@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
     */
     //********** System **********// udhcpc -i eth1 -s ./dhcp_script/eth1.script
     //
-    strcpy((char *)SysConfig.ModelName, "DDYC182V0UE2AD");
+    strcpy((char *)SysConfig.ModelName, "DXYE18200EE1E4");
     strcpy((char *)SysConfig.SerialNumber, "SERIALFORRD");
 
     memset(SysConfig.SystemId, 0x00, sizeof(SysConfig.SystemId));

+ 1 - 1
EVSE/Projects/DD360Audi/Apps/Module_InternalComm.c

@@ -2321,7 +2321,7 @@ int main(void)
 //              printRelayStatus = true;
 //          }
         }
-#ifndef NO_FAN_BOARD
+#if !defined NO_FAN_BOARD && !defined DD360ComBox
         if (ShmFanModuleData->SelfTest_Comp == YES) {
             if (GetTimeoutValue(_priority_time) / 1000 >= 1000) {
                 //GetPsuTempForFanSpeed();

+ 2 - 2
EVSE/Projects/DD360Audi/Apps/Module_LcmControl.c

@@ -336,7 +336,7 @@ void ChangeWarningFunc()
     // 最多一次五筆
     //PRINTF_FUNC("LCM PageIndex = %d \n", ShmSysConfigAndInfo->SysWarningInfo.PageIndex);
     //PRINTF_FUNC("WarningCount = %d \n", ShmSysConfigAndInfo->SysWarningInfo.WarningCount);
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     for (i = 0; (i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5) < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; i++) {
         memset(cmd, 0x00, sizeof(cmd));
         if ((i) >= 5) {
@@ -918,7 +918,7 @@ void RefreshPageAnimation(byte value)
 void RefreshConnStatus()
 {
     // Wifi priority is higher than Ethernet
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
     uint8_t i = 0;
     unsigned char flag[4] = {0};
 

+ 3 - 3
EVSE/Projects/DD360Audi/Apps/Module_PrimaryComm.c

@@ -257,7 +257,7 @@ void GetInputGpioStatus()
 {
     //PRINTF_FUNC("GetInputGpioStatus \n");
     if (Query_Gpio_Input(Uart1Fd, Addr.IoExtend, &gpio_in) == PASS) {
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
         ShmSysConfigAndInfo->SysInfo.AcContactorStatus = ShmPrimaryMcuData->InputDet.bits.AcContactorDetec = gpio_in.AC_Connector;
         ShmPrimaryMcuData->InputDet.bits.AcMainBreakerDetec = gpio_in.AC_MainBreaker;
 #else
@@ -284,7 +284,7 @@ void GetInputGpioStatus()
         //PRINTF_FUNC("left = %d \n", ShmPrimaryMcuData->InputDet.bits.Button1);
         //PRINTF_FUNC("right = %d \n", ShmPrimaryMcuData->InputDet.bits.Button2);
         //PRINTF_FUNC("ShmSysConfigAndInfo->SysInfo.AcContactorStatus = %d \n", ShmSysConfigAndInfo->SysInfo.AcContactorStatus);
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
         if (ShmPrimaryMcuData->InputDet.bits.AcMainBreakerDetec == YES) {
             DEBUG_ERROR("AC Mainbreaker occur. \n");
         }
@@ -303,7 +303,7 @@ void SetOutputGpio(byte flash)
     gpio.System_LED[2] = 0x00;
     gpio.System_LED[3] = 0x00;
 
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
     if ((ChargingData[0]->PresentChargingCurrent) >= 150) {
         ChillerSwitch = 1;
         ChillerOnTime = time((time_t *)NULL);

+ 158 - 34
EVSE/Projects/DD360Audi/Apps/ReMain.c

@@ -33,7 +33,7 @@
 #include <dirent.h>
 #include "timeout.h"
 
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
 #include "AudiCust.h"
 #endif //defined DD360Audi
 
@@ -53,7 +53,7 @@
 #define MtdBlockSize                            0x600000
 #define SYSFS_GPIO_DIR                          "/sys/class/gpio"
 #define UPGRADE_FAN                             0x02
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
 #define UPGRADE_RB                              0x09 //0x09 for DD360 dispenser
 #else
 #define UPGRADE_RB                              0x03 //other module use
@@ -84,6 +84,18 @@
 #define GUN_COMP_WAIT_TIMEOUT                   10
 #define GUN_PRECHARGING_TIMEOUT                 60
 
+typedef struct StLedConfig {
+    //OutputDrvValue[0]
+    uint8_t LeftButtonLed: 1;                   //bit 0,    H: ON,      L:OFF
+    uint8_t RightButtonLed: 1;                  //bit 1,    H: ON,      L:OFF
+    uint8_t GreenLED: 1;                        //bit 2,    H: ON,      L:OFF
+    uint8_t YellowLED: 1;                       //bit 3,    H: ON,      L:OFF
+    uint8_t RedLED: 1;                          //bit 4,    H: ON,      L:OFF
+    uint8_t SystemLed4: 1;                      //bit 5,    H: ON,      L:OFF
+    uint8_t AcContactor: 1;                     //bit 6,    H: ON,      L:OFF
+    uint8_t Reserved: 1;                        //bit 7 reserved
+} LedConfig;
+
 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; // 10 ms
@@ -153,7 +165,7 @@ struct MeterInformation         *ShmCsuMeterData;
 struct DcCommonInformation      *ShmDcCommonData;
 #endif //defined METER_ENABLE
 
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
 static AudiCustInfo             *gAudiCustInfo = NULL; //Jerry add
 #endif //defined DD360Audi
 
@@ -317,6 +329,100 @@ static void confirmSelGun(uint8_t selGun)
 }
 #endif // defined DD360Audi
 
+static void startPrimaryLedIndicatorCtrlFork(void)
+{
+    pid_t pid = fork();
+    if (pid == 0) {
+        uint8_t totalGun = ShmSysConfigAndInfo->SysConfig.TotalConnectorCount;
+        uint8_t gunIndex = 0;
+        int isContinue = 1;
+        LedConfig *pLedConfig = (LedConfig *)&ShmPrimaryMcuData->OutputDrv.OutputDrvValue[0];
+
+        while (isContinue) {
+            for (gunIndex = 0; gunIndex < totalGun; gunIndex++) {
+                //printf("led indicator status = %d\r\n", chargingInfo[gunIndex]->SystemStatus);
+                //printf("level = %d\r\n", ShmSysConfigAndInfo->SysWarningInfo.Level);
+                switch (chargingInfo[gunIndex]->SystemStatus) {
+                case S_BOOTING:
+                    pLedConfig->RedLED = YES;
+                    pLedConfig->YellowLED = YES;
+                    pLedConfig->GreenLED = YES;
+                    break;
+
+                case S_IDLE:
+                case S_RESERVATION:
+                case S_AUTHORIZING:
+                case S_REASSIGN_CHECK:
+                case S_REASSIGN:
+                case S_PREPARNING:
+                case S_PREPARING_FOR_EV:
+                case S_PREPARING_FOR_EVSE:
+                case S_CCS_PRECHARGE_ST0:
+                case S_CCS_PRECHARGE_ST1:
+                    pLedConfig->RedLED = NO;
+                    pLedConfig->YellowLED = NO;
+
+                    if (pLedConfig->GreenLED == YES) {
+                        pLedConfig->GreenLED = NO;
+                    } else {
+                        pLedConfig->GreenLED = YES;
+                    }
+                    break;
+
+                case S_CHARGING:
+                    pLedConfig->RedLED = NO;
+                    if (pLedConfig->YellowLED == YES) {
+                        pLedConfig->YellowLED = NO;
+                    } else {
+                        pLedConfig->YellowLED = YES;
+                    }
+                    pLedConfig->GreenLED = NO;
+                    break;
+
+                case S_ALARM:
+                case S_TERMINATING:
+                case S_COMPLETE:
+                    if (ShmSysConfigAndInfo->SysWarningInfo.Level == 2) {
+                        pLedConfig->YellowLED = NO;
+                        pLedConfig->GreenLED = NO;
+                        if (pLedConfig->RedLED == YES) {
+                            pLedConfig->RedLED = NO;
+                        } else {
+                            pLedConfig->RedLED = YES;
+                        }
+                    } else {
+                        pLedConfig->RedLED = NO;
+                        pLedConfig->YellowLED = NO;
+                        pLedConfig->GreenLED = YES;
+                    }
+                    break;
+
+                case S_MAINTAIN:
+                case S_FAULT:
+                    pLedConfig->YellowLED = NO;
+                    pLedConfig->GreenLED = NO;
+                    if (ShmSysConfigAndInfo->SysWarningInfo.Level == 2) {
+                        if (pLedConfig->RedLED == YES) {
+                            pLedConfig->RedLED = NO;
+                        } else {
+                            pLedConfig->RedLED = YES;
+                        }
+                    }
+                    break;
+
+                case S_BOOKING:
+                case S_DEBUG:
+                case S_UPDATE:
+                case S_NONE:
+                    break;
+                }
+
+                usleep(500000);
+            }//switch
+        }//for
+    }//while
+}
+
 //================================================
 // initial can-bus
 //================================================
@@ -702,7 +808,7 @@ int CreateShareMemory()
     memset(ShmDcCommonData, 0, sizeof(struct DcCommonInformation));
 #endif //defined METER_ENABLE
 
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
     //creat Audi customization info
     if ((MeterSMId = shmget(ShmAudiCustInfoKey, sizeof(AudiCustInfo), IPC_CREAT | 0777)) < 0) {
         return FAIL;
@@ -820,7 +926,7 @@ void InitGPIO()
     system("echo \"out\" > /sys/class/gpio/gpio116/direction");
     system("echo 0 > /sys/class/gpio/gpio116/value");
 
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     /* (C14) EMU0.gpio3[7] */  /*CP open/short feature enable/disable, pull low for default enable*/
     system("echo 103 > /sys/class/gpio/export");
     system("echo \"out\" > /sys/class/gpio/gpio103/direction");
@@ -1027,7 +1133,7 @@ int isReachableInternet()
     }
     pclose(fp);
 
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
     if (ShmStatusCodeData->AlarmCode.AlarmEvents.bits.DisconnectedFromDo == NORMAL) {
         result = FAIL;
     } else {
@@ -1063,7 +1169,7 @@ int isReachableInternet()
 void InitEthernet()
 {
     char tmpbuf[256];
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     bool ethResult = false;
     uint8_t cnt_pingDNS_Fail = 0;
 #endif //!defined DD360 && !defined DD360Audi
@@ -1117,7 +1223,7 @@ void InitEthernet()
     if (pid == 0) {
         log_info("InitEthernet = %d\r\n", pid);
         for (;;) {
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
             if (isRouteFail()) {
                 //PRINTF_FUNC("eth0 not in route, restart eht0. \n");
                 system("/sbin/ifconfig eth0 down;/sbin/ifconfig eth0 up");
@@ -1597,7 +1703,7 @@ bool DisplaySelfTestFailReason()
     }
 
     if (ShmSysConfigAndInfo->SysInfo.AcContactorStatus == NO) {
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
         // AC Contact 未搭上
         ShmStatusCodeData->AlarmCode.AlarmEvents.bits.AcContactStestFail = true;
         result = true;
@@ -1650,7 +1756,7 @@ void SelfTestRun()
                     log_info("Relay Board FW Rev = %s", ShmSysConfigAndInfo->SysInfo.RelayModuleFwRev);
                     ShmRelayModuleData->SelfTest_Comp = YES;
                 }
-#ifndef NO_FAN_BOARD
+#if !defined NO_FAN_BOARD && !defined DD360ComBox
                 if ((strlen((char *)ShmSysConfigAndInfo->SysInfo.FanModuleFwRev) != 0 ||
                         ShmSysConfigAndInfo->SysInfo.FanModuleFwRev[0] != '\0')
                         && (ShmFanModuleData->SelfTest_Comp != YES)
@@ -1756,7 +1862,7 @@ void SelfTestRun()
             case _STEST_AC_CONTACTOR: {
                 //ShmPsuData->Work_Step = _TEST_COMPLETE;
                 // 因為 30KW 以下沒有 Relay feedback 功能,所以暫時先直接跳過
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                 if (ShmSysConfigAndInfo->SysInfo.AcContactorStatus == YES) {
                     ShmSysConfigAndInfo->SysInfo.SelfTestSeq = _STEST_PSU_DETECT;
                     log_info("AC contactor self test OK");
@@ -1768,7 +1874,7 @@ void SelfTestRun()
             }
             break;
             case _STEST_PSU_DETECT: {
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                 if (ShmPsuData->Work_Step >= GET_SYS_CAP) {
                     ShmSysConfigAndInfo->SysInfo.SelfTestSeq = _STEST_PSU_CAP;
                 }
@@ -1778,7 +1884,7 @@ void SelfTestRun()
             }
             break;
             case _STEST_PSU_CAP: {
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                 // 此測試是要確認當前總輸出能力
                 // 如果沒有 PSU 模組請 bypass
                 if (ShmPsuData->Work_Step == BOOTING_COMPLETE) {
@@ -1813,7 +1919,7 @@ int SpawnTask()
     system("/root/Module_InternalComm &");
     system("/root/Module_ProduceUtils &");
 
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
     system("/root/DoComm &");
 #else
     system("/root/Module_PsuComm &");
@@ -2398,7 +2504,7 @@ void EmcOccureByString(char *code)
     // 嚴重的急停有以下幾種 : EMC 按鈕、Mainbreak、Dooropen
     // 其錯誤等級為 2
 
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
     //DS60-120 remove
     if (strncmp(code, "012251", 6) == EQUAL ||
             strncmp(code, "012252", 6) == EQUAL ||
@@ -2423,7 +2529,7 @@ void EmcOccureByString(char *code)
                 ChargingAlarmProcess(gun);
             }
         }
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
         StopChargingProcessByString(level);
         InformOcppErrOccur(4);
 #endif //defined DD360 || defined DD360Audi
@@ -2935,19 +3041,19 @@ void CheckGunTypeFromHw()
     for (i = 0; i < 2; i++) {
         switch (tmp[i]) {
         case 0x01:
-            log_info("BD%d(%s) = %s ", i + 1, i == 1 ? "Left" : "Right", "CHAdeMO");
+            log_info("BD%d(%s) = %s ", i + 1, i == 0 ? "Left" : "Right", "CHAdeMO");
             break;
 
         case 0x10:
-            log_info("BD%d(%s) = %s ", i + 1, i == 1 ? "Left" : "Right", "CCS");
+            log_info("BD%d(%s) = %s ", i + 1, i == 0 ? "Left" : "Right", "CCS");
             break;
 
         case 0x11:
-            log_info("BD%d(%s) = %s ", i + 1, i == 1 ? "Left" : "Right", "GBT");
+            log_info("BD%d(%s) = %s ", i + 1, i == 0 ? "Left" : "Right", "GBT");
             break;
 
         case 0x00:
-            log_info("BD%d(%s) = %s ", i + 1, i == 1 ? "Left" : "Right", "None");
+            log_info("BD%d(%s) = %s ", i + 1, i == 0 ? "Left" : "Right", "None");
             break;
         }
     }
@@ -3122,7 +3228,7 @@ void UserScanFunction()
                     } else {
                         _authorizeIndex = ShmSysConfigAndInfo->SysInfo.CurGunSelected;
                     }
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                     StartSystemTimeoutDet(Timeout_AuthorizingForStop);
                     AuthorizingStart();
 #else
@@ -3155,14 +3261,14 @@ void UserScanFunction()
     } else {
         // 透過後臺停止充電的判斷
         if (isAuthorizedComplete()
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                 || (ShmSysConfigAndInfo->SysInfo.OcppConnStatus == NO &&
                     ShmSysConfigAndInfo->SysConfig.OfflinePolicy == _OFFLINE_POLICY_FREE_CHARGING)
 #endif //!defined DD360 && !defined DD360Audi
            ) {
             // 判斷後台回覆狀態
             if (canStartCharging()
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                     || (ShmSysConfigAndInfo->SysInfo.OcppConnStatus == NO &&
                         ShmSysConfigAndInfo->SysConfig.OfflinePolicy == _OFFLINE_POLICY_FREE_CHARGING)
 #endif //!defined DD360 && !defined DD360Audi
@@ -3229,14 +3335,14 @@ void ScannerCardProcess()
 
         // 確認驗證卡號完成沒
         if (isAuthorizedComplete()
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                 || ShmSysConfigAndInfo->SysConfig.OfflinePolicy == _OFFLINE_POLICY_FREE_CHARGING
 #endif //!defined DD360 && !defined DD360Audi
            ) {
             StopSystemTimeoutDet();
             // 判斷後台回覆狀態
             if (canStartCharging()
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                     || ShmSysConfigAndInfo->SysConfig.OfflinePolicy == _OFFLINE_POLICY_FREE_CHARGING
 #endif //!defined DD360 && !defined DD360Audi
                ) {
@@ -3540,7 +3646,7 @@ void KillTask()
     system("killall Module_LcmControl");
     system("killall Module_InternalComm");
     //system("killall DoComm");
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     system("killall Module_PsuComm");
     system("killall OcppBackend &");
     system("killall Module_4g &");
@@ -3553,7 +3659,7 @@ void KillTaskExceptPrimary()
     ChangeLcmByIndex(_LCM_FIX);
     system("killall Module_EvComm");
     system("killall Module_InternalComm");
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     system("killall Module_PsuComm");
     system("killall Module_4g &");
     system("killall Module_Wifi &");
@@ -3568,7 +3674,7 @@ void KillAllTask()
     system("killall Module_EvComm");
     system("killall Module_LcmControl");
     system("killall Module_InternalComm");
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     system("killall Module_PsuComm");
     system("killall OcppBackend &");
     system("killall Module_4g &");
@@ -5421,6 +5527,20 @@ static void powerCabinetPsuAlarmStatus(void)
     }
 }
 
+static void autoStartChargingForComBox(uint8_t gunIndex)
+{
+#if defined DD360ComBox
+    if ((chargingInfo[gunIndex]->ConnectorPlugIn == YES) &&
+            (chargingInfo[gunIndex]->SystemStatus == S_IDLE)
+       ) {
+        ShmSysConfigAndInfo->SysInfo.CurGunSelected = gunIndex;
+        strcpy((char *)&ShmSysConfigAndInfo->SysConfig.UserId, "AutoStartCharging");
+    }
+#else
+    return;
+#endif //DD360ComBox
+}
+
 int main(void)
 {
     uint8_t evBoardStopState = 0;
@@ -5465,6 +5585,7 @@ int main(void)
     }
     CreateTimeoutFork();
     log_info("Start self test... \n");
+    startPrimaryLedIndicatorCtrlFork();
     SelfTestRun();
     StopSystemTimeoutDet();
     log_info("Self test finished : SelfTestSeq = %d, Work_Step = %d ",
@@ -5537,6 +5658,7 @@ int main(void)
     CheckFwSlotStatusLog();
     AdjustChargerCurrent();
     gettimeofday(&_cmdMainPriority_time, NULL);
+
     for (;;) {
         CheckOcppStatus();
         ChkPrimaryStatus();
@@ -5555,7 +5677,7 @@ int main(void)
         ClearAlarmCodeWhenAcOff();
         // 確認是否要回到充電中的槍畫面邏輯判斷
         CheckReturnToChargingConn();
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
         //確認Power cabinet PSU Status
         powerCabinetPsuAlarmStatus();
 #endif // defined DD360 || defined DD360Audi
@@ -5612,6 +5734,8 @@ int main(void)
 #endif //defined METER_ENABLE
 
         for (byte gun_index = 0; gun_index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; gun_index++) {
+            autoStartChargingForComBox(gun_index); //for DD360ComBox
+
             CheckGpioInStatus();
             CheckErrorOccurStatus(gun_index);
             ChkOcppStatus(gun_index);
@@ -5683,7 +5807,7 @@ int main(void)
                     }
 
                     ClearDetectPluginFlag();
-//#if !defined DD360 && !defined DD360Audi
+//#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                     UpdateErrorCodeToOcpp(gun_index);
 //#endif //!defined DD360 && !defined DD360Audi
                     setChargerMode(gun_index, MODE_FAULT);
@@ -5707,7 +5831,7 @@ int main(void)
 #endif //0
 
                     if (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_AVER) {
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                         if (ShmSysConfigAndInfo->SysInfo.AcContactorStatus == YES)
 #else
                         if (1)
@@ -5845,7 +5969,7 @@ int main(void)
                     }
                     StopSystemTimeoutDet();
                 }
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                 bool isRessign = false;
                 if (ShmSysConfigAndInfo->SysConfig.TotalConnectorCount > 1 && ShmSysConfigAndInfo->SysInfo.IsAlternatvieConf == NO) {
                     if (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_MAX) {
@@ -5884,7 +6008,7 @@ int main(void)
 #endif // !defined DD360 && !defined DD360Audi
 
                 if (0) { // if (isRessign)
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
                     setChargerMode(gun_index, MODE_PRECHARGE);
 #else
                     setChargerMode(gun_index, MODE_REASSIGN);
@@ -6136,7 +6260,7 @@ int main(void)
                     ftime(&startChargingTime[gun_index]);
                     strcpy((char *)ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.Status, ""); //DS60-120 add
                     ChangeStartOrStopDateTime(YES, gun_index);
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
                     OcppStartTransation(gun_index);
 #endif //!defined DD360 && !defined DD360Audi
                 }

+ 12 - 9
EVSE/Projects/DD360Audi/Apps/ReModule_EvComm.c

@@ -2578,14 +2578,14 @@ void SetPresentChargingOutputCap(struct ChargingInfoData *chargingData_1, struct
     float pow1 = 0, cur1 = 0;
     float pow2 = 0, cur2 = 0;
 
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     float vol = 0;
 #endif //!defined DD360 && !defined DD360Audi
 
     pow1 = chargingData_1->AvailableChargingPower;
     cur1 = chargingData_1->AvailableChargingCurrent;
 
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     vol = chargingData_1->MaximumChargingVoltage;
     GetMaxVolAndCurMethod(chargingData_1->Index, &vol, &cur1);
     GetMaxPowerMethod(chargingData_1->Index, &pow1);
@@ -2610,7 +2610,7 @@ void SetPresentChargingOutputCap(struct ChargingInfoData *chargingData_1, struct
     pow2 = chargingData_2->AvailableChargingPower;
     cur2 = chargingData_2->AvailableChargingCurrent;
 
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     vol = chargingData_2->MaximumChargingVoltage;
     GetMaxVolAndCurMethod(chargingData_2->Index, &vol, &cur2);
     GetMaxPowerMethod(chargingData_2->Index, &pow2);
@@ -3320,10 +3320,10 @@ int main(int argc, char *argv[])
                 // 計算 Power
                 _chargingData[_index]->PresentChargingPower = ((float)((_chargingData[_index]->PresentChargingVoltage) * (_chargingData[_index]->PresentChargingCurrent)) / 1000);
 
-                CalOutputPowerAndEnergy(_index); //DS60-120 add
+                //CalOutputPowerAndEnergy(_index); //DS60-120 add
 
                 //DS60-120 remove
-                /*if (chargingTime[_index] == 0 ||
+                if (chargingTime[_index] == 0 ||
                         chargingTime[_index] > _chargingData[_index]->PresentChargedDuration) {
                     chargingTime[_index] = _chargingData[_index]->PresentChargedDuration;
                 } else {
@@ -3339,7 +3339,7 @@ int main(int argc, char *argv[])
                         _chargingData[_index]->PowerConsumption += changingPow;
                         chargingTime[_index] = _chargingData[_index]->PresentChargedDuration;
                     }
-                }*/
+                }
 
                 // 開始確認車端是否同意開始充電
                 GetOutputReq(_index, _chargingData[_index]->Evboard_id);
@@ -3361,11 +3361,14 @@ int main(int argc, char *argv[])
                     }
                 }
 
-                if (_chargingData[_index]->GroundFaultStatus == GFD_FAIL) {
-                    SetIsolationStatus(_index, _chargingData[_index]->GroundFaultStatus, _chargingData[_index]->Evboard_id);
-                } else if (_chargingData[_index]->Type == _Type_CCS_2) {
+                if ((_chargingData[_index]->GroundFaultStatus == GFD_FAIL) ||
+                        (_chargingData[_index]->Type == _Type_CCS_2)) {
                     SetIsolationStatus(_index, _chargingData[_index]->GroundFaultStatus, _chargingData[_index]->Evboard_id);
                 }
+                /*
+                else if (_chargingData[_index]->Type == _Type_CCS_2) {
+                SetIsolationStatus(_index, _chargingData[_index]->GroundFaultStatus, _chargingData[_index]->Evboard_id);
+                }*/
 
                 // GFD 失敗再通知
                 if (priorityLow == 1) {

File diff suppressed because it is too large
+ 188 - 176
EVSE/Projects/DD360Audi/Apps/ReModule_InternalComm.c


+ 2 - 2
EVSE/Projects/DD360Audi/Apps/ReModule_LcmControl.c

@@ -339,7 +339,7 @@ void ChangeWarningFunc()
     // 最多一次五筆
     //PRINTF_FUNC("LCM PageIndex = %d \n", ShmSysConfigAndInfo->SysWarningInfo.PageIndex);
     //PRINTF_FUNC("WarningCount = %d \n", ShmSysConfigAndInfo->SysWarningInfo.WarningCount);
-//#if !defined DD360 && !defined DD360Audi
+//#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
     for (i = 0; (i + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 5) < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; i++) {
         memset(cmd, 0x00, sizeof(cmd));
         if ((i) >= 5) {
@@ -927,7 +927,7 @@ void RefreshPageAnimation(byte value)
 void RefreshConnStatus()
 {
     // Wifi priority is higher than Ethernet
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
     uint8_t i = 0;
     uint8_t ehtStatus = 0;
 

+ 147 - 90
EVSE/Projects/DD360Audi/Apps/ReModule_PrimaryComm.c

@@ -37,6 +37,24 @@
 #define YES                 1
 #define NO                  0
 
+typedef struct StChillerInfo {
+    uint8_t ChillerSwitch;
+    uint32_t ChillerOnTime;
+    uint8_t Reserved[3];
+} ChillerInfo;
+
+typedef struct StLedConfig {
+    //OutputDrvValue[0]
+    uint8_t LeftButtonLed: 1;                   //bit 0,    H: ON,      L:OFF
+    uint8_t RightButtonLed: 1;                  //bit 1,    H: ON,      L:OFF
+    uint8_t GreenLED: 1;                          //bit 2,    H: ON,      L:OFF
+    uint8_t YellowLED: 1;                       //bit 3,    H: ON,      L:OFF
+    uint8_t RedLED: 1;                        //bit 4,    H: ON,      L:OFF
+    uint8_t SystemLed4: 1;                      //bit 5,    H: ON,      L:OFF
+    uint8_t AcContactor: 1;                     //bit 6,    H: ON,      L:OFF
+    uint8_t Reserved: 1;                        //bit 7 reserved
+} LedConfig;
+
 typedef unsigned char       byte;
 
 struct SysConfigAndInfo         *ShmSysConfigAndInfo;
@@ -65,17 +83,15 @@ byte _curDeviceStatus[3] = {0, 0, 0}; //DS60-120 add
 byte _reCheckCount[3] = {0, 0, 0}; //DS60-120 add
 struct ChargingInfoData *ChargingData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
 
-#if defined DD360 || defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
 unsigned char ChillerSwitch; //DS60-120 remove
 unsigned int ChillerOnTime; //DS60-120 remove
 #endif //defined DD360 || defined DD360Audi
 
-void PRINTF_FUNC(char *string, ...);
-
 int StoreLogMsg(const char *fmt, ...);
-#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
-#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
-#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#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)
 
 int StoreLogMsg(const char *fmt, ...)
 {
@@ -119,16 +135,6 @@ int DiffTimeb(struct timeb ST, struct timeb ET)
     return (StopTime - StartTime) * 1000 + ET.millitm - ST.millitm;
 }
 
-void PRINTF_FUNC(char *string, ...)
-{
-    va_list args;
-    char buffer[4096];
-    va_start(args, string);
-    vsnprintf(buffer, sizeof(buffer), string, args);
-    va_end(args);
-
-    DEBUG_INFO("%s \n", buffer);
-}
 //=================================
 // Common routine
 //=================================
@@ -244,20 +250,23 @@ int InitShareMemory()
 void GetFwAndHwVersion()
 {
     if (Query_FW_Ver(Uart1Fd, Addr.IoExtend, &ver) == PASS) {
-        //PRINTF_FUNC("Primary FW Rev = %s \n", ver.Version_FW);
+        //log_info("Primary FW Rev = %s \n", ver.Version_FW);
         strcpy((char *)ShmPrimaryMcuData->version, ver.Version_FW);
         strcpy((char *) ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ver.Version_FW);
     }
 
     //if (Query_HW_Ver(Uart1Fd, Addr.IoExtend, &ver) == PASS)
-    //    ;//PRINTF_FUNC("Primary HW Rev  = %s \n", ver.Version_HW);
+    //    ;//log_info("Primary HW Rev  = %s \n", ver.Version_HW);
 }
 
 void GetInputGpioStatus()
 {
-    //PRINTF_FUNC("GetInputGpioStatus \n");
+    uint8_t dispenserSwTmp = 0;
+    static uint8_t dispenserSw = 0;
+
+    //log_info("GetInputGpioStatus \n");
     if (Query_Gpio_Input(Uart1Fd, Addr.IoExtend, &gpio_in) == PASS) {
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
         //DS60-120 add
         if (_curDeviceStatus[_PRIMARY_CHECK_TAG_AC_CONTACT] != gpio_in.AC_Connector) {
             if (_reCheckCount[_PRIMARY_CHECK_TAG_AC_CONTACT] >= 3) {
@@ -300,20 +309,52 @@ void GetInputGpioStatus()
 #endif //!defined DD360 && !defined DD360Audi
 
         ShmPrimaryMcuData->InputDet.bits.SpdDetec = gpio_in.SPD;
-#if defined DD360 ||defined DD360Audi
+#if defined DD360 ||defined DD360Audi || defined DD360ComBox
+
+#if defined DD360ComBox
+        ShmPrimaryMcuData->InputDet.bits.DoorOpen = gpio_in.Door_Open;
+#else
         ShmPrimaryMcuData->InputDet.bits.DoorOpen = ~gpio_in.Door_Open;
+#endif //
 
         ShmPrimaryMcuData->InputDet.bits.Key0 = ~gpio_in.Key[0] & 0x01;
         ShmPrimaryMcuData->InputDet.bits.Key1 = ~gpio_in.Key[1] & 0x01;
         ShmPrimaryMcuData->InputDet.bits.Key2 = ~gpio_in.Key[2] & 0x01;
         ShmPrimaryMcuData->InputDet.bits.Key3 = ~gpio_in.Key[3] & 0x01;
+        //ShmPrimaryMcuData->InputDet.bits.EmergencyButton = gpio_in.Emergency_Btn;
 #else
+
+        ShmPrimaryMcuData->InputDet.bits.Key0 = gpio_in.Key[0] & 0x01;
+        ShmPrimaryMcuData->InputDet.bits.Key1 = gpio_in.Key[1] & 0x01;
+        ShmPrimaryMcuData->InputDet.bits.Key2 = gpio_in.Key[2] & 0x01;
+        ShmPrimaryMcuData->InputDet.bits.Key3 = gpio_in.Key[3] & 0x01;
+        //ShmPrimaryMcuData->InputDet.bits.EmergencyButton = ~gpio_in.Emergency_Btn;
         ShmPrimaryMcuData->InputDet.bits.DoorOpen = gpio_in.Door_Open;
 #endif //defined DD360 ||defined DD360Audi
 
+#if defined DD360ComBox
+        ShmPrimaryMcuData->InputDet.bits.EmergencyButton = ~gpio_in.Emergency_Btn;
+#else
+        ShmPrimaryMcuData->InputDet.bits.EmergencyButton = gpio_in.Emergency_Btn;
+#endif //
+
+        dispenserSwTmp |= (ShmPrimaryMcuData->InputDet.bits.Key0);
+        dispenserSwTmp |= (ShmPrimaryMcuData->InputDet.bits.Key1 << 1);
+        dispenserSwTmp |= (ShmPrimaryMcuData->InputDet.bits.Key2 << 2);
+        dispenserSwTmp |= (ShmPrimaryMcuData->InputDet.bits.Key3 << 3);
+
+        if (dispenserSwTmp != dispenserSw) {
+            dispenserSw = dispenserSwTmp;
+            log_info("Dispenser switch number =  %d, bit = %d, %d, %d, %d\r\n",
+                     dispenserSw,
+                     ShmPrimaryMcuData->InputDet.bits.Key3,
+                     ShmPrimaryMcuData->InputDet.bits.Key2,
+                     ShmPrimaryMcuData->InputDet.bits.Key1,
+                     ShmPrimaryMcuData->InputDet.bits.Key0);
+        }
+
         ShmPrimaryMcuData->InputDet.bits.Button1 = gpio_in.Button[0];
         ShmPrimaryMcuData->InputDet.bits.Button2 = gpio_in.Button[1];
-        ShmPrimaryMcuData->InputDet.bits.EmergencyButton = gpio_in.Emergency_Btn;
 
         /*printf(" gpio_in.Key[0]~ gpio_in.Key[3]=%d, %d, %d, %d\n",
         ShmPrimaryMcuData->InputDet.bits.Key0 , ShmPrimaryMcuData->InputDet.bits.Key1,
@@ -321,12 +362,12 @@ void GetInputGpioStatus()
         printf("ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CcsLiquidChillerWaterLevelWarning=%d\n", ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CcsLiquidChillerWaterLevelWarning);
         printf("ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsLiquidChillerWaterLevelFault=%d\n", ShmStatusCodeData->FaultCode.FaultEvents.bits.CcsLiquidChillerWaterLevelFault);
         */
-        //PRINTF_FUNC("left = %d \n", ShmPrimaryMcuData->InputDet.bits.Button1);
-        //PRINTF_FUNC("right = %d \n", ShmPrimaryMcuData->InputDet.bits.Button2);
-        //PRINTF_FUNC("ShmSysConfigAndInfo->SysInfo.AcContactorStatus = %d \n", ShmSysConfigAndInfo->SysInfo.AcContactorStatus);
-#if !defined DD360 && !defined DD360Audi
+        //log_info("left = %d \n", ShmPrimaryMcuData->InputDet.bits.Button1);
+        //log_info("right = %d \n", ShmPrimaryMcuData->InputDet.bits.Button2);
+        //log_info("ShmSysConfigAndInfo->SysInfo.AcContactorStatus = %d \n", ShmSysConfigAndInfo->SysInfo.AcContactorStatus);
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
         if (ShmPrimaryMcuData->InputDet.bits.AcMainBreakerDetec == YES) {
-            DEBUG_ERROR("AC Mainbreaker occur. \n");
+            log_error("AC Mainbreaker occur. \n");
         }
 #endif //!defined DD360 && !defined DD360Audi
     }
@@ -374,51 +415,86 @@ void GetMeterConsumption(byte index)
 }
 #endif //defined METER_ENABLE
 
-void SetOutputGpio(byte flash)
+static void checkChillerStatus(Gpio_out *gpio)
 {
-    Gpio_out gpio;
-    gpio.Button_LED[0] = flash;
-    gpio.Button_LED[1] = flash;
+    uint8_t gunIndex = 0;
+    uint8_t chillerCount = 0;
+    static ChillerInfo fChillerInfo[2] = {0};
+    Gpio_out *pGpio = (Gpio_out *)gpio;
+
+    if ((strncmp((char *)&ShmSysConfigAndInfo->SysConfig.ModelName[7], "V", 1) == 0) ||
+            (strncmp((char *)&ShmSysConfigAndInfo->SysConfig.ModelName[7], "F", 1) == 0)) {
+        chillerCount++;
+    }
 
-    gpio.System_LED[0] = 0x00;
-    gpio.System_LED[1] = 0x00;
-    gpio.System_LED[2] = 0x00;
-    gpio.System_LED[3] = 0x00;
+    if ((strncmp((char *)&ShmSysConfigAndInfo->SysConfig.ModelName[9], "V", 1) == 0) ||
+            (strncmp((char *)&ShmSysConfigAndInfo->SysConfig.ModelName[9], "F", 1) == 0)) {
+        chillerCount++;
+    }
 
-#if defined DD360 || defined DD360Audi
-    if ((ChargingData[0]->PresentChargingCurrent) >= 150) {
-        ChillerSwitch = 1;
-        ChillerOnTime = time((time_t *)NULL);
-    } else {
-        if (ChillerSwitch == 1) {
-            if ((ChargingData[0]->PresentChargingCurrent) >= 100) {
-                ChillerSwitch = 1;
-                ChillerOnTime = time((time_t *)NULL);
-            } else {
-                if ((time((time_t *)NULL) - ChillerOnTime) >= 600) {
-                    ChillerSwitch = 0;
+    if (chillerCount == 0) {
+        pGpio->AC_Connector = 0x00;
+        return;
+    }
+
+    for (gunIndex = 0; gunIndex < chillerCount; gunIndex++) {
+        if ((ChargingData[gunIndex]->PresentChargingCurrent) >= 150) {
+            fChillerInfo[gunIndex].ChillerSwitch = YES;
+            fChillerInfo[gunIndex].ChillerOnTime = time((time_t *)NULL);
+        } else {
+            if (fChillerInfo[gunIndex].ChillerSwitch == YES) {
+                if ((ChargingData[gunIndex]->PresentChargingCurrent) >= 100) {
+                    fChillerInfo[gunIndex].ChillerSwitch = YES;
+                    fChillerInfo[gunIndex].ChillerOnTime = time((time_t *)NULL);
                 } else {
-                    ChillerSwitch = 1;
+                    if ((time((time_t *)NULL) - fChillerInfo[gunIndex].ChillerOnTime) >= 600) {
+                        fChillerInfo[gunIndex].ChillerSwitch = NO;
+                    } else {
+                        fChillerInfo[gunIndex].ChillerSwitch = YES;
+                    }
                 }
+            } else {
+                fChillerInfo[gunIndex].ChillerSwitch = NO;
             }
-        } else {
-            ChillerSwitch = 0;
         }
     }
-    gpio.AC_Connector = ChillerSwitch;//Chiller ON/OFF Control, "0: Chiller disable, 1: Chiller enable"
 
-    //printf("ChargingData[0]->PresentChargingCurrent=%f,ChargingData[1]->PresentChargingCurrent=%f,ChillerSwitch=%d\n",ChargingData[0]->PresentChargingCurrent,ChargingData[1]->PresentChargingCurrent,ChillerSwitch);
-#else
-    gpio.AC_Connector = 0x00;
-#endif //defined DD360 || DD360Audi
+    pGpio->AC_Connector = fChillerInfo[gunIndex].ChillerSwitch;//Chiller ON/OFF Control, "0: Chiller disable, 1: Chiller enable"
+}
 
-    gpio.AC_Breaker = 0x00;
+void SetOutputGpio(uint8_t outputValue)
+{
+    Gpio_out gpio;
+    LedConfig *pLedConfig = (LedConfig *)&outputValue;
 
-    if (Config_Gpio_Output(Uart1Fd, Addr.IoExtend, &gpio) == PASS) {
-        //PRINTF_FUNC("SetOutputGpio sucessfully. %d \n", flash);
+    if (strcmp((char *)ShmSysConfigAndInfo->SysInfo.LcmHwRev, " ") == 0x00) {
+        if (flash == NO) {
+            flash = YES;
+        } else {
+            flash = NO;
+        }
     } else {
-        //PRINTF_FUNC("SetOutputGpio fail. \n");
+        if (flash == NO) {
+            flash = YES;
+        }
     }
+
+    pLedConfig->LeftButtonLed = flash;
+    pLedConfig->RightButtonLed = flash;
+
+    gpio.Button_LED[0] = pLedConfig->LeftButtonLed;
+    gpio.Button_LED[1] = pLedConfig->RightButtonLed;
+
+    gpio.System_LED[0] = pLedConfig->GreenLED;
+    gpio.System_LED[1] = pLedConfig->YellowLED;
+    gpio.System_LED[2] = pLedConfig->RedLED;
+    gpio.System_LED[3] = 0x00;
+
+    checkChillerStatus(&gpio);
+
+    gpio.AC_Breaker = 0x00;
+
+    Config_Gpio_Output(Uart1Fd, Addr.IoExtend, &gpio);
 }
 
 void SetRtcData()
@@ -428,7 +504,7 @@ void SetRtcData()
 
     ftime(&csuTime);
     tmCSU = localtime(&csuTime.time);
-//  PRINTF_FUNC("Time : %04d-%02d-%02d %02d:%02d:%02d \n", tmCSU->tm_year + 1900,
+//  log_info("Time : %04d-%02d-%02d %02d:%02d:%02d \n", tmCSU->tm_year + 1900,
 //          tmCSU->tm_mon + 1, tmCSU->tm_mday, tmCSU->tm_hour, tmCSU->tm_min,
 //          tmCSU->tm_sec);
 
@@ -453,9 +529,9 @@ void SetRtcData()
     rtc.RtcData[13] = '0' + (tmCSU->tm_sec) / 1 % 10;
 
     if (Config_Rtc_Data(Uart1Fd, Addr.IoExtend, &rtc) == PASS) {
-        //PRINTF_FUNC("SetRtc sucessfully. \n");
+        //log_info("SetRtc sucessfully. \n");
     } else {
-        //PRINTF_FUNC("SetRtc fail. \n");
+        //log_info("SetRtc fail. \n");
     }
 }
 
@@ -476,7 +552,7 @@ int InitComPort()
     fd = open(priPortName, O_RDWR);
     if (fd <= 0) {
 #ifdef SystemLogMessage
-        DEBUG_ERROR("open 407 Communication port NG \n");
+        log_error("open 407 Communication port NG \n");
 #endif
         return -1;
     }
@@ -535,7 +611,7 @@ void Initialization() //DS60-120 add
         isPass = true;
         for (byte _index = 0; _index < gun_count; _index++) {
             if (!FindChargingInfoData(_index, &ChargingData[0])) {
-                DEBUG_ERROR("EvComm (main) : FindChargingInfoData false \n");
+                log_error("EvComm (main) : FindChargingInfoData false \n");
                 isPass = false;
                 break;
             }
@@ -547,7 +623,7 @@ void Initialization() //DS60-120 add
 int main(void)
 {
     if (InitShareMemory() == FAIL) {
-        DEBUG_ERROR("InitShareMemory NG\r\n");
+        log_error("InitShareMemory NG\r\n");
         if (ShmStatusCodeData != NULL) {
             ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory = 1;
         }
@@ -558,17 +634,17 @@ int main(void)
     //DS60-120 remove
     //for (byte _index = 0; _index < ShmSysConfigAndInfo->SysConfig.TotalConnectorCount; _index++) {
     //    if (!FindChargingInfoData(_index, &ChargingData[0])) {
-    //        DEBUG_ERROR("FindChargingInfoData false \n");
+    //        log_error("FindChargingInfoData false \n");
     //        break;
     //    }
     //}
     ChillerSwitch = 0;
     Uart1Fd = InitComPort();
-    //PRINTF_FUNC("407 Port id = %d \n", Uart1Fd);
+    //log_info("407 Port id = %d \n", Uart1Fd);
 
     if (Uart1Fd < 0) {
 #ifdef SystemLogMessage
-        DEBUG_ERROR("InitComPort (Uart1 : AM3352 - STM32) NG");
+        log_error("InitComPort (Uart1 : AM3352 - STM32) NG");
 #endif
         if (ShmStatusCodeData != NULL) {
             ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed = 1;
@@ -586,35 +662,16 @@ int main(void)
     byte _count = 0;
 
     for (;;) {
-        if (strcmp((char *)ShmSysConfigAndInfo->SysInfo.LcmHwRev, " ") == 0x00) {
-            if ((GetTimeoutValue(_flash_time) / 1000) > 1000) {
-                if (flash == NO) {
-                    flash = YES;
-                } else {
-                    flash = NO;
-                }
-                SetOutputGpio(flash);
-                gettimeofday(&_flash_time, NULL);
-            }
-        } else {
-            if ((GetTimeoutValue(_flash_time) / 1000) > 5000) {
-                if (flash == NO) {
-                    flash = YES;
-                }
-
-                SetOutputGpio(flash);
-                gettimeofday(&_flash_time, NULL);
-            }
-        }
-
         // 程序開始之前~ 必須先確定 FW 版本與硬體版本,確認後!!~ 該模組才算是真正的 Initial Comp.
         // 模組更新 FW 後,需重新做
         if (ShmPrimaryMcuData->SelfTest_Comp != PASS) {
-            //PRINTF_FUNC("(407) Get Fw and Hw Ver. \n");
+            //log_info("(407) Get Fw and Hw Ver. \n");
             GetFwAndHwVersion();
             sleep(1);
             ShmPrimaryMcuData->SelfTest_Comp = PASS;
         } else {
+            SetOutputGpio(ShmPrimaryMcuData->OutputDrv.OutputDrvValue[0]);
+
             GetInputGpioStatus();
 
 #if defined METER_ENABLE //DS60-120 add

+ 1 - 1
EVSE/Projects/DD360Audi/Apps/internalComm.c

@@ -38,7 +38,7 @@
 #define PASS                1
 #define FAIL                -1
 
-#if !defined DD360 && !defined DD360Audi
+#if !defined DD360 && !defined DD360Audi && !defined DD360ComBox
 struct Address Addr = {0x01, 0x02, 0x03, 0x05, 0x06, 0xFF};
 #else
 struct Address Addr = {0x01, 0x02, 0x09, 0x05, 0x06, 0xFF};

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


BIN
EVSE/Projects/DD360Audi/output/FactoryConfig


BIN
EVSE/Projects/DD360Audi/output/Module_EvComm


BIN
EVSE/Projects/DD360Audi/output/Module_InternalComm


BIN
EVSE/Projects/DD360Audi/output/Module_PrimaryComm


BIN
EVSE/Projects/DD360Audi/output/main


+ 2 - 1
EVSE/Projects/DD360ComBox/Apps/ReModule_EvComm.c

@@ -1935,7 +1935,8 @@ bool AbnormalStopAnalysis(byte gun_index, byte *errCode)
     //        strncmp((char *)_chargingData[gun_index]->EvConnAlarmCode, "", 6) != EQUAL) {
     //    return;
     //}
-    if (strncmp(string, "000000", 6) == EQUAL) {
+    if (strncmp(string, "000000", 6) == EQUAL ||
+            strncmp(string, "023979", 6) == EQUAL) {
         return false;
     }
 

Some files were not shown because too many files changed in this diff