增加指令打印日志

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

View File

@@ -254,27 +254,24 @@ namespace WinISP.BaseClass
Byte slvAddr = data[0]; Byte slvAddr = data[0];
Byte[] wrBuf = new Byte[data.Length - 1]; Byte[] wrBuf = new Byte[data.Length - 1];
Array.Copy(data, 1, wrBuf, 0, wrBuf.Length); Array.Copy(data, 1, wrBuf, 0, wrBuf.Length);
const Byte maxWrLen = 16;
int idx = 0; bool ret = DDCWrite(pGraphicCardCtrl, slvAddr, (uint)wrBuf.Length, wrBuf);
unsafe frmISP.WriteLog($"[DDCWrite] card={GraphicCardType} slv=0x{slvAddr:X2} len={wrBuf.Length} ret={ret}", ret ? "debug" : "error");
{ return ret;
fixed (Byte* pArr = wrBuf)
{
return DDCWrite(pGraphicCardCtrl, slvAddr, (uint)(wrBuf.Length), wrBuf);
}
}
} }
public bool ReadData(byte[] data, byte[] wrCmds = null) public bool ReadData(byte[] data, byte[] wrCmds = null)
{ {
uint revlen = (uint)data.Length; if (wrCmds == null || wrCmds.Length == 0)
unsafe
{ {
fixed (Byte* pArr = data) frmISP.WriteLog($"[DDCRead] card={GraphicCardType} wrCmds is NULL/empty!", "error");
{ return false;
return DDCRead(pGraphicCardCtrl, wrCmds[0], revlen, data);
}
} }
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() public bool Init()