增加指令打印日志
This commit is contained in:
@@ -248,33 +248,30 @@ namespace WinISP.BaseClass
|
|||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool WriteData(byte[] data)
|
public bool WriteData(byte[] data)
|
||||||
{
|
{
|
||||||
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()
|
||||||
|
|||||||
Reference in New Issue
Block a user