Example #1
0
    def readConfig(self):
        #read in the file
        print "reading configuration file from %s" % self.config_path
        with open(self.config_path, 'rb') as cfg:
            configuration = pickle.load(cfg)
            if 'teensys' not in configuration.keys():
                print "Error line 51"
                return False
            self.teensy_config = configuration['teensys']

        
        self.leds_per_strut = configuration['leds_per_strut']
        self.struts_per_strand = configuration['struts_per_strand']
        self.leds_per_strand = self.leds_per_strut * self.struts_per_strand
        self.packer = packer(self.leds_per_strut * self.struts_per_strand)

        #map firemix strands to teensy/octo strand pairs
        for teensy_num in self.teensy_config.keys(): 
            self.frames[teensy_num] = bytearray(8*3*self.leds_per_strand)
            strand_dict = self.teensy_config[teensy_num]
            for key in strand_dict.keys():
                strand = key
                octo_strand = strand_dict[key]
                self.strands[strand] = (teensy_num, octo_strand)
        print "readConfig successful"
        return True
Example #2
0
    def readConfig(self):
        #read in the file
        print "reading configuration file from %s" % self.config_path
        with open(self.config_path, 'rb') as cfg:
            configuration = pickle.load(cfg)
            if 'teensys' not in configuration.keys():
                print "Error line 51"
                return False
            self.teensy_config = configuration['teensys']

        self.leds_per_strut = configuration['leds_per_strut']
        self.struts_per_strand = configuration['struts_per_strand']
        self.leds_per_strand = self.leds_per_strut * self.struts_per_strand
        self.packer = packer(self.leds_per_strut * self.struts_per_strand)

        #map firemix strands to teensy/octo strand pairs
        for teensy_num in self.teensy_config.keys():
            self.frames[teensy_num] = bytearray(8 * 3 * self.leds_per_strand)
            strand_dict = self.teensy_config[teensy_num]
            for key in strand_dict.keys():
                strand = key
                octo_strand = strand_dict[key]
                self.strands[strand] = (teensy_num, octo_strand)
        print "readConfig successful"
        return True
Example #3
0
 def __init__(self):
     self.strands = {} #dict from teensy numbers to active octo-strands
     self.teensyFiles = [] #list of files in /dev
     self.teensy_nums = []
     self.serials = {} #map from teensys numbers to serial connections
     self.serial_map = {} #map from serial connections to teensy numbers
     self.packer = packer(leds_per_strut*struts_per_strand)
     self.frame = teensyFrame(struts_per_strand, leds_per_strut)
     self.struts = {} #dict from (teensy number, strand, strut) to (front_coord, back_coord, color_format)
     self.strand_count = 0
     self.strand_map = {} #map from (teensy, octo-strand) to firemix strand
Example #4
0
 def __init__(self):
     self.strands = {}  #dict from teensy numbers to active octo-strands
     self.teensyFiles = []  #list of files in /dev
     self.teensy_nums = []
     self.serials = {}  #map from teensys numbers to serial connections
     self.serial_map = {}  #map from serial connections to teensy numbers
     self.packer = packer(leds_per_strut * struts_per_strand)
     self.frame = teensyFrame(struts_per_strand, leds_per_strut)
     self.struts = {
     }  #dict from (teensy number, strand, strut) to (front_coord, back_coord, color_format)
     self.strand_count = 0
     self.strand_map = {}  #map from (teensy, octo-strand) to firemix strand
Example #5
0
        


@profile 
def sendFrame(frame):
    p.packForOcto(frame)
    ser1.write(header)
    ser1.write(p.cur_frame)
    ser2.write(header)
    ser2.write(p.cur_frame)
    ser3.write(header)
    ser3.write(p.cur_frame)


#ser.read(1)

p = packer(240)
print header
print p.cur_frame[0:100]
print len(p.cur_frame)

for i in range(5):
    sendFrame(frame)
    #incFrame(frame)

ser1.close()
ser2.close()
ser3.close()
    

Example #6
0
        frame[i * 3] = (frame[i * 3] + 1) % 256
        frame[i * 3 + 1] = frame[i * 3 + 1]
        frame[i * 3 + 2] = (frame[i * 3 + 2] - 1) % 256


@profile
def sendFrame(frame):
    p.packForOcto(frame)
    ser1.write(header)
    ser1.write(p.cur_frame)
    ser2.write(header)
    ser2.write(p.cur_frame)
    ser3.write(header)
    ser3.write(p.cur_frame)


#ser.read(1)

p = packer(240)
print header
print p.cur_frame[0:100]
print len(p.cur_frame)

for i in range(5):
    sendFrame(frame)
    #incFrame(frame)

ser1.close()
ser2.close()
ser3.close()