fix: 前端修复拨码开关第一个无法开关的问题;后端修复进度条停止在3%的问题
This commit is contained in:
parent
55edfd771e
commit
caa26c729e
|
@ -228,7 +228,7 @@ public class JtagController : ControllerBase
|
|||
|
||||
// 下载比特流
|
||||
var jtagCtrl = new Peripherals.JtagClient.Jtag(address, port);
|
||||
var ret = await jtagCtrl.DownloadBitstream(processedBytes);
|
||||
var ret = await jtagCtrl.DownloadBitstream(processedBytes, taskId);
|
||||
|
||||
if (ret.IsSuccessful)
|
||||
{
|
||||
|
|
|
@ -380,7 +380,7 @@ public class JtagStatusReg
|
|||
public class Jtag
|
||||
{
|
||||
private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
private readonly ProgressTracker? _progressTracker;
|
||||
private readonly ProgressTracker _progressTracker = MsgBus.ProgressTracker;
|
||||
|
||||
private const int CLOCK_FREQ = 50; // MHz
|
||||
|
||||
|
@ -400,14 +400,12 @@ public class Jtag
|
|||
/// <param name="address">目标 IP 地址</param>
|
||||
/// <param name="port">目标 UDP 端口</param>
|
||||
/// <param name="timeout">超时时间(毫秒)</param>
|
||||
/// <param name="progressTracker">进度追踪器</param>
|
||||
public Jtag(string address, int port, int timeout = 2000, ProgressTracker? progressTracker = null)
|
||||
public Jtag(string address, int port, int timeout = 2000)
|
||||
{
|
||||
this.address = address;
|
||||
this.port = port;
|
||||
this.ep = new IPEndPoint(IPAddress.Parse(address), port);
|
||||
this.timeout = timeout;
|
||||
this._progressTracker = progressTracker;
|
||||
}
|
||||
|
||||
async ValueTask<Result<uint>> ReadFIFO(uint devAddr)
|
||||
|
@ -472,7 +470,8 @@ 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, 0, devAddr, data, this.timeout, progressId);
|
||||
if (!ret.IsSuccessful) return new(ret.Error);
|
||||
if (!ret.Value) return new(new Exception("Write FIFO failed"));
|
||||
}
|
||||
|
@ -483,7 +482,7 @@ public class Jtag
|
|||
{
|
||||
var ret = await UDPClientPool.ReadAddrWithWait(this.ep, 0, JtagAddr.STATE, result, resultMask, 0, this.timeout);
|
||||
if (!ret.IsSuccessful) return new(ret.Error);
|
||||
_progressTracker?.AdvanceProgress(progressId, 10);
|
||||
_progressTracker.AdvanceProgress(progressId, 10);
|
||||
return ret.Value;
|
||||
}
|
||||
}
|
||||
|
@ -583,7 +582,7 @@ public class Jtag
|
|||
else if (!ret.Value) return new(new Exception("Write CMD_JTAG_LOAD_DR_CAREI Failed"));
|
||||
}
|
||||
|
||||
_progressTracker?.AdvanceProgress(progressId, 10);
|
||||
_progressTracker.AdvanceProgress(progressId, 10);
|
||||
|
||||
{
|
||||
var ret = await WriteFIFO(
|
||||
|
@ -724,41 +723,43 @@ public class Jtag
|
|||
|
||||
logger.Trace($"Clear up udp server {this.address,0} receive data");
|
||||
|
||||
_progressTracker.AdvanceProgress(progressId, 10);
|
||||
|
||||
Result<bool> ret;
|
||||
|
||||
ret = await CloseTest();
|
||||
if (!ret.IsSuccessful) return new(ret.Error);
|
||||
else if (!ret.Value) return new(new Exception("Jtag Close Test Failed"));
|
||||
_progressTracker?.AdvanceProgress(progressId, 10);
|
||||
_progressTracker.AdvanceProgress(progressId, 10);
|
||||
|
||||
ret = await RunTest();
|
||||
if (!ret.IsSuccessful) return new(ret.Error);
|
||||
else if (!ret.Value) return new(new Exception("Jtag Run Test Failed"));
|
||||
_progressTracker?.AdvanceProgress(progressId, 10);
|
||||
_progressTracker.AdvanceProgress(progressId, 10);
|
||||
|
||||
logger.Trace("Jtag initialize");
|
||||
|
||||
ret = await ExecRDCmd(JtagCmd.JTAG_DR_JRST);
|
||||
if (!ret.IsSuccessful) return new(ret.Error);
|
||||
else if (!ret.Value) return new(new Exception("Jtag Execute Command JTAG_DR_JRST Failed"));
|
||||
_progressTracker?.AdvanceProgress(progressId, 10);
|
||||
_progressTracker.AdvanceProgress(progressId, 10);
|
||||
|
||||
ret = await RunTest();
|
||||
if (!ret.IsSuccessful) return new(ret.Error);
|
||||
else if (!ret.Value) return new(new Exception("Jtag Run Test Failed"));
|
||||
_progressTracker?.AdvanceProgress(progressId, 10);
|
||||
_progressTracker.AdvanceProgress(progressId, 10);
|
||||
|
||||
ret = await ExecRDCmd(JtagCmd.JTAG_DR_CFGI);
|
||||
if (!ret.IsSuccessful) return new(ret.Error);
|
||||
else if (!ret.Value) return new(new Exception("Jtag Execute Command JTAG_DR_CFGI Failed"));
|
||||
_progressTracker?.AdvanceProgress(progressId, 10);
|
||||
_progressTracker.AdvanceProgress(progressId, 10);
|
||||
|
||||
logger.Trace("Jtag ready to write bitstream");
|
||||
|
||||
ret = await IdleDelay(100000);
|
||||
if (!ret.IsSuccessful) return new(ret.Error);
|
||||
else if (!ret.Value) return new(new Exception("Jtag IDLE Delay Failed"));
|
||||
_progressTracker?.AdvanceProgress(progressId, 10);
|
||||
_progressTracker.AdvanceProgress(progressId, 10);
|
||||
|
||||
ret = await LoadDRCareInput(bitstream, progressId: progressId);
|
||||
if (!ret.IsSuccessful) return new(ret.Error);
|
||||
|
@ -769,40 +770,40 @@ public class Jtag
|
|||
ret = await CloseTest();
|
||||
if (!ret.IsSuccessful) return new(ret.Error);
|
||||
else if (!ret.Value) return new(new Exception("Jtag Close Test Failed"));
|
||||
_progressTracker?.AdvanceProgress(progressId, 10);
|
||||
_progressTracker.AdvanceProgress(progressId, 10);
|
||||
|
||||
ret = await RunTest();
|
||||
if (!ret.IsSuccessful) return new(ret.Error);
|
||||
else if (!ret.Value) return new(new Exception("Jtag Run Test Failed"));
|
||||
_progressTracker?.AdvanceProgress(progressId, 10);
|
||||
_progressTracker.AdvanceProgress(progressId, 10);
|
||||
|
||||
ret = await ExecRDCmd(JtagCmd.JTAG_DR_JWAKEUP);
|
||||
if (!ret.IsSuccessful) return new(ret.Error);
|
||||
else if (!ret.Value) return new(new Exception("Jtag Execute Command JTAG_DR_JWAKEUP Failed"));
|
||||
_progressTracker?.AdvanceProgress(progressId, 10);
|
||||
_progressTracker.AdvanceProgress(progressId, 10);
|
||||
|
||||
logger.Trace("Jtag reset device");
|
||||
|
||||
ret = await IdleDelay(10000);
|
||||
if (!ret.IsSuccessful) return new(ret.Error);
|
||||
else if (!ret.Value) return new(new Exception("Jtag IDLE Delay Failed"));
|
||||
_progressTracker?.AdvanceProgress(progressId, 10);
|
||||
_progressTracker.AdvanceProgress(progressId, 10);
|
||||
|
||||
var retCode = await ReadStatusReg();
|
||||
if (!retCode.IsSuccessful) return new(retCode.Error);
|
||||
var jtagStatus = new JtagStatusReg(retCode.Value);
|
||||
if (!(jtagStatus.done && jtagStatus.wakeup_over && jtagStatus.init_complete))
|
||||
return new(new Exception("Jtag download bitstream failed"));
|
||||
_progressTracker?.AdvanceProgress(progressId, 10);
|
||||
_progressTracker.AdvanceProgress(progressId, 10);
|
||||
|
||||
ret = await CloseTest();
|
||||
if (!ret.IsSuccessful) return new(ret.Error);
|
||||
else if (!ret.Value) return new(new Exception("Jtag Close Test Failed"));
|
||||
logger.Trace("Jtag download bitstream successfully");
|
||||
_progressTracker?.AdvanceProgress(progressId, 10);
|
||||
_progressTracker.AdvanceProgress(progressId, 10);
|
||||
|
||||
// Finish
|
||||
_progressTracker?.AdvanceProgress(progressId, 10);
|
||||
_progressTracker.AdvanceProgress(progressId, 10);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -677,7 +677,7 @@ public sealed class UDPClientPool
|
|||
if (!udpWriteAck.Value.IsSuccessful)
|
||||
return false;
|
||||
|
||||
_progressTracker.AdvanceProgress(progressId, 10);
|
||||
_progressTracker.AdvanceProgress(progressId, 5);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -167,7 +167,8 @@ function updateStatus(newStates: boolean[], index?: number) {
|
|||
if (props.enableDigitalTwin) {
|
||||
try {
|
||||
const client = getClient();
|
||||
if (!isUndefined(index)) client.setSwitchOnOff(index, newStates[index]);
|
||||
if (!isUndefined(index))
|
||||
client.setSwitchOnOff(index + 1, newStates[index]);
|
||||
else client.setMultiSwitchsOnOff(btnStatus.value);
|
||||
} catch (error: any) {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue