diff --git a/LibDmd/Costura32/zedmd.dll b/LibDmd/Costura32/zedmd.dll index 6ab80c9e..07b4c7ac 100644 Binary files a/LibDmd/Costura32/zedmd.dll and b/LibDmd/Costura32/zedmd.dll differ diff --git a/LibDmd/Costura64/zedmd64.dll b/LibDmd/Costura64/zedmd64.dll index 2e24d66f..32bcdd37 100644 Binary files a/LibDmd/Costura64/zedmd64.dll and b/LibDmd/Costura64/zedmd64.dll differ diff --git a/LibDmd/Output/ZeDMD/ZeDMDBase.cs b/LibDmd/Output/ZeDMD/ZeDMDBase.cs index ef438e73..1593ceaf 100644 --- a/LibDmd/Output/ZeDMD/ZeDMDBase.cs +++ b/LibDmd/Output/ZeDMD/ZeDMDBase.cs @@ -27,14 +27,16 @@ public abstract class ZeDMDBase protected ColoredFrame _lastFrame = null; private GCHandle handle; - protected void LogHandler(IntPtr format, IntPtr args, IntPtr pUserData) + protected void LogHandler(string format, IntPtr args, IntPtr pUserData) { + Logger.Debug("Trying to convert libzedmd log message: " + format); Logger.Info("libzedmd: " + Marshal.PtrToStringAnsi(ZeDMD_FormatLogMessage(format, args, pUserData))); } protected void Init() { _pZeDMD = ZeDMD_GetInstance(); + Logger.Info("Using libzedmd version " + DriverVersion); ZeDMD_LogCallback callbackDelegate = new ZeDMD_LogCallback(LogHandler); // Keep a reference to the delegate to prevent GC from collecting it @@ -114,7 +116,7 @@ public void ClearColor() protected static extern IntPtr ZeDMD_GetInstance(); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - protected delegate void ZeDMD_LogCallback(IntPtr format, IntPtr args, IntPtr pUserData); + protected delegate void ZeDMD_LogCallback(string format, IntPtr args, IntPtr pUserData); #if PLATFORM_X64 [DllImport("zedmd64.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] @@ -128,7 +130,7 @@ public void ClearColor() #else [DllImport("zedmd.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] #endif - protected static extern IntPtr ZeDMD_FormatLogMessage(IntPtr format, IntPtr args, IntPtr pUserData); + protected static extern IntPtr ZeDMD_FormatLogMessage(string format, IntPtr args, IntPtr pUserData); #if PLATFORM_X64 [DllImport("zedmd64.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] diff --git a/LibDmd/Output/ZeDMD/ZeDMDUsbBase.cs b/LibDmd/Output/ZeDMD/ZeDMDUsbBase.cs index 90e82fc5..aa3e51b8 100644 --- a/LibDmd/Output/ZeDMD/ZeDMDUsbBase.cs +++ b/LibDmd/Output/ZeDMD/ZeDMDUsbBase.cs @@ -18,25 +18,25 @@ public abstract class ZeDMDUsbBase : ZeDMDBase base.Init(); if (!string.IsNullOrEmpty(Port)) { - ZeDMD_SetDevice(_pZeDMD, @"\\.\" + Port); + ZeDMD_SetDevice(_pZeDMD, Port); } IsAvailable = ZeDMD_Open(_pZeDMD); if (!IsAvailable) { if (string.IsNullOrEmpty(Port)) { - Logger.Info(Name + " device not found at any port, libzedmd version: " + DriverVersion); + Logger.Info(Name + " device not found at any port"); } else { - Logger.Info(Name + " device not found at port " + Port + ", libzedmd version: " + DriverVersion); + Logger.Info(Name + " device not found at port " + Port); } return; } if (string.IsNullOrEmpty(Port)) { - Logger.Info(Name + " " + Marshal.PtrToStringAnsi(ZeDMD_GetFirmwareVersion(_pZeDMD)) + " device found, libzedmd version: " + DriverVersion); + Logger.Info(Name + " " + Marshal.PtrToStringAnsi(ZeDMD_GetFirmwareVersion(_pZeDMD)) + " device found, USB package size " + ZeDMD_GetUsbPackageSize(_pZeDMD)); } else { - Logger.Info(Name + " " + Marshal.PtrToStringAnsi(ZeDMD_GetFirmwareVersion(_pZeDMD)) + " device found at port " + Port + ", libzedmd version: " + DriverVersion); + Logger.Info(Name + " " + Marshal.PtrToStringAnsi(ZeDMD_GetFirmwareVersion(_pZeDMD)) + " device found at port " + Port + ", USB package size " + ZeDMD_GetUsbPackageSize(_pZeDMD)); } } @@ -54,6 +54,13 @@ public abstract class ZeDMDUsbBase : ZeDMDBase #endif protected static extern bool ZeDMD_Open(IntPtr pZeDMD); +#if PLATFORM_X64 + [DllImport("zedmd64.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport("zedmd.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] +#endif + protected static extern int ZeDMD_GetUsbPackageSize(IntPtr pZeDMD); + #endregion } } diff --git a/LibDmd/Output/ZeDMD/ZeDMDWiFiBase.cs b/LibDmd/Output/ZeDMD/ZeDMDWiFiBase.cs index 5711d044..7a89a153 100644 --- a/LibDmd/Output/ZeDMD/ZeDMDWiFiBase.cs +++ b/LibDmd/Output/ZeDMD/ZeDMDWiFiBase.cs @@ -24,10 +24,10 @@ public abstract class ZeDMDWiFiBase : ZeDMDBase if (!IsAvailable) { - Logger.Info(Name + " device not found, libzedmd version: " + DriverVersion); + Logger.Info(Name + " device not found"); return; } - Logger.Info(Name + " " + Marshal.PtrToStringAnsi(ZeDMD_GetFirmwareVersion(_pZeDMD)) + " device found, libzedmd version: " + DriverVersion); + Logger.Info(Name + " " + Marshal.PtrToStringAnsi(ZeDMD_GetFirmwareVersion(_pZeDMD)) + " device found, UDP delay " + ZeDMD_GetUdpDelay(_pZeDMD) + "ms"); } #region libzedmd @@ -51,6 +51,14 @@ public abstract class ZeDMDWiFiBase : ZeDMDBase #endif protected static extern bool ZeDMD_OpenWiFi(IntPtr pZeDMD, string ip); +#if PLATFORM_X64 + [DllImport("zedmd64.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport("zedmd.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] +#endif + protected static extern int ZeDMD_GetUdpDelay(IntPtr pZeDMD); + + #endregion } }