def run(): """ Run this effect until hyperion aborts. """ effect = Effect() # Keep this thread alive while not hyperion.abort(): time.sleep(1) effect.stop()
def run_json(host, port, interval): from app.json_client import JsonClient sleep_time = interval / 1000.0 json_client = JsonClient(host, port) json_client.connect() while not hyperion.abort(): json_client.send_led_data(hyperion.get_led_data()) time.sleep(sleep_time) json_client.disconnect()
def run_proto(host, port, interval): from lib.hyperion.Hyperion import Hyperion proto_client = Hyperion(host, port) sleep_time = interval / 1000.0 while not hyperion.abort(): w, h, c = hyperion.get_image_data() # print "Sending proto: {}, {}, {}\n".format(w, h, len(c)) # if w < 1 or h < 1 or len(c) is not w*h*3: # continue proto_client.sendImage(w, h, c) time.sleep(sleep_time)
def receive_magnitudes(self, magnitudes): if hyperion.abort(): self.stop() # Don't update when processing if self.processing: return else: self._magnitudes = magnitudes self.update_leds() hyperion.setColor(self._leds_data)
def receive_magnitudes(self, magnitudes): if hyperion.abort(): self.stop() # Don't update when processing if self.processing: return else: self._magnitudes = magnitudes gain = max(0.3, self.mag_to_gain(0.5 * (self._magnitudes[0] + self._magnitudes[2]))) hyperion.setGain(gain)
def run(): allEffects = AllEffects() randomSleepTime = allEffects.newRandomTime() allEffects.startEffect() # Keep this thread alive while not hyperion.abort(): time.sleep(1) randomSleepTime -= 1 if randomSleepTime <= 0: randomSleepTime = allEffects.newRandomTime() allEffects.startEffect() allEffects.effect.stop()