| | |
| | | } |
| | | byte[] payload = buildBladeCommandBytes((byte) targetHeight); |
| | | |
| | | // 调试:打印发送的数据 |
| | | System.out.println("发送刀盘升降指令: " + bytesToHex(payload)); |
| | | |
| | | boolean success = sendmessage.sendViaActive(payload); |
| | | if (success) { |
| | |
| | | * 测试函数:验证刀盘升降指令构建 |
| | | */ |
| | | public static void testBuildBladeCommand() { |
| | | System.out.println("=== 测试刀盘升降指令构建 ==="); |
| | | |
| | | // 测试1:提升指令 |
| | | byte[] cmd1 = buildBladeCommandBytes((byte)50); |
| | | System.out.println("提升50%: " + bytesToHex(cmd1)); |
| | | |
| | | // 测试2:降低指令 |
| | | byte[] cmd2 = buildBladeCommandBytes((byte)-30); |
| | | System.out.println("降低30%: " + bytesToHex(cmd2)); |
| | | |
| | | // 测试3:归零指令 |
| | | byte[] cmd3 = buildBladeCommandBytes((byte)0); |
| | | System.out.println("归零: " + bytesToHex(cmd3)); |
| | | } |
| | | } |