def find_lixada_port(self): """Auto-detect CP2102 or CH340 serial port.""" ports = serial.tools.list_ports.comports() for port in ports: # CP2102 or CH340 typically used in Lixada dongles if 'CP210' in port.description or 'CP210' in port.product or \ 'CH340' in port.description or 'CH34' in port.vid: return port.device # Fallback: any USB serial port (user confirms) if 'USB Serial' in port.description or 'UART' in port.description: print(f"Possible DMX port found: port.device - port.description") # Return first candidate return port.device return None
def start_continuous_sending(self, fps=44): """ Start background thread sending DMX continuously. Standard DMX refresh rate is ~44Hz (22-44 Hz typical). """ if self.running: return self.running = True self._sender_thread = threading.Thread(target=self._continuous_sender, args=(fps,), daemon=True) self._sender_thread.start() print(f"Continuous DMX sending started at fps FPS")
def send_frame(self): """Send current DMX data immediately.""" with self.lock: data_copy = bytes(self.dmx_data) self._send_dmx_frame(data_copy) lixada usb dmx 512 driver windows 10
""" Lixada USB DMX512 driver replacement (Windows 10) Uses direct serial port communication with Open DMX protocol. """ import serial import serial.tools.list_ports import time import threading import sys
def _open_serial(self): """Open serial port with DMX timing parameters.""" try: self.serial = serial.Serial( port=self.com_port, baudrate=250000, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_TWO, timeout=0, write_timeout=0 ) print(f"✅ Lixada DMX connected on self.com_port") except Exception as e: raise RuntimeError(f"Failed to open self.com_port: e") """ import serial import serial
def close(self): """Release serial port.""" self.stop_continuous_sending() if self.serial and self.serial.is_open: self.blackout() self.send_frame() self.serial.close() print("DMX interface closed")
def stop_continuous_sending(self): """Stop background DMX transmission.""" self.running = False if hasattr(self, '_sender_thread'): self._sender_thread.join(timeout=0.5) val in channel_values_dict.items(): self.set_channel(ch
def set_channels(self, channel_values_dict): """Set multiple channels at once.""" for ch, val in channel_values_dict.items(): self.set_channel(ch, val)