Ver código fonte

2022-01-27 / Wendell

Actions
1. [mod] synchronize plug in state with dispenser state
2. [mod] extend power capability logic
3. [mod] mics control logic
4. [mod] currency update logic
5. [mod] decrease time of wait for preparing to 1s
6. [mod] decrease time of check cost interval to 1s
7. [add] remote start without connector id
8. [add] weather, station location
9. [add] led ligth bar intensity
10.[add] execute ocpp task according to ocpp version
11.[add] support default price, user price, running cost, final cost parsing logic for phihong standard
12.[add] support CDFA
13.[fix] user price logic

Files
1. As follow commit history

Image version : V1.09.XX.XXXX.XX
Wendell 3 anos atrás
pai
commit
c0633a7f54

+ 21 - 0
EVSE/Projects/DO360/Apps/Common.c

@@ -11,6 +11,7 @@
 #include <stdarg.h>
 #include <time.h>
 #include <sys/timeb.h>
+#include "Common.h"
 
 int StoreSysLogMsg(const char *fmt, ...)
 {
@@ -188,3 +189,23 @@ void getNowDatetime(unsigned char *data)
     sprintf((char*)data, "%04d-%02d-%02dT%02d:%02d:%02dZ", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
 }
 
+int IsModelNameMatch_ForUpdate(char *model_1, char *model_2)
+{
+    if(strlen(model_1) < MODELNAME_LENGTH || strlen(model_2) < MODELNAME_LENGTH)
+    {
+        return NO;
+    }
+
+    if(model_1[0] == model_2[0] &&
+        model_1[1] == model_2[1] &&
+        model_1[7] == model_2[7] &&
+        model_1[8] == model_2[8] &&
+        model_1[9] == model_2[9] &&
+        model_1[11] == model_2[11] &&
+        model_1[12] == model_2[12] &&
+        model_1[13] == model_2[13])
+    {
+        return YES;
+    }
+    return NO;
+}

+ 4 - 0
EVSE/Projects/DO360/Apps/Common.h

@@ -23,6 +23,8 @@
 #define ABNORMAL                    1
 #define EQUAL                       0
 
+#define MODELNAME_LENGTH            14
+
 #define LOG_INFO(format, args...) StoreSysLogMsg("[%s:%4d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
 #define LOG_WARN(format, args...) StoreSysLogMsg("[%s:%4d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
 #define LOG_ERROR(format, args...) StoreSysLogMsg("[%s:%4d][%s][Erro] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
@@ -44,4 +46,6 @@ unsigned long GetSecTimeoutValue(struct timespec _start_time);
 int StatusCodeCompose(char *oriCode, char *newCode);
 void getNowDatetime(unsigned char *data);
 
+int IsModelNameMatch_ForUpdate(char *model_1, char *model_2);
+
 #endif /* COMMON_H_ */

+ 215 - 1
EVSE/Projects/DO360/Apps/Config.h

@@ -287,6 +287,12 @@ enum _ETHERNET_USAGE
 #define STR_MEDIUM                  "Medium"
 #define STR_BRIGHTEST               "Brightest"
 
+#define STR_PAGE_NONE               "PageNone"
+#define STR_REMOTE_NO_ID            "PlugInPage"
+#define STR_REFUND_AMOUNT           "RefundAmount"
+#define STR_PREPAYMENT              "Prepayment"
+#define STR_PAYMENT_FAIL            "PaymentFail"
+
 enum _CONN_STATUS
 {
     _Connnection_Disable = 0,
@@ -512,6 +518,19 @@ typedef union
     }bits;
 }PsuControl;
 
+typedef union
+{
+    unsigned int CtrlValue;
+    struct
+    {
+        unsigned int RemoteStartNoId:1;             // 0: no effect,                1: trigger remote start without connector id
+        unsigned int RefundAmount:1;                // 0: no effect,                1: trigger refund amount
+        unsigned int PrepaymentInfo:1;              // 0: no effect,                1: trigger prepayment info
+        unsigned int PaymentFail:1;                 // 0: no effect,                1: trigger payment fail
+        unsigned int res:25;
+    }bits;
+}OcppControl;
+
 typedef struct
 {
     int TxCnt;
@@ -530,6 +549,26 @@ typedef struct
     DevideCommInfo PsuComm;
 }CommInfoData;
 
+typedef union
+{
+    unsigned int CtrlValue;
+    struct
+    {
+        unsigned int UpdateReq:1;                   // 0: no effect,                1: update request
+        unsigned int UpdateConfirm:1;               // 0: no effect,                1: update confirm
+        unsigned int UpdateDone:1;                  // 0: no effect,                1: update done
+        unsigned int res:29;
+    }bits;
+}UpdateControl;
+
+typedef struct
+{
+    int Pri232Fd;
+    int Rs422Fd;
+    int PsuCanFd;
+    int EvCanFd;
+}FdControl;
+
 typedef struct
 {
     unsigned char   MaxDispenser;
@@ -541,6 +580,7 @@ typedef struct
     unsigned short  ChargerRatingPower;             // unit: 0.1kw, charger rating power, parsing from model name
     CommInfoData    CommInfo;
     SystemControl   SysCtrl;
+    UpdateControl   UpdateCtrl;
     TestControl     TestCtrl;
     DebugControl    DebugCtrl;
     PrimaryControl  PrimaryCtrl;
@@ -548,9 +588,12 @@ typedef struct
     FanControl      FanCtrl;
     LedFanControl   LedCtrl;
     PsuControl      PsuCtrl;
+    OcppControl     OcppCtrl;
+    FdControl       FdCtrl;
     ForceCharging   FCharging[MAX_GROUP_QUANTITY];
     unsigned char   GunAvailable[MAX_GROUP_QUANTITY];
     unsigned char   PsuInitQuantity[MAX_GROUP_QUANTITY];
+    char            ResevedIdTag[MAX_GROUP_QUANTITY][32];
 }SysControl;
 // ************************************************************************************************* //
 typedef struct
@@ -834,13 +877,178 @@ typedef struct
     unsigned char               SCabinetID;
     unsigned char               SOutputRelay[MAX_GROUP_QUANTITY];       // parallel cabinet output relay state
     unsigned char               SParallelRelay[MAX_GROUP_QUANTITY];     // parallel cabinet parallel relay state
-    unsigned char               SAcContactor;                       // slave cabinet ac contactor state
+    unsigned char               SAcContactor;                           // slave cabinet ac contactor state
     unsigned char               NeedUpgrade;                            // 1: Need Upgrade, 2: No Update
     unsigned char               UpgradeState;                           // 0: Not in Update,    1: Updating,    2: Updated
     unsigned char               res;
     char                        FwFileName[128];
 }SlaveCabinetControl;
+// ************************************************************************************************* //
+#define LCM_REQ_REMOTE_START_NO_ID          0x00000001
+#define LCM_REQ_REFUND_AMOUNT               0x00000002
+#define LCM_REQ_PREPAYMENT                  0x00000004
+#define LCM_REQ_PAYMENT_FAIL                0x00000008
+
+typedef union
+{
+    unsigned int CtrlValue;
+    struct
+    {
+        // cabinet -> connector
+        unsigned int RemoteStartNoID:1;                 // 0: no request,  1: lcm page change to RemoteStartNoID
+        unsigned int RefundAmount:1;                    // 0: no request,  1: lcm page change to RefundAmount
+        unsigned int PrepaymentInfo:1;                  // 0: no request,  1: lcm page change to PrepaymentInfo
+        unsigned int PaymentFail:1;                     // 0: no request,  1: lcm page change to PaymentFail
+        unsigned int res:28;
+    }bits;
+}ConnectorPageControl;
+
+#define MISC_DISP_CONNECTION_TIMEOUT        0x00000001
+#define MISC_DISP_DEFAULT_PRICE             0x00000002
+#define MISC_DISP_CURRENCY                  0x00000004
+#define MISC_DISP_BACKEND_STATUS            0x00000008
+#define MISC_DISP_ETHERNET_STATUS           0x00000010
+#define MISC_DISP_WIFI_STATUS               0x00000020
+#define MISC_DISP_TELCOM_MODEM_STATUS       0x00000040
+#define MISC_DISP_BILLING_STATUS            0x00000080
+#define MISC_DISP_STOP_BUTTON_STATUS        0x00000100
+#define MISC_DISP_AUTH_MODE_CONFIG          0x00000200
+#define MISC_DISP_EVCCID_CONFIG             0x00000400
+#define MISC_DISP_LED_INTENSITY             0x00000800
+#define MISC_DISP_HARDWARE_REBOOT           0x00001000
+#define MISC_DISP_SOFTWARE_RESET            0x00002000
+#define MISC_DISP_CHANGE_LCM_INFO           0x00004000
+#define MISC_DISP_STATION_INFO              0x00008000
+
+typedef union
+{
+    unsigned int CtrlValue;
+    struct
+    {
+        // cabinet -> dispenser
+        unsigned int ConnectionTimeout:1;               // msic: 0x0001,    0: no request,  1: connection timeout request
+        unsigned int DefaultPrice:1;                    // msic: 0x0003,    0: no request,  1: default price request
+        unsigned int Currency:1;                        // msic: 0x0004,    0: no request,  1: currency request
+        unsigned int BackendStatus:1;                   // msic: 0x0006,    0: no request,  1: backend status request
+        unsigned int EthernetStatus:1;                  // msic: 0x0007,    0: no request,  1: ethernet status request
+        unsigned int WiFiStatus:1;                      // msic: 0x0008,    0: no request,  1: wifi status request
+        unsigned int TelcomModemStatus:1;               // msic: 0x0009,    0: no request,  1: telcom modem status request
+        unsigned int BillingStatus:1;                   // msic: 0x000A,    0: no request,  1: billing status request
+        unsigned int StopButtonStatus:1;                // msic: 0x000B,    0: no request,  1: stop button status request
+        unsigned int AuthModeConfig:1;                  // msic: 0x000C,    0: no request,  1: auth mode config request
+        unsigned int EVCCIDConfig:1;                    // msic: 0x000D,    0: no request,  1: EVCCID config request
+        unsigned int LEDIntensity:1;                    // msic: 0x000E,    0: no request,  1: led intensity request
+        unsigned int HardwareReboot:1;                  // msic: 0x0101,    0: no request,  1: hardware reboot request
+        unsigned int SoftwareReset:1;                   // msic: 0x0102,    0: no request,  1: software reset request
+        unsigned int ChangeLcmInfo:1;                   // msic: 0x0107,    0: no request,  1: change lcm info request
+        unsigned int ChargerStationInfo:1;              // msic: 0x0109,    0: no request,  1: charger station info request
+        unsigned int res:16;
+    }bits;
+}DispenserMiscControl;
+
+#define MISC_CONN_AVAILABILITY              0x00000001
+#define MISC_CONN_ACCOUNT_BALANCE           0x00000002
+#define MISC_CONN_REMOTE_START              0x00000004
+#define MISC_CONN_REMOTE_STOP               0x00000008
+#define MISC_CONN_UNLOCK                    0x00000010
+#define MISC_CONN_RESERVATION               0x00000020
+#define MISC_CONN_QRCODE_INFO               0x00000040
+
+typedef union
+{
+    unsigned int CtrlValue;
+    struct
+    {
+        // cabinet -> connector
+        unsigned int Availability:1;                    // msic: 0x0002,    0: no request,  1: availability request
+        unsigned int AccountBalance:1;                  // msic: 0x0005,    0: no request,  1: account balance request
+        unsigned int RemoteStart:1;                     // msic: 0x0103,    0: no request,  1: remote start request
+        unsigned int RemoteStop:1;                      // msic: 0x0104,    0: no request,  1: remote stop request
+        unsigned int Unlock:1;                          // msic: 0x0105,    0: no request,  1: unlock request
+        unsigned int Reservation:1;                     // msic: 0x0106,    0: no request,  1: reservation request
+        unsigned int QRCodeRequest:1;                   // msic: 0x0108,    0: no request,  1: QR Code request
+        unsigned int res:25;
+    }bits;
+}ConnectorMiscControl;
 
+typedef struct
+{
+    unsigned int ConnectionTimeout;             // unit: 1s
+    unsigned int DefaultPrice;                  // unit: 0.01 (dollar/kWh)
+    unsigned int Currency;                      // currency index
+    unsigned int BackendStatus;                 // 0: disable, 1: connected, 2: disconnected
+    unsigned int EthernetStatus;                // 0: disable, 1: connected, 2: disconnected
+    unsigned int WiFiStatus;                    // 0: disable, 1: connected, 2: disconnected
+    unsigned int TelcomModemStatus;             // 0: disable, 1: connected, 2: disconnected
+    unsigned int BillingStatus;                 // 0: disable, 1: enable
+    unsigned int StopChargingButton;            // 0: disable, 1: enable
+    unsigned int HardwareReboot;                // 1: HardwareReboot, Other value: no effect
+    unsigned int SoftwareRestart;               // 1: SoftwareRestart, Other value: no effect
+    unsigned int AuthModeConfig;                // 0: enable,  1: disable
+    unsigned int EVCCIDConfig;                  // 0: disable, 1: enable
+    unsigned int LEDIntensity;                  // LED intensity, 0: Darkest  1: Medium   2: Brightest
+}MiscCommandValue;
+
+typedef union
+{
+    unsigned int CtrlValue;
+    struct
+    {
+        // cabinet -> dispenser
+        unsigned int RefundRequest:1;                   // cmd: 0x0001,     0: no request,  1: refund request
+        unsigned int RefundCancel:1;                    // cmd: 0x0002,     0: no request,  1: refund cancel
+        unsigned int InvoiceRequest:1;                  // cmd: 0x0003,     0: no request,  1: currency request
+        unsigned int res:29;
+    }bits;
+}ConnectorActionFlag;
+
+typedef union
+{
+    unsigned int CtrlValue[32];
+    struct
+    {
+        // cabinet -> dispenser
+        unsigned int Refund;                            // 1: request,      other: no effect
+        unsigned int RefundCancel;                      // 1: cancel,       other: no effect
+        unsigned int InvoiceIndex;                      // invoice index, start from 1 ~
+        unsigned int Res[29];
+    }bits;
+}ConnectorActionValue;
+
+typedef struct
+{
+    ConnectorActionFlag Flag;
+    ConnectorActionValue ActionValue;
+}ConnectorActionRequest;
+
+#define STR_WEATHER_NONE            "None"
+#define STR_WEATHER_SUNNY           "Sunny"
+#define STR_WEATHER_CLOUDY          "Cloudy"
+#define STR_WEATHER_RAIN            "Rain"
+#define STR_WEATHER_THUNDERSTORM    "ThunderStorm"
+#define STR_WEATHER_SNOW            "Snow"
+#define STR_WEATHER_MIST            "Mist"
+
+enum _WEATHER_INFO
+{
+    _WEATHER_None               = 0,
+    _WEATHER_Sunny              = 1,
+    _WEATHER_Cloudy             = 2,
+    _WEATHER_Rain               = 3,
+    _WEATHER_ThunderStorm       = 4,
+    _WEATHER_Snow               = 5,
+    _WEATHER_Mist               = 6,
+};
+
+typedef struct
+{
+    char StationName[64];
+    char StationID[16];
+    char ConnectorID[MAX_GROUP_QUANTITY][16];
+    char QRCode[MAX_GROUP_QUANTITY][128];
+    int WeatherID;
+    float Temperature;
+}StationInfoData;
 // ************************************************************************************************* //
 
 typedef struct
@@ -852,6 +1060,12 @@ typedef struct
     SocketConnInfoData CabinetConnInfo[MAX_SLAVE_CABINET_QUANTITY];
     ParallelCabinetInfoData ParallelCabinet;
     SlaveCabinetControl SCabinetControl;
+    ConnectorPageControl ConnectorPageReq[MAX_GROUP_QUANTITY];
+    DispenserMiscControl DispenserMiscReq[MAX_GROUP_QUANTITY];
+    ConnectorMiscControl ConnectorMiscReq[MAX_GROUP_QUANTITY];
+    MiscCommandValue CabinetMiscValue;
+    ConnectorActionRequest ConnectorActReq[MAX_GROUP_QUANTITY];
+    StationInfoData StationInfo;
 }ChargerInfoData;
 
 #endif /* CONFIG_H_ */

+ 7 - 7
EVSE/Projects/DO360/Apps/FactoryConfig.c

@@ -248,14 +248,14 @@ int main(int argc,char *argv[])
 	strcpy((char *) SysConfig.OcppServerURL, "");
 	strcpy((char *) SysConfig.ChargeBoxId, "");
 
-	if(SysConfig.ModelName[12] == 'P' && SysConfig.ModelName[13] == 'H')
-	{
-	    strcpy((char *) SysConfig.MaintainServerURL, "wss://ocpp.phihong.com.tw:2013/");
-	}
-	else
-	{
+	//if(SysConfig.ModelName[12] == 'P' && SysConfig.ModelName[13] == 'H')
+	//{
+	//    strcpy((char *) SysConfig.MaintainServerURL, "wss://ocpp.phihong.com.tw:2013/");
+	//}
+	//else
+	//{
 	    strcpy((char *) SysConfig.MaintainServerURL, "");
-	}
+	//}
 
 	SysConfig.LedInfo.Intensity = 2;
 

+ 10 - 5
EVSE/Projects/DO360/Apps/Module_Authorize.c

@@ -142,6 +142,11 @@ void InitialConnector(void)
     }
 }
 
+void Set_Connector_MiscCommand(int connector, int misc_cmd)
+{
+    ShmChargerInfo->ConnectorMiscReq[connector].CtrlValue |= misc_cmd;
+}
+
 //===============================================
 // Ocpp Remote Start
 //===============================================
@@ -443,7 +448,7 @@ void AuthTimeoutProcess(void)
             }
 
             timeout = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].AuthInfo.AuthStatus == _AuthResult_Valid ?
-                ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectorTimeout : AUTHORIZE_COMPLETED_TIME;
+                ShmChargerInfo->CabinetMiscValue.ConnectionTimeout : AUTHORIZE_COMPLETED_TIME;
             timeout += AUTH_TIME_OFFSET_TIME;
 
             if(GetTimeoutValue(_GunAuth_Time[index]) / uSEC_VAL >= timeout)
@@ -464,7 +469,7 @@ void AuthTimeoutProcess(void)
             }
 
             timeout = ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[index].AuthInfo.AuthResult == _AuthResult_Valid ?
-                ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectorTimeout : AUTHORIZE_COMPLETED_TIME;
+                ShmChargerInfo->CabinetMiscValue.ConnectionTimeout : AUTHORIZE_COMPLETED_TIME;
             timeout += AUTH_TIME_OFFSET_TIME;
 
             if(GetTimeoutValue(_DispenserAuth_Time[index]) / uSEC_VAL >= timeout)
@@ -533,7 +538,7 @@ int main(void)
                     _autoSelection = true;
                     ShmSysConfigAndInfo->SysInfo.AuthorizedStatus = _AuthorizeStatus_Wait;
                     _keepRun = true;
-                    AUTH_INFO("Dispenser %d AutoSelection Authorize", index + 1);
+                    AUTH_INFO("Dispenser %d AutoSelection Authorize", _dispenser + 1);
                     break;
                 }
                 break;
@@ -676,7 +681,7 @@ int main(void)
                         if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[connector].AuthInfo.AuthType == _AuthType_RemoteStart)
                         {
                             AUTH_INFO("*********** Gun %d RemoteAuthorize %s ***********", connector + 1, _authResult == _AuthResult_Valid ? "OK" : "NG");
-                            ShmSysConfigAndInfo->SysInfo.ConnectorInfo[connector].Parameter.bits.RemoteStartRequest = true;
+                            Set_Connector_MiscCommand(connector, MISC_CONN_REMOTE_START);
                         }
                     }
                     else if(chargingInfo[connector]->SystemStatus == S_RESERVATION && _authResult == _AuthResult_Valid)
@@ -690,7 +695,7 @@ int main(void)
                         if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[connector].AuthInfo.AuthType == _AuthType_RemoteStart)
                         {
                             AUTH_INFO("*********** Gun %d Reserve RemoteAuthorize %s ***********", connector + 1, _authResult == _AuthResult_Valid ? "OK" : "NG");
-                            ShmSysConfigAndInfo->SysInfo.ConnectorInfo[connector].Parameter.bits.RemoteStartRequest = true;
+                            Set_Connector_MiscCommand(connector, MISC_CONN_REMOTE_START);
                         }
                     }
                     else

Diferenças do arquivo suprimidas por serem muito extensas
+ 676 - 93
EVSE/Projects/DO360/Apps/Module_EvComm.c


+ 55 - 2
EVSE/Projects/DO360/Apps/Module_EvComm.h

@@ -77,6 +77,14 @@ enum PAYLOAD_REGISTER
     _Reg_Get_Cabinet_Other_Version  = 0x14,
     _Reg_Get_Psu_Quantity           = 0x15,
     _Reg_Get_Psu_Version            = 0x16,
+    _Reg_Get_Reservation            = 0x17,
+    _Reg_Dispenser_Request          = 0x18,
+    _Reg_RemoteStartNoIDState       = 0x19,
+    _Reg_RefundAmount               = 0x1A,
+    _Reg_PrepaymentInfo             = 0x1B,
+    _Reg_PaymentFailReason          = 0x1C,
+    _Reg_ConnectorQRCode            = 0x1D,
+    _Reg_StationInfo                = 0x1E,
 };
 
 enum Response_Result
@@ -162,6 +170,15 @@ enum ConnectionStatus
     _CNS_DispenserMatched		= 0x02,
 };
 
+enum LcmPage
+{
+    _LCM_None                   = 0x00,
+    _LCM_Page_RemoteStartNoID   = 0x01,
+    _LCM_Page_RefundAmount      = 0x02,
+    _LCM_Page_PrepaymentInfo    = 0x03,
+    _LCM_Page_PaymentFail       = 0x04,
+};
+
 struct MISC_COMMAND
 {
     unsigned short  Command;
@@ -190,9 +207,21 @@ enum MiscCommand
     _MiscCmd_RemoteStart        = 0x0103,
     _MiscCmd_RemoteStop         = 0x0104,
     _MiscCmd_UnlockStop         = 0x0105,
+    _MiscCmd_Reservation        = 0x0106,
+    _MiscCmd_ChangeLcmPage      = 0x0107,
+    _MiscCmd_QRCodeRequest      = 0x0108,
+    _MiscCmd_StationInfo        = 0x0109,
 };
 
-struct ChargingCapabilityResponse
+enum DispenserMisc_Request
+{
+    _DisReq_None                = 0x0000,
+    _DisReq_RefoundRequest      = 0x0001,
+    _DisReq_RefoundCancel       = 0x0002,
+    _DisReq_InvoiceRequest      = 0x0003,
+};
+
+typedef struct
 {
     unsigned char  ResponseResult;          // 1: OK, 2 NG
     unsigned short MaxOuputVoltage;         // unit = 0.1 volt
@@ -202,7 +231,8 @@ struct ChargingCapabilityResponse
     unsigned int   UserPrice;               // unit = 0.01 dollar
     unsigned int   TotalCost;               // unit = 0.01 dollar
     int            AccountBalance;          // unit = 0.01 dollar
-};
+    int            CostDiscount;            // unit = 0.01 dollar
+}ChargingCapabilityResponseInfo;
 
 enum WaitPlug
 {
@@ -216,4 +246,27 @@ enum GroundFaultDetection
     _GFD_Enable     = 0x1,
 };
 
+typedef struct
+{
+    char ChargingDate[32];                  // charging date in string format
+    char Prepayment[32];                    // prepayment in string format
+    char ActualCost[32];                    // actual cost in string format
+    char RefundAmount[32];                  // refund amount in string format
+}RefundResponse;
+
+typedef struct
+{
+    unsigned char PaymentType;
+    char TopUp[32];                         // top up in string format
+    char AccountAmount[32];                 // account amount in string format
+    char Prepayment[32];                    // prepayment in string format
+    char Balance[32];                       // balance in string format
+}PrepaymentResponseInfo;
+
+typedef struct
+{
+    unsigned char ReasonIndex;              // index start from 1 ~ 200
+    char Reason[128];                       // reason in string format
+}PaymentFailResponse;
+
 #endif /* MODULE_EVCOMM_H_ */

+ 3 - 3
EVSE/Projects/DO360/Apps/Module_PsuComm.c

@@ -44,7 +44,7 @@
 #define PRECHARGE_OFFSET_VOLTAGE        20          // unit: 0.1V, 2V
 #define PRECHARGE_RANGE_VOLTAGE         50          // unit: 0.1V, 5V
 #define WAIT_PRECHARGE_TIME             10          // unit: second
-#define EXTEND_CAPABILITY_DELAY         60          // unit: second
+#define EXTEND_CAPABILITY_DELAY         30          // unit: second
 #define EXTEND_LOADING                  8000        // unit: 0.01%, 80%
 #define RELEASE_LOADING                 5000        // unit: 0.01%, 50%
 #define RELEASE_LOADING_OFFSET          1000        // unit: 0.01%, 10%
@@ -2312,12 +2312,12 @@ void CheckReleaseOrExtend(unsigned char master)
 {
     if((ShmChargerInfo->Control.TestCtrl.bits.ChargingSimulation ||
         !ShmChargerInfo->Control.FCharging[master].FCtrl.bits.EnableForceCharging) &&
-        ShmPsuGrouping->GroupCollection[master].GroupCtrl.bits.ReachMaxStageCurrent &&
         ShmPsuGrouping->GroupCollection[master].GroupCtrl.RoleCtrl.DeratingCtrlValue == 0 &&
         ShmPsuGrouping->GroupCollection[master].GroupCtrl.RoleCtrl.ExtendCapabilityCtrlValue == 0)
     {
         if(ShmPsuGrouping->GroupCollection[master].Partner.Quantity > 0 &&
-            ShmPsuGrouping->GroupCollection[master].GunLoading < RELEASE_LOADING)
+            ShmPsuGrouping->GroupCollection[master].GunLoading < RELEASE_LOADING &&
+            ShmPsuGrouping->GroupCollection[master].GroupCtrl.bits.ReachMaxStageCurrent)
         {
             MasterReleasePsuGroup(master);
         }

+ 6 - 4
EVSE/Projects/DO360/Apps/ReadCmdline.c

@@ -3194,11 +3194,11 @@ void SetGunCommand(char *v1, char *v2, char *v3)
         {
             case 1:
                 ShmChargerInfo->Control.GunAvailable[gunID - 1] = enable > 0 ? YES : NO;
-                ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gunID - 1].Parameter.bits.AvailabilityRequest = true;
+                ShmChargerInfo->ConnectorMiscReq[gunID - 1].bits.Availability = true;
                 break;
             case 2:
                 _chargingData[gunID - 1]->IsAvailable = enable > 0 ? YES : NO;
-                ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gunID - 1].Parameter.bits.AvailabilityRequest = true;
+                ShmChargerInfo->ConnectorMiscReq[gunID - 1].bits.Availability = true;
                 break;
         }
 
@@ -3423,13 +3423,15 @@ void ShowGunInfo(int gun)
     char *str_gun_type[] = {"CHAdeMO", "  CCS  ", "  GBT  "};
     char acceptId[128];
     Get_Ocpp_TransactionId(gun, acceptId);
-    printf(" Gun %d (%s)   Soc:   %3d %s,  Energy:   %7.1f kWh, IdTag [%16s] Transaction [%s]\r\n",
+    printf(" Gun %d (%s)   Soc:   %3d %s,  Energy:   %7.1f kWh, IdTag [%16s] Transaction [%s], TotalCost: %d.%02d\r\n",
         gun + 1,
         ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun].Enable ? str_gun_type[_chargingData[gun]->Type] : "Disable",
         _chargingData[gun]->EvBatterySoc, "%",
         _chargingData[gun]->PresentChargedEnergy,
         _chargingData[gun]->StartUserId,
-        acceptId);
+        acceptId,
+        (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun].TotalCost / 100),
+        (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[gun].TotalCost % 100));
     //printf(" Gun %d (%s) IdTag [%16s]    Soc:  %3d %s, Energy: %4.1f kWh\r\n",
     //    i + 1,
     //    ShmSysConfigAndInfo->SysInfo.ConnectorInfo[i].Enable ? str_gun_type[_chargingData[i]->Type] : "Disable",

Diferenças do arquivo suprimidas por serem muito extensas
+ 588 - 79
EVSE/Projects/DO360/Apps/main.c


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


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


Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff