增加指令打印日志

This commit is contained in:
chenjiangqun
2026-06-30 18:56:58 +08:00
parent 32409ebe2b
commit 6042411a01

View File

@@ -248,33 +248,30 @@ namespace WinISP.BaseClass
{
throw new NotImplementedException();
}
public bool WriteData(byte[] data)
{
Byte slvAddr = data[0];
Byte[] wrBuf = new Byte[data.Length - 1];
Array.Copy(data, 1, wrBuf, 0, wrBuf.Length);
const Byte maxWrLen = 16;
int idx = 0;
unsafe
{
fixed (Byte* pArr = wrBuf)
{
return DDCWrite(pGraphicCardCtrl, slvAddr, (uint)(wrBuf.Length), wrBuf);
}
}
bool ret = DDCWrite(pGraphicCardCtrl, slvAddr, (uint)wrBuf.Length, wrBuf);
frmISP.WriteLog($"[DDCWrite] card={GraphicCardType} slv=0x{slvAddr:X2} len={wrBuf.Length} ret={ret}", ret ? "debug" : "error");
return ret;
}
public bool ReadData(byte[] data, byte[] wrCmds = null)
{
uint revlen = (uint)data.Length;
unsafe
if (wrCmds == null || wrCmds.Length == 0)
{
fixed (Byte* pArr = data)
{
return DDCRead(pGraphicCardCtrl, wrCmds[0], revlen, data);
}
frmISP.WriteLog($"[DDCRead] card={GraphicCardType} wrCmds is NULL/empty!", "error");
return false;
}
uint revlen = (uint)data.Length;
bool ret = DDCRead(pGraphicCardCtrl, wrCmds[0], revlen, data);
frmISP.WriteLog($"[DDCRead] card={GraphicCardType} slv=0x{wrCmds[0]:X2} rdLen={revlen} ret={ret} " +
$"first4={(data.Length >= 4 ? BitConverter.ToString(data, 0, 4) : "n/a")}", ret ? "debug" : "error");
return ret;
}
public bool Init()