Changeset 1095

Show
Ignore:
Timestamp:
11/06/08 14:37:35 (2 months ago)
Author:
bhimebau
Message:

completed basic functionality - ready for beta test

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • analog/pyeac/branches/pyeac_pygame/eeepc/eac_physical.py

    r1094 r1095  
    6363        (self.input_current,self.output_current) = self.eac.lla_report(self.num_desc) 
    6464 
     65    def modify(self,function): 
     66        if function >= 1 and function <= 27: 
     67            self.function = function 
     68            self.eac.lla_add(self.input_pin,self.output_pin,self.num_desc,function,self.period) 
     69 
    6570class Pin: 
    6671 
     
    7277        self.current_input = None 
    7378        self.current_output = None 
     79        self.lla_tag = None 
    7480 
    7581class PinGrid: 
     
    105111        x -= 1 
    106112        y -= 1 
     113 
     114        if self.grid[y][x].lla_tag != None: 
     115            self.lla_disable(self.grid[y][x].lla_tag) 
     116 
    107117        if self.grid[y][x].mode != 'S': 
    108118            self.grid[y][x].mode = 'S' 
     
    114124 
    115125        if self.lla_dict.has_key(tag): 
    116             return (None) 
     126            # update/change operation 
     127            self.lla_dict[tag].modify(function) 
    117128        else: 
     129            # add operation 
    118130            self.set_voltage_input(input_pin) 
    119131            (x,y) = input_pin 
    120132            self.grid[y-1][x-1].mode = 'L' 
     133            self.grid[y-1][x-1].lla_tag = tag  
    121134            self.lla_dict[tag] = LLA(self.ueac, input_pin, output_pin, self.lla_count, function, period) 
    122135            self.lla_count += 1 
     
    148161        x -= 1 
    149162        y -= 1 
     163        if self.grid[y][x].lla_tag != None: 
     164            self.lla_disable(self.grid[y][x].lla_tag) 
     165 
    150166        if self.grid[y][x].mode != 'V': 
    151167            self.grid[y][x].mode = 'V' 
     
    191207                if value == 'L': 
    192208                    current_value_key = "%d,%d,function"%(x,y) 
    193                     self.lla_add("lla1",(x,y),(0,0),int(full_form[current_value_key]),1
    194                     print int(full_form[current_value_key]) 
    195             #                     print "need to add lla" 
     209                    value = int(full_form[current_value_key]
     210                    if value > 0 and value < 27: 
     211                        self.lla_add("L%d,%d"%(x,y),(x,y),(0,0),value,1) 
    196212            elif op == 'function': 
    197                 print "lla function changed to",value 
     213                try: 
     214                    value = int(value) 
     215                    valid_value = True 
     216                except ValueError: 
     217                    valid_value = False 
     218                     
     219                if valid_value and value > 0 and value < 28: 
     220                    self.lla_add("L%d,%d"%(x,y),(x,y),(0,0),value,1) 
     221                 
    198222            elif op == "current": 
    199223                self.set_current_source((x,y),int(value)) 
  • analog/pyeac/branches/pyeac_pygame/eeepc/pyeac.py

    r1094 r1095  
    3636     
    3737    pg = PinGrid(ueac_device='/dev/ttyUSB0') 
    38  
    39 #     phyeac = ueac(ueac_device='/dev/ttyUSB0')  # Connect to the uEAC device 
    40 #     phyeac.reset()                             # Reset the board to clear any previous config  
    41 #     phyeac.lof()                               # turn off the board Leds 
    42 #     phyeac.lla_add(3,3,1)                        # Instantiate an lla at position (3,3).  
    43 #     phyeac.write_i(1,1,100)                    # write pin (1,1) as current source 
    44 #     phyeac.write_i(5,5,100)                    # write pin (5,5) as current source 
    45      
    4638    pygame.init() 
    4739    screen = pygame.display.set_mode((790,535)) 
     
    4941    pygame.display.set_caption("EAC Framework") 
    5042    pygame.display.set_icon(pygame.image.load('uEAC_icon.png').convert()) 
    51  
    5243 
    5344    phyeac_vis = Visualizer(absolute=True) 
     
    6354    c = gui.Container(align=-1,valign=-1) 
    6455    c.add(ecc,0,325) 
    65  #    c.add(bcc,720,100) 
    6656    c.add(bcc,650,100) 
    6757 
     
    7161    _quit = 0 
    7262     
    73 #     tb = TableBorder() 
    74  
    7563    clock = pygame.time.Clock() 
    7664    while True: 
     
    8775 
    8876        pg.get_data() 
    89  
    90 #         phyeac.read_v() 
    9177        phyeac_vis.update(pg) 
    9278        phyeac_raw.update(pg) 
    93  
    94 #         phyeac.read_i() 
    95     #    print phyeac.current_values 
    96 #         phyeac.lla_report(2) 
    9779 
    9880        screen.fill((0,0,0)) 
     
    10183 
    10284        app.paint(screen) 
    103  
    10485        pygame.display.flip() 
    10586 
  • analog/pyeac/branches/pyeac_pygame/eeepc/raw_display.py

    r1094 r1095  
    6060                        text.write(self.master_surface,self.font,loc,(0,0,255),"Io = %d" % (value)) 
    6161                if pg.grid[y][x].mode == 'L': 
     62 
    6263                    loc = ((xoffset)+x*60,(yoffset+10)+y*60) 
    63                     text.write(self.master_surface,self.font,loc,(255,255,0),"LLA") 
     64                    value = pg.lla_dict[pg.grid[y][x].lla_tag].function 
     65                    text.write(self.master_surface,self.font,loc,(255,255,0),"f() = %d" %(int (value))) 
     66 
     67                    loc = ((xoffset)+x*60,(yoffset+20)+y*60) 
     68                    value = pg.lla_dict[pg.grid[y][x].lla_tag].input_current 
     69                    text.write(self.master_surface,self.font,loc,(255,255,0),"Li = %d" %(int (value))) 
     70                     
     71                    loc = ((xoffset)+x*60,(yoffset+30)+y*60) 
     72                    value = pg.lla_dict[pg.grid[y][x].lla_tag].output_current 
     73                    text.write(self.master_surface,self.font,loc,(255,255,0),"Lo = %d" %(int (value))) 
     74 
    6475                                                        
    6576