Ejemplo n.º 1
0
	def _get_devices(self):
		for device in driver.find_liquidctl_devices():
			device.connect()
			device_info = device.initialize()
			device_name = device.description.replace(" (experimental)", "") #As of liquidctl:1.4.2, this no longer seems to contain "experimental" but I'll leave for compatibility
			self.devices[device_name] = {"device": device,
 						     "version": device_info[0][1],
						     "channels": {}}
			self.data[device_name] = {}
			device_channels = self.devices[device_name]["channels"]
			for line in device_info[1:]:
				channel = line[0][:5].lower().replace(" ","")
				if channel not in device_channels:
					device_channels[channel] = []
					self.data[device_name][channel] = {
						"per_led": {
							"colours":[[255]*3]*40,
							"group_size":1,
							"speed":3.0,
							"breathing":0},
						"animations": {
							"colours":[],
							"mode":"fading",
							"length":3.0,
							"backwards":0}}
				length = line[1].value * 2
				device_channels[channel].append(length)
			for ind in range(len(device_channels)):
				prev = list(device_channels.keys())[ind]
				while len(device_channels[prev])!=4:
					device_channels[prev].append(0)
Ejemplo n.º 2
0
 def _get_smart_driver(self):
     return next((dev for dev in find_liquidctl_devices()
                  if isinstance(dev, SmartDeviceV2Driver)), None)
Ejemplo n.º 3
0
def list_devices():
    devices = []
    for dev in find_liquidctl_devices():
        devices.append(dev.description)
    return devices
Ejemplo n.º 4
0
 def provide_kraken_two_driver(self) -> Optional[KrakenTwoDriver]:
     _LOG.debug("provide KrakenTwoDriver")
     return next((dev for dev in find_liquidctl_devices()
                  if isinstance(dev, KrakenTwoDriver)), None)
Ejemplo n.º 5
0
                        exit()
                    set_colours(colours)

        print(f"Running gradient with {delay * 1000}ms delay")
        self._thread_run = Thread(target=run_)
        self._thread_run.start()
        input("Enter to stop")
        self.run = 0


if __name__ == "__main__":
    from liquidctl import driver
    from time import sleep
    from threading import Thread
    devices = []
    for device in driver.find_liquidctl_devices():
        device.connect()
        devices.append(device)

    def ambi():
        amb = Ambient(10, 16, sampling=True, sampling_weighted=True)
        amb.run(devices[0])
#    all_colours = Marquee(26, 4, [0,0,125], [[255,0,0]], number_of_marquees=3, spacing=10)# .06

    def gradi():
        grad = Gradient(26, cross_channels=0)
        grad.generate(
            [[255, 0, 50], [255, 0, 255], [50, 0, 255], [0, 200, 255]],
            mode="wave",
            step=int(input("Step: ")))
        grad.run(devices[0], delay=float(input("Delay: ")) / 1000)