fix: 修改commandID,并修复七段数码管的配置问题
This commit is contained in:
		@@ -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)
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
@@ -168,7 +168,7 @@ public class DigitalTubesHub : Hub<IDigitalTubesReceiver>, 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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								server/src/Peripherals/CommandID.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								server/src/Peripherals/CommandID.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
示波器:12
 | 
			
		||||
逻辑分析仪: 11
 | 
			
		||||
Jtag: 10
 | 
			
		||||
矩阵键盘:1
 | 
			
		||||
HDMI:9
 | 
			
		||||
Camera: 8
 | 
			
		||||
Debugger: 7
 | 
			
		||||
七段数码港:6
 | 
			
		||||
@@ -385,6 +385,7 @@ public class Jtag
 | 
			
		||||
    private const int CLOCK_FREQ = 50; // MHz
 | 
			
		||||
 | 
			
		||||
    readonly int timeout;
 | 
			
		||||
    readonly int taskID = 10;
 | 
			
		||||
 | 
			
		||||
    readonly int port;
 | 
			
		||||
    /// <summary>
 | 
			
		||||
@@ -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<Result<uint>> 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<bool> ret;
 | 
			
		||||
 | 
			
		||||
@@ -680,9 +681,9 @@ public class Jtag
 | 
			
		||||
    public async ValueTask<Result<uint>> 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<bool> 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<bool> ret;
 | 
			
		||||
 | 
			
		||||
@@ -886,9 +887,9 @@ public class Jtag
 | 
			
		||||
    public async ValueTask<Result<bool>> 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,
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user