diff --git a/server/src/Controllers/DebuggerController.cs b/server/src/Controllers/DebuggerController.cs index 3890f62..5f301a6 100644 --- a/server/src/Controllers/DebuggerController.cs +++ b/server/src/Controllers/DebuggerController.cs @@ -41,7 +41,7 @@ public class DebuggerController : ControllerBase return null; var board = boardRet.Value.Value; - return new DebuggerClient(board.IpAddr, board.Port, 1); + return new DebuggerClient(board.IpAddr, board.Port, 7); } catch (Exception ex) { diff --git a/server/src/Controllers/LogicAnalyzerController.cs b/server/src/Controllers/LogicAnalyzerController.cs index 66b5ffd..28bbb73 100644 --- a/server/src/Controllers/LogicAnalyzerController.cs +++ b/server/src/Controllers/LogicAnalyzerController.cs @@ -41,7 +41,7 @@ public class LogicAnalyzerController : ControllerBase return null; var board = boardRet.Value.Value; - return new Analyzer(board.IpAddr, board.Port, 0); + return new Analyzer(board.IpAddr, board.Port, 11); } catch (Exception ex) { diff --git a/server/src/Hubs/DigitalTubesHub.cs b/server/src/Hubs/DigitalTubesHub.cs index 4eb879f..8d63937 100644 --- a/server/src/Hubs/DigitalTubesHub.cs +++ b/server/src/Hubs/DigitalTubesHub.cs @@ -168,7 +168,7 @@ public class DigitalTubesHub : Hub, IDigitalTubesHub var cts = new CancellationTokenSource(); var scanTaskInfo = new DigitalTubesScanTaskInfo( board.ID.ToString(), Context.ConnectionId, - new SevenDigitalTubesCtrl(board.IpAddr, board.Port, 0) + new SevenDigitalTubesCtrl(board.IpAddr, board.Port, 6) ); scanTaskInfo.ScanTask = ScanAllTubes(scanTaskInfo); diff --git a/server/src/Peripherals/CameraClient.cs b/server/src/Peripherals/CameraClient.cs index 7771d1e..8325920 100644 --- a/server/src/Peripherals/CameraClient.cs +++ b/server/src/Peripherals/CameraClient.cs @@ -20,7 +20,7 @@ public class Camera private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); readonly int timeout = 500; - readonly int taskID; + readonly int taskID = 8; readonly int port; readonly string address; private IPEndPoint ep; diff --git a/server/src/Peripherals/CommandID.md b/server/src/Peripherals/CommandID.md new file mode 100644 index 0000000..f45e39b --- /dev/null +++ b/server/src/Peripherals/CommandID.md @@ -0,0 +1,8 @@ +示波器:12 +逻辑分析仪: 11 +Jtag: 10 +矩阵键盘:1 +HDMI:9 +Camera: 8 +Debugger: 7 +七段数码港:6 diff --git a/server/src/Peripherals/JtagClient.cs b/server/src/Peripherals/JtagClient.cs index 249d120..6436120 100644 --- a/server/src/Peripherals/JtagClient.cs +++ b/server/src/Peripherals/JtagClient.cs @@ -385,6 +385,7 @@ public class Jtag private const int CLOCK_FREQ = 50; // MHz readonly int timeout; + readonly int taskID = 10; readonly int port; /// @@ -415,7 +416,7 @@ public class Jtag { BurstType = BurstType.FixedBurst, BurstLength = 0, - CommandID = 0, + CommandID = (byte)this.taskID, Address = devAddr, IsWrite = false, }; @@ -429,7 +430,7 @@ public class Jtag if (!MsgBus.IsRunning) return new(new Exception("Message Bus not Working!")); - var retPack = await MsgBus.UDPServer.WaitForDataAsync(this.ep, 0, this.timeout); + var retPack = await MsgBus.UDPServer.WaitForDataAsync(this.ep, this.taskID, this.timeout); if (!retPack.IsSuccessful || !retPack.Value.IsSuccessful) return new(new Exception("Send address package failed")); @@ -449,7 +450,7 @@ public class Jtag UInt32 resultMask = 0xFF_FF_FF_FF, UInt32 delayMilliseconds = 0, string progressId = "") { { - var ret = await UDPClientPool.WriteAddr(this.ep, 0, devAddr, data, this.timeout, progressId); + var ret = await UDPClientPool.WriteAddr(this.ep, this.taskID, devAddr, data, this.timeout, progressId); if (!ret.IsSuccessful) return new(ret.Error); if (!ret.Value) return new(new Exception("Write FIFO failed")); } @@ -458,7 +459,7 @@ public class Jtag await Task.Delay(TimeSpan.FromMilliseconds(delayMilliseconds)); { - var ret = await UDPClientPool.ReadAddrWithWait(this.ep, 0, JtagAddr.STATE, result, resultMask, 0, this.timeout); + var ret = await UDPClientPool.ReadAddrWithWait(this.ep, this.taskID, JtagAddr.STATE, result, resultMask, 0, this.timeout); if (!ret.IsSuccessful) return new(ret.Error); _progressTracker?.AdvanceProgress(progressId, 10); return ret.Value; @@ -471,7 +472,7 @@ public class Jtag { { var ret = await UDPClientPool.WriteAddr( - this.ep, 0, devAddr, data, this.timeout, progressId); + this.ep, this.taskID, devAddr, data, this.timeout, progressId); if (!ret.IsSuccessful) return new(ret.Error); if (!ret.Value) return new(new Exception("Write FIFO failed")); } @@ -480,7 +481,7 @@ public class Jtag await Task.Delay(TimeSpan.FromMilliseconds(delayMilliseconds)); { - var ret = await UDPClientPool.ReadAddrWithWait(this.ep, 0, JtagAddr.STATE, result, resultMask, 0, this.timeout); + var ret = await UDPClientPool.ReadAddrWithWait(this.ep, this.taskID, JtagAddr.STATE, result, resultMask, 0, this.timeout); if (!ret.IsSuccessful) return new(ret.Error); _progressTracker.AdvanceProgress(progressId, 10); return ret.Value; @@ -625,7 +626,7 @@ public class Jtag if (ret.Value) { var array = new UInt32[UInt32Num]; - var retData = await UDPClientPool.ReadAddr4Bytes(ep, 0, JtagAddr.READ_DATA, (int)UInt32Num); + var retData = await UDPClientPool.ReadAddr4Bytes(ep, this.taskID, JtagAddr.READ_DATA, (int)UInt32Num); if (!retData.IsSuccessful) return new(new Exception("Read FIFO failed when Load DR")); Buffer.BlockCopy(retData.Value, 0, array, 0, (int)UInt32Num * 4); @@ -642,9 +643,9 @@ public class Jtag public async ValueTask> ReadIDCode() { // Clear Data - MsgBus.UDPServer.ClearUDPData(this.address, 0); + MsgBus.UDPServer.ClearUDPData(this.address, this.taskID); - logger.Trace($"Clear up udp server {this.address,0} receive data"); + logger.Trace($"Clear up udp server {this.address} {this.taskID} receive data"); Result ret; @@ -680,9 +681,9 @@ public class Jtag public async ValueTask> ReadStatusReg() { // Clear Data - MsgBus.UDPServer.ClearUDPData(this.address, 0); + MsgBus.UDPServer.ClearUDPData(this.address, this.taskID); - logger.Trace($"Clear up udp server {this.address,0} receive data"); + logger.Trace($"Clear up udp server {this.address} {this.taskID} receive data"); Result ret; @@ -719,9 +720,9 @@ public class Jtag byte[] bitstream, string progressId = "") { // Clear Data - MsgBus.UDPServer.ClearUDPData(this.address, 0); + MsgBus.UDPServer.ClearUDPData(this.address, this.taskID); - logger.Trace($"Clear up udp server {this.address,0} receive data"); + logger.Trace($"Clear up udp server {this.address} {this.taskID} receive data"); _progressTracker.AdvanceProgress(progressId, 10); @@ -819,9 +820,9 @@ public class Jtag logger.Debug($"Get boundary scan registers number: {portNum}"); // Clear Data - MsgBus.UDPServer.ClearUDPData(this.address, 0); + MsgBus.UDPServer.ClearUDPData(this.address, this.taskID); - logger.Trace($"Clear up udp server {this.address,0} receive data"); + logger.Trace($"Clear up udp server {this.address} {this.taskID} receive data"); Result ret; @@ -886,9 +887,9 @@ public class Jtag public async ValueTask> SetSpeed(UInt32 speed) { // Clear Data - MsgBus.UDPServer.ClearUDPData(this.address, 0); + MsgBus.UDPServer.ClearUDPData(this.address, this.taskID); - logger.Trace($"Clear up udp server {this.address,0} receive data"); + logger.Trace($"Clear up udp server {this.address} {this.taskID} receive data"); var ret = await WriteFIFO( JtagAddr.SPEED_CTRL, (speed << 16) | speed, diff --git a/server/src/Peripherals/OscilloscopeClient.cs b/server/src/Peripherals/OscilloscopeClient.cs index 11d6a32..9d092a5 100644 --- a/server/src/Peripherals/OscilloscopeClient.cs +++ b/server/src/Peripherals/OscilloscopeClient.cs @@ -87,7 +87,7 @@ class OscilloscopeCtrl private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); readonly int timeout = 2000; - readonly int taskID = 0; + readonly int taskID = 12; readonly int port; readonly string address; diff --git a/server/src/Services/HttpHdmiVideoStreamService.cs b/server/src/Services/HttpHdmiVideoStreamService.cs index a2ba04c..45a41e1 100644 --- a/server/src/Services/HttpHdmiVideoStreamService.cs +++ b/server/src/Services/HttpHdmiVideoStreamService.cs @@ -138,7 +138,7 @@ public class HttpHdmiVideoStreamService : BackgroundService client = new HdmiVideoStreamClient() { - HdmiInClient = new HdmiIn(board.IpAddr, board.Port, 1), + HdmiInClient = new HdmiIn(board.IpAddr, board.Port, 9), // JpegClient = new Jpeg(board.IpAddr, board.Port, 1), CTS = new CancellationTokenSource(), Offset = 0 diff --git a/src/components/equipments/SevenSegmentDisplayUltimate.vue b/src/components/equipments/SevenSegmentDisplayUltimate.vue index 98b4343..53012aa 100644 --- a/src/components/equipments/SevenSegmentDisplayUltimate.vue +++ b/src/components/equipments/SevenSegmentDisplayUltimate.vue @@ -98,7 +98,7 @@ const props = withDefaults(defineProps(), { size: 1, color: "red", enableDigitalTwin: false, - digitalTwinNum: 0, + digitalTwinNum: 1, afterglowDuration: 500, cathodeType: "common", pins: () => [ @@ -179,7 +179,7 @@ const eqps = useEquipments(); async function initDigitalTwin() { if ( !props.enableDigitalTwin || - props.digitalTwinNum < 0 || + props.digitalTwinNum <= 0 || props.digitalTwinNum > 31 ) return; @@ -200,12 +200,12 @@ watch( () => { if ( !eqps.sevenSegmentDisplayData || - props.digitalTwinNum < 0 || + props.digitalTwinNum <= 0 || props.digitalTwinNum > 31 ) return; - handleDigitalTwinData(eqps.sevenSegmentDisplayData[props.digitalTwinNum]); + handleDigitalTwinData(eqps.sevenSegmentDisplayData[props.digitalTwinNum - 1]); }, ); @@ -394,7 +394,7 @@ export function getDefaultProps() { size: 1, color: "red", enableDigitalTwin: false, - digitalTwinNum: 0, + digitalTwinNum: 1, afterglowDuration: 500, cathodeType: "common", pins: [