|
@@ -2,7 +2,7 @@
|
|
|
* Module_LcmControl.c
|
|
|
*
|
|
|
* Created on : 2020-10-20
|
|
|
- * Update on : 2022-10-13
|
|
|
+ * Update on : 2022-10-18
|
|
|
* Author : Folus Wen, Eason Yang
|
|
|
* Version : V0.31
|
|
|
*
|
|
@@ -136,7 +136,7 @@ int CheckCurrentPageCounter = 0;
|
|
|
//=======================================
|
|
|
// Record version and date
|
|
|
//=======================================
|
|
|
-char *FIRMWARE_UPDATE_IMAGE[3] = {"V0.31", "2022-10-13", "REV.03.00"};
|
|
|
+char *FIRMWARE_UPDATE_IMAGE[3] = {"V0.31", "2022-10-18", "REV.03.00"};
|
|
|
|
|
|
//=======================================
|
|
|
// Common routine
|
|
@@ -634,9 +634,9 @@ void page_charging(uint8_t gun_index, uint8_t system_mode)
|
|
|
{
|
|
|
if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
|
|
|
{
|
|
|
- setRunningCost(gun_index, TOTAL_COST);
|
|
|
setRunningCost(gun_index, SESSION_FEE);
|
|
|
setRunningCost(gun_index, OCCUPANCY_FEE);
|
|
|
+ setRunningCost(gun_index, TOTAL_COST);
|
|
|
}
|
|
|
else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
|
|
|
{
|
|
@@ -1556,6 +1556,7 @@ void setBillingFromBackend(uint8_t gun_index, uint8_t system_mode)
|
|
|
*/
|
|
|
if((strcmp((char*)ShmSysConfigAndInfo->SysConfig.UserId, (char *)ShmOCPP16Data->Cost.SetUserPrice.idToken) == 0) && ((strcmp((char *)ShmOCPP16Data->Cost.SetUserPrice.idToken,"") != 0)))
|
|
|
{
|
|
|
+ setDisplayValue(ICON_PRICE, APPEAR);
|
|
|
setMarqueeControl(MARQUEES_DEFAULT_PRICE, gun_index, SET_USER_PRICE);
|
|
|
}
|
|
|
else
|
|
@@ -1571,9 +1572,9 @@ void setBillingFromBackend(uint8_t gun_index, uint8_t system_mode)
|
|
|
{
|
|
|
if(system_mode == SYS_MODE_IDLE)
|
|
|
{
|
|
|
- setDisplayValue(ICON_PRICE, DISAPPEAR);
|
|
|
setDisplayValue(TEXT_PRICE, DISAPPEAR);
|
|
|
setDisplayValue(TEXT_CURRENCY_UNIT, DISAPPEAR);
|
|
|
+ setDisplayValue(ICON_PRICE, DISAPPEAR);
|
|
|
setDisplayValue2(MARQUEES_DEFAULT_PRICE, DISAPPEAR);
|
|
|
}
|
|
|
else
|
|
@@ -1587,9 +1588,9 @@ void setBillingFromBackend(uint8_t gun_index, uint8_t system_mode)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- setDisplayValue(ICON_PRICE, DISAPPEAR);
|
|
|
setDisplayValue(TEXT_PRICE, DISAPPEAR);
|
|
|
setDisplayValue(TEXT_CURRENCY_UNIT, DISAPPEAR);
|
|
|
+ setDisplayValue(ICON_PRICE, DISAPPEAR);
|
|
|
setDisplayValue2(MARQUEES_DEFAULT_PRICE, DISAPPEAR);
|
|
|
|
|
|
}
|
|
@@ -1603,10 +1604,20 @@ void setBillingFromBackend(uint8_t gun_index, uint8_t system_mode)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- setDisplayValue(ICON_PRICE, DISAPPEAR);
|
|
|
- setDisplayValue(TEXT_PRICE, DISAPPEAR);
|
|
|
- setDisplayValue(TEXT_CURRENCY_UNIT, DISAPPEAR);
|
|
|
- setDisplayValue2(MARQUEES_DEFAULT_PRICE, DISAPPEAR);
|
|
|
+ if(strstr((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemData, "priceTextOffline") > 0)
|
|
|
+ {
|
|
|
+ setDisplayValue(TEXT_PRICE, DISAPPEAR);
|
|
|
+ setDisplayValue(TEXT_CURRENCY_UNIT, DISAPPEAR);
|
|
|
+ setDisplayValue(ICON_PRICE, APPEAR);
|
|
|
+ setMarqueeControl(MARQUEES_DEFAULT_PRICE, gun_index, DEFAULE_PRICE);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ setDisplayValue(TEXT_PRICE, DISAPPEAR);
|
|
|
+ setDisplayValue(TEXT_CURRENCY_UNIT, DISAPPEAR);
|
|
|
+ setDisplayValue(ICON_PRICE, DISAPPEAR);
|
|
|
+ setDisplayValue2(MARQUEES_DEFAULT_PRICE, DISAPPEAR);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2099,7 +2110,7 @@ void setQRCodeReceipt(uint8_t gun_index)
|
|
|
if((strcmp((char *)ShmSysConfigAndInfo->SysConfig.OcppReceiptrURL,"") != 0))
|
|
|
{
|
|
|
// QR CODE RECEIPT FOR CDFA 1.0 STRUCTURE
|
|
|
- memcpy((char*)QR_CODE_CONTENT, (char*)ShmSysConfigAndInfo->SysConfig.OcppReceiptrURL, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.OcppReceiptrURL));
|
|
|
+ memcpy((char*)QR_CODE_CONTENT, (char*)ShmSysConfigAndInfo->SysConfig.OcppReceiptrURL, ARRAY_SIZE(QR_CODE_CONTENT));
|
|
|
TRANSACTION_ID = ShmOCPP16Data->StopTransaction[gun_index].TransactionId;
|
|
|
sprintf((char *)QR_CODE_RECEIPT, "%s%d", QR_CODE_CONTENT,TRANSACTION_ID);
|
|
|
string2ByteArray(QR_CODE_RECEIPT, DISPLAY_DATA);
|
|
@@ -2632,10 +2643,12 @@ void setDefaultValue(uint8_t gun_index, uint8_t system_mode)
|
|
|
case SYS_MODE_CHARGING:
|
|
|
break;
|
|
|
case SYS_MODE_TERMINATING:
|
|
|
+
|
|
|
setDisplayValue(ICON_CHARGING_ANIMATION, CONNECTION_FLASHING_1);
|
|
|
refreshStartTimer(&startTime[gun_index][TMR_IDX_CONNECTION]);
|
|
|
refreshStartTimer(&startTime[gun_index][TMR_IDX_REFRESH_INFO]);
|
|
|
CONNECTION_LEVEL_STATUS = CONNECTION_LEVEL_0;
|
|
|
+
|
|
|
break;
|
|
|
case SYS_MODE_COMPLETE:
|
|
|
break;
|
|
@@ -2680,41 +2693,129 @@ void setTextToEmpty(uint8_t gun_index)
|
|
|
}
|
|
|
|
|
|
//=======================================
|
|
|
-// Setting marquee control
|
|
|
+// SETTING MARQUEE CONTROL
|
|
|
//=======================================
|
|
|
void setMarqueeControl(uint16_t address, uint8_t gun_index, uint8_t type)
|
|
|
{
|
|
|
- uint8_t data[250];
|
|
|
- unsigned char Content[250];
|
|
|
+ uint8_t DISPLAY_DATA[250];
|
|
|
+ uint8_t TEXT_DATA[250];
|
|
|
+ uint8_t priceText[250];
|
|
|
+ uint8_t priceTextOffline[250];
|
|
|
+ json_object *jsonDescription;
|
|
|
|
|
|
- memset(Content, 0xFF, ARRAY_SIZE(Content));
|
|
|
- memset(data, 0xFF, ARRAY_SIZE(data));
|
|
|
+ memset(DISPLAY_DATA, 0xFF, ARRAY_SIZE(DISPLAY_DATA));
|
|
|
+ memset(TEXT_DATA, 0xFF, ARRAY_SIZE(TEXT_DATA));
|
|
|
+ memset(priceText, 0xFF, ARRAY_SIZE(priceText));
|
|
|
+ memset(priceTextOffline, 0xFF, ARRAY_SIZE(priceTextOffline));
|
|
|
|
|
|
switch(type)
|
|
|
{
|
|
|
case DEFAULE_PRICE:
|
|
|
if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
|
|
|
{
|
|
|
- sprintf((char *)Content, "%s", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemData);
|
|
|
- string2ByteArray(Content,data);
|
|
|
- lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, (address+3), data, ARRAY_SIZE(data));
|
|
|
+ if((strstr((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemData, "priceText") > 0) ||
|
|
|
+ (strstr((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemData, "priceTextOffline") > 0))
|
|
|
+ {
|
|
|
+ // MARQUEE CONTROL CDFA 2.0 STRUCTURE
|
|
|
+ double kWhPrice = 0.0;
|
|
|
+ double hourPrice = 0.0;
|
|
|
+ double flatFee = 0.0;
|
|
|
+ jsonDescription = json_tokener_parse((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemData);
|
|
|
+
|
|
|
+ if(!is_error(jsonDescription))
|
|
|
+ {
|
|
|
+ if(json_object_object_get(jsonDescription, "priceText") != NULL)
|
|
|
+ {
|
|
|
+ sprintf((char*)priceText, "%s", json_object_get_string(json_object_object_get(jsonDescription, "priceText")));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(json_object_object_get(jsonDescription, "priceTextOffline") != NULL)
|
|
|
+ {
|
|
|
+ sprintf((char*)priceTextOffline, "%s", json_object_get_string(json_object_object_get(jsonDescription, "priceTextOffline")));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(json_object_object_get(jsonDescription, "chargingPrice") != NULL)
|
|
|
+ {
|
|
|
+ if(json_object_object_get(json_object_object_get(jsonDescription, "chargingPrice"), "kWhPrice") != NULL)
|
|
|
+ {
|
|
|
+ kWhPrice = json_object_get_double(json_object_object_get(json_object_object_get(jsonDescription, "chargingPrice"), "kWhPrice"));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(json_object_object_get(json_object_object_get(jsonDescription, "chargingPrice"), "hourPrice") != NULL)
|
|
|
+ {
|
|
|
+ hourPrice = json_object_get_double(json_object_object_get(json_object_object_get(jsonDescription, "chargingPrice"), "hourPrice"));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(json_object_object_get(json_object_object_get(jsonDescription, "chargingPrice"), "flatFee") != NULL)
|
|
|
+ {
|
|
|
+ flatFee = json_object_get_double(json_object_object_get(json_object_object_get(jsonDescription, "chargingPrice"), "flatFee"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ json_object_put(jsonDescription);
|
|
|
+
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.OcppConnStatus == ON))
|
|
|
+ {
|
|
|
+ if((strcmp((char *)priceText,"") != 0))
|
|
|
+ {
|
|
|
+ sprintf((char *)TEXT_DATA, "%s", (char*)priceText);
|
|
|
+ string2ByteArray(TEXT_DATA, DISPLAY_DATA);
|
|
|
+ lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, (address+3), DISPLAY_DATA, ARRAY_SIZE(DISPLAY_DATA));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if((strcmp((char *)priceTextOffline,"") != 0))
|
|
|
+ {
|
|
|
+ sprintf((char *)TEXT_DATA, "%s", (char*)priceTextOffline);
|
|
|
+ string2ByteArray(TEXT_DATA, DISPLAY_DATA);
|
|
|
+ lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, (address+3), DISPLAY_DATA, ARRAY_SIZE(DISPLAY_DATA));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(kWhPrice != 0)
|
|
|
+ {
|
|
|
+ // Off-line (kWh price)
|
|
|
+ }
|
|
|
+
|
|
|
+ if(hourPrice != 0)
|
|
|
+ {
|
|
|
+ // Off-line (hour price)
|
|
|
+ }
|
|
|
+
|
|
|
+ if(flatFee !=0)
|
|
|
+ {
|
|
|
+ // Off-line (flat fee)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // MARQUEE CONTROL CDFA 1.0 STRUCTURE
|
|
|
+ sprintf((char *)TEXT_DATA, "%s", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemData);
|
|
|
+ string2ByteArray(TEXT_DATA,DISPLAY_DATA);
|
|
|
+ lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, (address+3), DISPLAY_DATA, ARRAY_SIZE(DISPLAY_DATA));
|
|
|
+ }
|
|
|
}
|
|
|
else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
|
|
|
{
|
|
|
// OCPP 2.0.1
|
|
|
}
|
|
|
+ else
|
|
|
+ {}
|
|
|
break;
|
|
|
case SET_USER_PRICE:
|
|
|
if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
|
|
|
{
|
|
|
- sprintf((char *)Content, "%s", (char *)ShmOCPP16Data->Cost.SetUserPrice.price);
|
|
|
- string2ByteArray(Content,data);
|
|
|
- lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, (address+3), data, ARRAY_SIZE(data));
|
|
|
+ sprintf((char *)TEXT_DATA, "%s", (char *)ShmOCPP16Data->Cost.SetUserPrice.price);
|
|
|
+ string2ByteArray(TEXT_DATA,DISPLAY_DATA);
|
|
|
+ lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, (address+3), DISPLAY_DATA, ARRAY_SIZE(DISPLAY_DATA));
|
|
|
}
|
|
|
else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
|
|
|
{
|
|
|
// OCPP 2.0.1
|
|
|
}
|
|
|
+ else
|
|
|
+ {}
|
|
|
break;
|
|
|
case FINAL_COST:
|
|
|
break;
|