示例#1
0
    def clear_effect(self):
        if self._active_effect != None:
            self._active_effect.deactivate()
            self._active_effect = None

        if self._active:
            # Clear all the pixel data before deactiving the device
            assembled_frame = np.zeros((self.pixel_count, 3))
            self.flush(assembled_frame)
            self._ledfx.events.fire_event(
                DeviceUpdateEvent(self.id, assembled_frame))

            self.deactivate()
示例#2
0
    def thread_function(self):
        # TODO: Evaluate switching over to asyncio with UV loop optimization
        # instead of spinning a seperate thread.

        if self._active:
            self._ledfx.loop.call_later(1 / self._config['refresh_rate'],
                self.thread_function)

            # Assemble the frame if necessary, if nothing changed just sleep
            assembled_frame = self.assemble_frame()
            if assembled_frame is not None:
                if not self._config['preview_only']:
                    self.flush(assembled_frame)
                self._ledfx.events.fire_event(DeviceUpdateEvent(
                    self.id, assembled_frame))
示例#3
0
 def trigger_device_update_event():
     self._ledfx.events.fire_event(
         DeviceUpdateEvent(self.id, assembled_frame))