瀏覽代碼

2022-02-11 / Simon Xue

Action:
1. Modify Sensing Credit Card Process.
2. Modify UI Display.

Files
As the commit history files.

Veriosn:2.01.XX.XXXX.XX
Simon Xue 3 年之前
父節點
當前提交
9ebf6e87db

+ 32 - 22
EVSE/Projects/DD360Tcci/Apps/CSU/RFID.c

@@ -15,7 +15,7 @@
 static DcCommonInfo *ShmDcCommonData 			= NULL;
 static SelectGunInfo *ShmSelectGunInfo          = NULL;
 static struct SysInfoData *pSysInfo 			= NULL;
-#define PREAUTHMONEY	1
+#define PREAUTHMONEY	1000
 bool isDeductDb_ready;
 //------------------------------------------------------------------------------
 static char *rfidPortName = "/dev/ttyS2";
@@ -343,6 +343,30 @@ void WritePayResult(int result ,uint8_t gunIndex)
 	memcpy(&ShmDcCommonData->TransactionInfo[gunIndex].VemData,&ShmDcCommonData->pCreditCard[gunIndex].VemData,64);
 
 }
+
+void PreAuthCompleteToCardReader(int fd,uint8_t gunIndex)
+{
+	int result = 0;
+	result = CreditCardPreAuthComplete(fd,(int)ShmDcCommonData->finalcost[pSysInfo->CurGunSelected] ,"TCC Test",
+											&ShmDcCommonData->pCreditCard[gunIndex].VemData[0],
+											&ShmDcCommonData->pCreditCard[gunIndex]);
+	//result = 1;
+	if (result > 0 ) {
+		log_info("Credit Card Spend Money:%.1f",ShmDcCommonData->finalcost[gunIndex]);
+		pSysInfo->SystemPage = _PAGE_COMPLETE;
+		WritePayResult(TRUE,gunIndex);
+		ShmDcCommonData->PayPass_flag[gunIndex] = TRUE;
+
+	} else {
+		log_info("PAYING FAIL");
+		ShmDcCommonData->PayPass_flag[gunIndex] = FALSE;
+		pSysInfo->SystemPage = _PAGE_PAYFAIL;
+		WritePayResult(FALSE,gunIndex);
+	}
+	if (isDeductDb_ready == TRUE) {
+		InsertDeductInfo(gunIndex,&ShmDcCommonData->TransactionInfo[gunIndex]);
+	}
+}
 static int InitialRfidPort(void)
 {
     int fd = open(rfidPortName, O_RDWR);
@@ -457,33 +481,19 @@ void CreateRfidFork(void)
 				}
 
 				if (ShmDcCommonData->StopCharge[gunIndex] == TRUE && ShmDcCommonData->finalcost_flag[gunIndex]) {
-					ShmDcCommonData->StopCharge[gunIndex] = FALSE;
-					StopGunInfoTimeoutDet(gunIndex); //Timeout_FinalCost
-					result = CreditCardPreAuthComplete(fd,1 /*(int)ShmDcCommonData->finalcost[pSysInfo->CurGunSelected]*/ ,"TCC Test",
-															&ShmDcCommonData->pCreditCard[gunIndex].VemData[0],
-															&ShmDcCommonData->pCreditCard[gunIndex]);
-					//result = 1;
-					if (result > 0 ) {
-						log_info("Credit Card Spend Money:%.1f",ShmDcCommonData->finalcost[gunIndex]);
-						pSysInfo->SystemPage = _PAGE_COMPLETE;
-						WritePayResult(TRUE,gunIndex);
-						ShmDcCommonData->PayPass_flag[gunIndex] = TRUE;
+					if (ShmDcCommonData->finalcost[gunIndex] <= 0) {
 
 					} else {
-						log_info("PAYING FAIL");
-						ShmDcCommonData->PayPass_flag[gunIndex] = FALSE;
-						pSysInfo->SystemPage = _PAGE_PAYFAIL;
-						WritePayResult(FALSE,gunIndex);
+						ShmDcCommonData->StopCharge[gunIndex] = FALSE;
+						StopGunInfoTimeoutDet(gunIndex); //Timeout_FinalCost
+						PreAuthCompleteToCardReader(fd,gunIndex);
+						ShmDcCommonData->PayFinish[gunIndex] = TRUE;
 					}
-					if (isDeductDb_ready == TRUE) {
-						InsertDeductInfo(gunIndex,&ShmDcCommonData->TransactionInfo[gunIndex]);
-					}
-					ShmDcCommonData->PayFinish[gunIndex] = TRUE;
 				}
-
 			} // for
-			if (is_idle == TRUE && tm->tm_min%2 == 0 &&
+			if (is_idle == TRUE && tm->tm_min%15 == 0 &&
 					pSysInfo->SystemPage == _PAGE_IDLE && ShmDcCommonData->reupload_deduct_status == 0) {
+				sleep(1);
 				if (DB_GetReDeductInfo(&ReAuthComplete_Index,&ShmDcCommonData->ReAuthComplete) == PASS ) {
 
 					result = CreditCardPreAuthComplete(fd,(int)ShmDcCommonData->ReAuthComplete.Amount ,"TCC Test",

+ 1 - 1
EVSE/Projects/DD360Tcci/Apps/ModuleEvComm/Module_EvRxComm.c

@@ -446,7 +446,7 @@ void CANReceiver(int fd)
                 //printf("id = %d, EvBatterytargetCurrent = %.2f", targetGun, pDcChargingInfo->EvBatterytargetCurrent);
 
                 pDcChargingInfo->RemainChargingDuration = ((short) frame.data[7] << 8) + (short) frame.data[6];
-                //printf("RemainChargingDuration = %d",  pDcChargingInfo->RemainChargingDuration);
+                //log_info("RemainChargingDuration = %d",  pDcChargingInfo->RemainChargingDuration);
 
                 if (pDcChargingInfo->Type == _Type_Chademo) {
                     //if (ShmCHAdeMOData->ev[gunTypeIndex].EvDetection != frame.data[0])

+ 45 - 16
EVSE/Projects/DD360Tcci/Apps/ModuleLcmCtrl/Module_LcmControl.c

@@ -843,31 +843,60 @@ void ChangeRemainTime(int sec)
 void ShowSelectGun()
 {
 	pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(LEFT_GUN_NUM);
-	if (pDcChargingInfo->CCSGunType == _TYPE_CCS1_Liquid ||
-			pDcChargingInfo->CCSGunType == _TYPE_CCS1_Natural) {
-		ChangeDisplay2Value(_Icon_Select_Left,_TCC_SelectLeft_CCS1);
+	if (pDcChargingInfo->SystemStatus == S_CHARGING) {
+		if (pDcChargingInfo->CCSGunType == _TYPE_CCS1_Liquid ||
+				pDcChargingInfo->CCSGunType == _TYPE_CCS1_Natural) {
+			ChangeDisplay2Value(_Icon_Select_Left,_TCC_ShowLeftGunCharging_CCS1);
 
-	} else if (pDcChargingInfo->CCSGunType == _TYPE_CCS2_Liquid ||
-			pDcChargingInfo->CCSGunType == _TYPE_CCS2_Natural) {
-		ChangeDisplay2Value(_Icon_Select_Left,_TCC_SelectLeft_CCS2);
+		} else if (pDcChargingInfo->CCSGunType == _TYPE_CCS2_Liquid ||
+				pDcChargingInfo->CCSGunType == _TYPE_CCS2_Natural) {
+			ChangeDisplay2Value(_Icon_Select_Left,_TCC_ShowLeftGunCharging_CCS2);
 
-	} else if (pDcChargingInfo->Type == _Type_Chademo) {
-		ChangeDisplay2Value(_Icon_Select_Left,_TCC_SelectLeft_CHAdeMo);
+		} else if (pDcChargingInfo->Type == _Type_Chademo) {
+			ChangeDisplay2Value(_Icon_Select_Left,_TCC_ShowLeftGunCharging_CHAdeMo);
+		}
+	} else {
+		if (pDcChargingInfo->CCSGunType == _TYPE_CCS1_Liquid ||
+				pDcChargingInfo->CCSGunType == _TYPE_CCS1_Natural) {
+			ChangeDisplay2Value(_Icon_Select_Left,_TCC_SelectLeft_CCS1);
+
+		} else if (pDcChargingInfo->CCSGunType == _TYPE_CCS2_Liquid ||
+				pDcChargingInfo->CCSGunType == _TYPE_CCS2_Natural) {
+			ChangeDisplay2Value(_Icon_Select_Left,_TCC_SelectLeft_CCS2);
 
+		} else if (pDcChargingInfo->Type == _Type_Chademo) {
+			ChangeDisplay2Value(_Icon_Select_Left,_TCC_SelectLeft_CHAdeMo);
+		}
 	}
 	pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(RIGHT_GUN_NUM);
-	if (pDcChargingInfo->CCSGunType == _TYPE_CCS1_Liquid ||
-			pDcChargingInfo->CCSGunType == _TYPE_CCS1_Natural) {
-		ChangeDisplay2Value(_Icon_Select_Right,_TCC_SelectRight_CCS1);
+	if (pDcChargingInfo->SystemStatus == S_CHARGING) {
+		if (pDcChargingInfo->CCSGunType == _TYPE_CCS1_Liquid ||
+				pDcChargingInfo->CCSGunType == _TYPE_CCS1_Natural) {
+			ChangeDisplay2Value(_Icon_Select_Right,_TCC_ShowRightGunCharging_CCS1);
 
-	} else if (pDcChargingInfo->CCSGunType == _TYPE_CCS2_Liquid ||
-			pDcChargingInfo->CCSGunType == _TYPE_CCS2_Natural) {
-		ChangeDisplay2Value(_Icon_Select_Right,_TCC_SelectRight_CCS2);
+		} else if (pDcChargingInfo->CCSGunType == _TYPE_CCS2_Liquid ||
+				pDcChargingInfo->CCSGunType == _TYPE_CCS2_Natural) {
+			ChangeDisplay2Value(_Icon_Select_Right,_TCC_ShowRightGunCharging_CCS2);
 
-	} else if (pDcChargingInfo->Type == _Type_Chademo) {
-		ChangeDisplay2Value(_Icon_Select_Right,_TCC_SelectRight_CHAdeMo);
+		} else if (pDcChargingInfo->Type == _Type_Chademo) {
+			ChangeDisplay2Value(_Icon_Select_Right,_TCC_ShowRightGunCharging_CHAdeMo);
+
+		}
+	} else {
+		if (pDcChargingInfo->CCSGunType == _TYPE_CCS1_Liquid ||
+				pDcChargingInfo->CCSGunType == _TYPE_CCS1_Natural) {
+			ChangeDisplay2Value(_Icon_Select_Right,_TCC_SelectRight_CCS1);
 
+		} else if (pDcChargingInfo->CCSGunType == _TYPE_CCS2_Liquid ||
+				pDcChargingInfo->CCSGunType == _TYPE_CCS2_Natural) {
+			ChangeDisplay2Value(_Icon_Select_Right,_TCC_SelectRight_CCS2);
+
+		} else if (pDcChargingInfo->Type == _Type_Chademo) {
+			ChangeDisplay2Value(_Icon_Select_Right,_TCC_SelectRight_CHAdeMo);
+
+		}
 	}
+
 }
 void ChangeChargingPowerValue(float pow)
 {

+ 6 - 0
EVSE/Projects/DD360Tcci/Apps/ModuleLcmCtrl/Module_LcmControl.h

@@ -431,6 +431,12 @@ enum _TCC_ICON_LIST_ {
 	_TCC_PlugOutFrame,
 	_TCC_ErrorFrame,
 	_TCC_Warming,
+	_TCC_ShowLeftGunCharging_CCS1 = 292,
+	_TCC_ShowLeftGunCharging_CCS2,
+	_TCC_ShowLeftGunCharging_CHAdeMo,
+	_TCC_ShowRightGunCharging_CCS1,
+	_TCC_ShowRightGunCharging_CCS2,
+	_TCC_ShowRightGunCharging_CHAdeMo,
 };
 
 

二進制
EVSE/Projects/DD360Tcci/Images/ramdisk.gz


二進制
EVSE/Projects/DD360Tcci/output/Module_LcmControl


二進制
EVSE/Projects/DD360Tcci/output/main