From 4392349b649164f2b498ca5157ecd141631ea96f Mon Sep 17 00:00:00 2001
From: QuakeGod <QuakeGod@sina.com>
Date: 星期三, 01 二月 2023 18:18:47 +0800
Subject: [PATCH] KBus fix project name

---
 Src/FP0.c |   34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/Src/FP0.c b/Src/FP0.c
index 2b8c6a8..70a386e 100644
--- a/Src/FP0.c
+++ b/Src/FP0.c
@@ -22,7 +22,7 @@
 uint8_t bSentLen;
 
 uint8_t bConfiged=0;
-uint8_t nConfigAddr=0;
+uint8_t nConfigStationId=0;
 uint8_t nInputBytes=8;
 uint8_t nOutputBytes=8;
 uint8_t nIndex=0;
@@ -53,11 +53,11 @@
 	bSPI1Sending=0;
 	bSPI1Recving=0;
 	if (nChilds==0) {
-	nInputBytes=1;		//根据子机数量,报告扩展容量
+	nInputBytes=1;		//鏍规嵁瀛愭満鏁伴噺锛屾姤鍛婃墿灞曞閲�
 	nOutputBytes=1;
 	} else
 	{
-		nInputBytes=nChilds;		//根据子机数量,报告扩展容量
+		nInputBytes=nChilds;		//鏍规嵁瀛愭満鏁伴噺锛屾姤鍛婃墿灞曞閲�
 		nOutputBytes=nChilds;
 	}
 	SetACKPin_0();
@@ -99,8 +99,8 @@
 			}
 		}
 	if (CurSYN ==0 && oldSYN != 0) {		
-		KMem.SDT[121] =	KMem.SDT[122];
-		KMem.SDT[122]=0;
+		KMem.WDT[121] =	KMem.WDT[122];
+		KMem.WDT[122]=0;
 		}
 	if (CurSEL && CurSYN !=0 && oldSYN == 0){
 				bSPI1Recving=1;
@@ -156,15 +156,15 @@
 	uint8_t res=0;
 	uint8_t nST=pBuf[0];
 	uint8_t nCMD=nST&0x7;
-	uint8_t nAddr=nST&0xf8;
-	KMem.SDB[128+KMem.SDT[123]] = 0xFF;
-	KMem.SDT[123]++; 	 if (KMem.SDT[123]>=100) {KMem.SDT[123]=81;}
+	uint8_t nStationID=nST&0xf8;
 	
-	if (nAddr<0x80) return 0;
+	logData(0xff);
+	
+	if (nStationID<0x80) return 0;
 	switch (nCMD)
 	{
 		case CMD_0_QUERY:
-			if (!bConfiged || (bConfiged && nAddr == nConfigAddr))
+			if (!bConfiged || (bConfiged && nStationID == nConfigStationId))
 		{
 			 KMem.DT[8]++;
 			pFP0QuRplyPkg p1 = (pFP0QuRplyPkg)PkgBuf2;
@@ -175,11 +175,10 @@
 			p1->nBCC= 0x30|CalFP0BCC(PkgBuf2,4);
 			p1->End1=0x0d;
 			
-			KMem.SDB[128+KMem.SDT[123]] = 0x11;
-			KMem.SDT[123]++; 	 if (KMem.SDT[123]>=100) {KMem.SDT[123]=81;}			
+			logData(0x11);
 			
 			SendFP0Pkg(PkgBuf2,sizeof(stFP0QuRplyPkg));
-			nConfigAddr=nAddr;
+			nConfigStationId=nStationID;
 			bConfiged=1;
 		}
 		bSPI1Recving=1;
@@ -193,7 +192,7 @@
 //			bSPI1Recving=1;
 			break;
 		case CMD_3_EXCHG:
-			if (!bConfiged || nConfigAddr != nAddr)
+			if (!bConfiged || nConfigStationId != nStationID)
 			{
 				bSPI1Recving=1;		
 				break;
@@ -238,7 +237,7 @@
 			break;
 		case CMD_7_END:
 		 KMem.DT[15]++;
-			if (bConfiged && nConfigAddr == nAddr)
+			if (bConfiged && nConfigStationId == nStationID)
 			{		
 				//SetFP0DEPin_0();
 				SetACKPin_1();				
@@ -272,8 +271,9 @@
 		value = SPI1SendBuf[nSPI1SentLen];
 		LL_SPI_TransmitData8(SPI1,value);
 		bSPI1Sending=1;
-	 KMem.SDB[128+KMem.SDT[123]] = value;
-	 KMem.SDT[123]++; 	 if (KMem.SDT[123]>=100) {KMem.SDT[123]=81;}		
+		
+	logData(value);		
+
 		// passive mode
 		SetFP0DEPin_1();
 		SetACKPin_0();

--
Gitblit v1.9.1