Jelajahi Sumber

2020.06.17 / Folus Wen

Actions:
1. EVSE/Projects/define.h LED struct variable modify
2. EVSE/Modularization/ocppfiles/MessageHandler.c handleDataTransferRequest() SetLEDBar content modify.

Files:
1. As follow commit history

Image version: D0.00.XX.XXXX.XX
Image checksum: XXXXXXXX

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
FolusWen 4 tahun lalu
induk
melakukan
9985fd4841
2 mengubah file dengan 17 tambahan dan 11 penghapusan
  1. 12 7
      EVSE/Modularization/ocppfiles/MessageHandler.c
  2. 5 4
      EVSE/Projects/define.h

+ 12 - 7
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -7128,13 +7128,18 @@ int handleDataTransferRequest(char *uuid, char *payload)
 			data = json_tokener_parse(tempdata);
 			if(!is_error(data))
 			{
-				for(uint8_t idx=0;idx<json_object_array_length(data);idx++)
-				{
-					ShmSysConfigAndInfo->SysConfig.LedInfo[json_object_get_int(json_object_object_get(json_object_array_get_idx(data, idx), "Id"))].Intensity = json_object_get_int(json_object_object_get(json_object_array_get_idx(data, idx), "Intensity"));
-					ShmSysConfigAndInfo->SysConfig.LedInfo[json_object_get_int(json_object_object_get(json_object_array_get_idx(data, idx), "Id"))].Red = json_object_get_int(json_object_object_get(json_object_array_get_idx(data, idx), "Red"));
-					ShmSysConfigAndInfo->SysConfig.LedInfo[json_object_get_int(json_object_object_get(json_object_array_get_idx(data, idx), "Id"))].Green = json_object_get_int(json_object_object_get(json_object_array_get_idx(data, idx), "Green"));
-					ShmSysConfigAndInfo->SysConfig.LedInfo[json_object_get_int(json_object_object_get(json_object_array_get_idx(data, idx), "Id"))].Blue = json_object_get_int(json_object_object_get(json_object_array_get_idx(data, idx), "Blue"));
-				}
+				ShmSysConfigAndInfo->SysConfig.LedInfo.Intensity = json_object_get_int(json_object_object_get(data, "Intensity"));
+
+				ShmSysConfigAndInfo->SysConfig.LedInfo.Red[0] = json_object_get_int(json_object_object_get(json_object_object_get(data, "Idle"), "R"));
+				ShmSysConfigAndInfo->SysConfig.LedInfo.Green[0]= json_object_get_int(json_object_object_get(json_object_object_get(data, "Idle"), "G"));
+				ShmSysConfigAndInfo->SysConfig.LedInfo.Blue[0] = json_object_get_int(json_object_object_get(json_object_object_get(data, "Idle"), "B"));
+				ShmSysConfigAndInfo->SysConfig.LedInfo.Red[1] = json_object_get_int(json_object_object_get(json_object_object_get(data, "Charging"), "R"));
+				ShmSysConfigAndInfo->SysConfig.LedInfo.Green[1]= json_object_get_int(json_object_object_get(json_object_object_get(data, "Charging"), "G"));
+				ShmSysConfigAndInfo->SysConfig.LedInfo.Blue[1] = json_object_get_int(json_object_object_get(json_object_object_get(data, "Charging"), "B"));
+				ShmSysConfigAndInfo->SysConfig.LedInfo.Red[2] = json_object_get_int(json_object_object_get(json_object_object_get(data, "Fault"), "R"));
+				ShmSysConfigAndInfo->SysConfig.LedInfo.Green[2]= json_object_get_int(json_object_object_get(json_object_object_get(data, "Fault"), "G"));
+				ShmSysConfigAndInfo->SysConfig.LedInfo.Blue[2] = json_object_get_int(json_object_object_get(json_object_object_get(data, "Fault"), "B"));
+
 				json_object_object_add(response, "status", json_object_new_string("Accepted"));
 			}
 			else

+ 5 - 4
EVSE/Projects/define.h

@@ -309,9 +309,10 @@ struct BillingConfigData
 struct LED
 {
 	unsigned char 			Intensity;					// LED bar intensity	0: Darkest	1: Medium	2: Brightest
-	unsigned char			Red;						// Red color	0~100
-	unsigned char			Green;						// Green color	0~100
-	unsigned char			Blue;						// Blue color	0~100
+
+	unsigned char			Red[3];						// Red color	0~100, element 0: IDLE		1: CHARGING		2: FAULT
+	unsigned char			Green[3];					// Green color	0~100, element 0: IDLE		1: CHARGING		2: FAULT
+	unsigned char			Blue[3];					// Blue color	0~100, element 0: IDLE		1: CHARGING		2: FAULT
 };
 
 struct SysConfigData
@@ -370,7 +371,7 @@ struct SysConfigData
 	unsigned char 			ChargeBoxId[128];
 	unsigned char			chargePointVendor[20];		//the Vendor of the ChargePoint
 	unsigned int 			Checksum;					//4 bytes checksum
-	struct LED				LedInfo[3];					// LED info maximum support 3 connector
+	struct LED				LedInfo;					// LED configuration info
 };
 
 struct ChargingInfoData