From 487a5b943571d6ab57c4baddca1cbcc7b2062e73 Mon Sep 17 00:00:00 2001
From: 826220679@qq.com <826220679@qq.com>
Date: 星期三, 27 八月 2025 23:06:57 +0800
Subject: [PATCH] 20250827

---
 src/home/AOAFollowSystem.java |  217 ++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 145 insertions(+), 72 deletions(-)

diff --git a/src/home/AOAFollowSystem.java b/src/home/AOAFollowSystem.java
index 432b760..499cbea 100644
--- a/src/home/AOAFollowSystem.java
+++ b/src/home/AOAFollowSystem.java
@@ -110,6 +110,12 @@
 		case "ascii": return "ASCII";
 		case "hex_send": return "HEX鍙戦��";
 		case "display_format": return "鏄剧ず鏍煎紡";
+		case "pair_tooltip": 
+		    return currentLocale.equals(Locale.SIMPLIFIED_CHINESE) ? 
+		           "鐐瑰嚮鍙戦�佸悗杩涘叆20绉掗厤瀵规ā寮�" : 
+		           "Enter 20-second pairing mode after clicking send";
+		case "scale": 
+            return currentLocale.equals(Locale.SIMPLIFIED_CHINESE) ? "缂╂斁" : "Scale";
 		default: return key;
 		}
 	}
@@ -188,7 +194,10 @@
 		// 鏇存柊鍚勯潰鏉挎枃鏈�
 		homePanel.updateLanguage();
 		configPanel.updateLanguage();
+		 // 鏇存柊閰嶅澶嶉�夋鐨勬彁绀轰俊鎭�
+	    homePanel.updatePairCheckboxTooltip();
 	}
+	
 
 	private JButton createNavButton(String text, Color color) {
 		JButton button = new JButton(text);
@@ -301,10 +310,26 @@
 			formatPanel.add(displayFormatLabel);
 
 			ButtonGroup formatGroup = new ButtonGroup();
-			hexRadio = new JRadioButton(getString("hex"), true); // 榛樿閫変腑HEX
-			asciiRadio = new JRadioButton(getString("ascii"));
-			
+			asciiRadio = new JRadioButton(getString("ascii"), true); // 榛樿閫変腑ASCI
+			asciiRadio.addItemListener(e -> {
+			    if (asciiRadio.isSelected()) {
+			    	asciiRadio.setForeground(Color.RED);
+			    } else {
+			    	asciiRadio.setForeground(null); // 鎭㈠榛樿棰滆壊
+			    }
+			});
+			hexRadio = new JRadioButton(getString("hex"), false); // 榛樿涓嶉�変腑HEX
+			hexRadio.addItemListener(e -> {
+			    if (hexRadio.isSelected()) {
+			        hexRadio.setForeground(Color.RED);
+			    } else {
+			        hexRadio.setForeground(null); // 鎭㈠榛樿棰滆壊
+			    }
+			});
+
 			pairCheckBox = new JCheckBox(getString("pair"), false); // 榛樿涓嶅嬀閫�
+			// 涓洪厤瀵瑰閫夋娣诲姞鎻愮ず淇℃伅
+			pairCheckBox.setToolTipText(getString("pair_tooltip"));
 			pairCheckBox.addItemListener(e -> {
 			    if (pairCheckBox.isSelected()) {
 			        sendField.setText("55AA030304F5FF");
@@ -413,7 +438,7 @@
 			sendBtn.addActionListener(e -> sendData());
 
 			// 鏂板锛欻EX鍙戦�佸閫夋
-			hexSendCheckBox = new JCheckBox(getString("hex_send"), true); // 榛樿鍕鹃��
+			hexSendCheckBox = new JCheckBox(getString("hex_send"), false); // 榛樿鍕鹃��
 			sendControlPanel.add(hexSendCheckBox, BorderLayout.WEST);
 			sendControlPanel.add(sendBtn, BorderLayout.EAST);
 
@@ -426,6 +451,11 @@
 			// 娣诲姞宸﹀彸闈㈡澘
 			add(leftPanel, BorderLayout.CENTER);
 			add(rightPanel, BorderLayout.EAST);
+		}
+
+		// 鍦℉omePanel绫讳腑娣诲姞鏇存柊閰嶅澶嶉�夋鎻愮ず淇℃伅鐨勬柟娉�
+		public void updatePairCheckboxTooltip() {
+		    pairCheckBox.setToolTipText(getString("pair_tooltip"));
 		}
 
 		private JButton createColoredButton(String text, Color color) {
@@ -566,74 +596,116 @@
 		}
 
 		private void processReceivedData(byte[] data) {
-			// 浼樺寲锛氶噸鐢⊿tringBuilder瀵硅薄
-			hexBuilder.setLength(0);
-			for (byte b : data) {
-				hexBuilder.append(String.format("%02X", b));
-			}
-			String displayText = hexBuilder.toString();
-			
-			String displayText1 = new String(data).replaceAll("\\s+", "");
-			
-			if (displayText.startsWith("55AA1F")) {
-				Dell55AA1FParser.ParseResult result = Dell55AA1FParser.parse(displayText, "127.0.0.1", 0);
-				if (result != null) {
-					updateTable(result);
-					visualizationPanel.updatePosition(result.distance, result.angle,result.signalQuality);
-					visualizationPanel.setTagId(result.tagId);
-				}
-			}else if(displayText.startsWith("55AA01")) {            	
-				ParseResult result=Dell55AA01Parser.parse(displayText, "127.0.0.1", 0);
-				visualizationPanel.updatePosition(result.distance,270,0);				
-				visualizationPanel.setTagId(result.tagId);
-				
-			}
+		    // 浼樺寲锛氶噸鐢⊿tringBuilder瀵硅薄
+		    hexBuilder.setLength(0);
+		    for (byte b : data) {
+		        hexBuilder.append(String.format("%02X", b));
+		    }
+		    String displayText = hexBuilder.toString();
+		    
+		    String displayText1 = new String(data).replaceAll("\\s+", "");
+		    
+		    // 鍏堟鏌ユ暟鎹暱搴︽槸鍚﹁冻澶熻繘琛岃В鏋�
+		    if (displayText.length() < 30) { // 鑷冲皯闇�瑕�30涓瓧绗�(15瀛楄妭)鎵嶈兘瑙f瀽鍩烘湰瀛楁
+		        appendLog("鏁版嵁闀垮害涓嶈冻: " + displayText);
+		        return;
+		    }
+		    
+		    if (displayText.startsWith("55AA1F")) {
+		        Dell55AA1FParser.ParseResult result = Dell55AA1FParser.parse(displayText, "127.0.0.1", 0);
+		        if (result != null) {
+		            updateTable(result);
+		            visualizationPanel.updatePosition(result.distance, result.angle, result.signalQuality);
+		            visualizationPanel.setTagId(result.tagId);
+		        } else {
+		            appendLog("55AA1F鍗忚瑙f瀽澶辫触: " + displayText);
+		        }
+		    } else if(displayText.startsWith("55AA01")) {                
+		        ParseResult result = Dell55AA01Parser.parse(displayText, "127.0.0.1", 0);
+		        if (result != null) {
+		            visualizationPanel.updatePosition(result.distance, 270, 0);                
+		            visualizationPanel.setTagId(result.tagId);
+		        } else {
+		            appendLog("55AA01鍗忚瑙f瀽澶辫触: " + displayText);
+		        }
+		    } else if(displayText.startsWith("55AA51")) {                
+		        Dell55AA51Parser.ParseResult result = Dell55AA51Parser.parse(displayText, "127.0.0.1", 0);
+		        if (result != null) {
+		            visualizationPanel.updatePosition(result.distance, result.horizontalAngle, result.signalStrength);                
+		            visualizationPanel.setTagId(result.tagId);
+		        } else {
+		            appendLog("55AA51鍗忚瑙f瀽澶辫触: " + displayText);
+		        }
+		    } else {
+		        // 濡傛灉涓嶆槸宸茬煡鍗忚锛岀洿鎺ヨ褰曞師濮嬫暟鎹�
+		        appendLog("鏈煡鍗忚: " + displayText);
+		    }
 
-			if (hexRadio.isSelected()) {				
-				appendLog(displayText);
-			} else {
-				if (displayText.startsWith("55AA1F")) {
-					Dell55AA1FParser.ParseResult result = Dell55AA1FParser.parse(displayText, "127.0.0.1", 0);								
-					// 浼樺寲锛氶噸鐢⊿tringBuilder瀵硅薄
-					displayBuilder.setLength(0);
-					displayBuilder.append("1F:")
-					.append(result.dataLength)
-					.append(",")
-					.append(result.messageType)
-					.append(",id:")
-					.append(result.tagId)
-					.append(",Dis:")
-					.append(result.distance)
-					.append("cm,Angle:")
-					.append(result.angle)
-					.append("掳,Signal:")
-					.append(result.signalQuality)
-					.append(",Button:")
-					.append(result.buttonPressed)
-					.append(",Power:")
-					.append(result.power);
-					appendLog(displayBuilder.toString());
-				}else if(displayText.startsWith("55AA01")) {            	
-					ParseResult result=Dell55AA01Parser.parse(displayText, "127.0.0.1", 0);
-					// 浼樺寲锛氶噸鐢⊿tringBuilder瀵硅薄
-					displayBuilder.setLength(0);
-					displayBuilder.append("55AA01 Seq:")
-					.append(result.sequenceNum)
-					.append(",Tagid:")
-					.append(result.tagId)
-					.append(",Anchorid:")
-					.append(result.anchorId)
-					.append(",Distance:")
-					.append(result.distance)
-					.append(",Power:")
-					.append(result.power)
-					.append(",Button:")
-					.append(result.buttonPressed);
-					appendLog(displayBuilder.toString());
-				}else {					
-					appendLog(displayText1);
-				}
-			}
+		    if (hexRadio.isSelected()) {                
+		        appendLog(displayText);
+		    } else {
+		        if (displayText.startsWith("55AA1F")) {
+		            Dell55AA1FParser.ParseResult result = Dell55AA1FParser.parse(displayText, "127.0.0.1", 0);
+		            if (result != null) {
+		                // 浼樺寲锛氶噸鐢⊿tringBuilder瀵硅薄
+		                displayBuilder.setLength(0);
+		                displayBuilder.append(result.tagId)
+		                .append(",Dis:")
+		                .append(result.distance)
+		                .append("cm,Angle:")
+		                .append(result.angle)
+		                .append("掳,Signal:")
+		                .append(result.signalQuality)
+		                .append(",Button:")
+		                .append(result.buttonPressed)
+		                .append(",Power:")
+		                .append(result.power);
+		                appendLog(displayBuilder.toString());
+		            }
+		        } else if(displayText.startsWith("55AA01")) {                
+		            ParseResult result = Dell55AA01Parser.parse(displayText, "127.0.0.1", 0);
+		            if (result != null) {
+		                // 浼樺寲锛氶噸鐢⊿tringBuilder瀵硅薄
+		                displayBuilder.setLength(0);
+		                displayBuilder.append("55AA01 Seq:")
+		                .append(result.sequenceNum)
+		                .append(",Tagid:")
+		                .append(result.tagId)
+		                .append(",Anchorid:")
+		                .append(result.anchorId)
+		                .append(",Distance:")
+		                .append(result.distance)
+		                .append(",Power:")
+		                .append(result.power)
+		                .append(",Button:")
+		                .append(result.buttonPressed);
+		                appendLog(displayBuilder.toString());
+		            }
+		        } else if(displayText.startsWith("55AA51")) {                
+		            Dell55AA51Parser.ParseResult result = Dell55AA51Parser.parse(displayText, "127.0.0.1", 0);
+		            if (result != null) {
+		                displayBuilder.setLength(0);
+		                displayBuilder.append(result.tagId)
+		                .append(",Dis:")
+		                .append(result.distance)
+		                .append("cm,HAngle:")
+		                .append(result.horizontalAngle)
+		                .append("掳,VAngle:")
+		                .append(result.verticalAngle)
+		                .append("掳,Signal:")
+		                .append(result.signalStrength)
+		                .append("掳,ASignal:")
+		                .append(result.angleConfidence)
+		                .append(",Power:")
+		                .append(result.tagBattery)
+		                .append("%,Status:")
+		                .append(result.deviceStatus);
+		                appendLog(displayBuilder.toString());
+		            }
+		        } else {                    
+		            appendLog(displayText1);
+		        }
+		    }
 		}
 
 		private void appendLog(String message) {
@@ -732,7 +804,8 @@
 			asciiRadio.setText(getString("ascii"));
 			hexSendCheckBox.setText(getString("hex_send"));
 			pairCheckBox.setText(getString("pair"));
-
+			// 鏇存柊閰嶅澶嶉�夋鐨勬彁绀轰俊鎭�
+		    updatePairCheckboxTooltip();
 			// 鏇存柊杈规鏍囬
 			updateBorderTitles(this);
 

--
Gitblit v1.9.3