def update_lights(self): # grab the current index for all active plans and merge those plans together # if there are no active plans left, then set to black if self.current_packet_plans: packets_to_merge = [x.get_current_packet() for x in self.current_packet_plans] try: packet = Lights.merge_packets(packets_to_merge, self.light_dimensions) except IndexError: self.logger.warning('Index error when merging packets, likely due to light dimensions being reallocated. Setting to black for now and expecting it to fix itself next time around') packet = Lights.make_whole_string_packet((0, 0, 0), self.light_dimensions) else: packet = Lights.make_whole_string_packet((0, 0, 0), self.light_dimensions) # invoke light updater self.light_sender.set_lights(self.name, packet)
def update_lights(self): # invoke light updater new_packet = self.main_packet_plan.get_current_packet() if self.temp_packet_plans: packets_to_merge = [new_packet] + [ x.get_current_packet() for x in self.temp_packet_plans ] try: new_packet = Lights.merge_packets(packets_to_merge, self.light_dimensions) except IndexError: self.logger.warning( 'Index error when merging packets, likely due to light dimensions being reallocated. Skipping merge and using main packet instead and expecting it to fix itself next time around' ) self.light_sender.set_lights(self.name, new_packet)