Changeset 1095
- Timestamp:
- 11/06/08 14:37:35 (2 months ago)
- Files:
-
- analog/pyeac/branches/pyeac_pygame/eeepc/controlpanel.pyc (modified) (previous)
- analog/pyeac/branches/pyeac_pygame/eeepc/eac_physical.py (modified) (6 diffs)
- analog/pyeac/branches/pyeac_pygame/eeepc/eac_physical.pyc (modified) (previous)
- analog/pyeac/branches/pyeac_pygame/eeepc/pyeac.py (modified) (6 diffs)
- analog/pyeac/branches/pyeac_pygame/eeepc/raw_display.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
analog/pyeac/branches/pyeac_pygame/eeepc/eac_physical.py
r1094 r1095 63 63 (self.input_current,self.output_current) = self.eac.lla_report(self.num_desc) 64 64 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 65 70 class Pin: 66 71 … … 72 77 self.current_input = None 73 78 self.current_output = None 79 self.lla_tag = None 74 80 75 81 class PinGrid: … … 105 111 x -= 1 106 112 y -= 1 113 114 if self.grid[y][x].lla_tag != None: 115 self.lla_disable(self.grid[y][x].lla_tag) 116 107 117 if self.grid[y][x].mode != 'S': 108 118 self.grid[y][x].mode = 'S' … … 114 124 115 125 if self.lla_dict.has_key(tag): 116 return (None) 126 # update/change operation 127 self.lla_dict[tag].modify(function) 117 128 else: 129 # add operation 118 130 self.set_voltage_input(input_pin) 119 131 (x,y) = input_pin 120 132 self.grid[y-1][x-1].mode = 'L' 133 self.grid[y-1][x-1].lla_tag = tag 121 134 self.lla_dict[tag] = LLA(self.ueac, input_pin, output_pin, self.lla_count, function, period) 122 135 self.lla_count += 1 … … 148 161 x -= 1 149 162 y -= 1 163 if self.grid[y][x].lla_tag != None: 164 self.lla_disable(self.grid[y][x].lla_tag) 165 150 166 if self.grid[y][x].mode != 'V': 151 167 self.grid[y][x].mode = 'V' … … 191 207 if value == 'L': 192 208 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) 196 212 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 198 222 elif op == "current": 199 223 self.set_current_source((x,y),int(value)) analog/pyeac/branches/pyeac_pygame/eeepc/pyeac.py
r1094 r1095 36 36 37 37 pg = PinGrid(ueac_device='/dev/ttyUSB0') 38 39 # phyeac = ueac(ueac_device='/dev/ttyUSB0') # Connect to the uEAC device40 # phyeac.reset() # Reset the board to clear any previous config41 # phyeac.lof() # turn off the board Leds42 # 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 source44 # phyeac.write_i(5,5,100) # write pin (5,5) as current source45 46 38 pygame.init() 47 39 screen = pygame.display.set_mode((790,535)) … … 49 41 pygame.display.set_caption("EAC Framework") 50 42 pygame.display.set_icon(pygame.image.load('uEAC_icon.png').convert()) 51 52 43 53 44 phyeac_vis = Visualizer(absolute=True) … … 63 54 c = gui.Container(align=-1,valign=-1) 64 55 c.add(ecc,0,325) 65 # c.add(bcc,720,100)66 56 c.add(bcc,650,100) 67 57 … … 71 61 _quit = 0 72 62 73 # tb = TableBorder()74 75 63 clock = pygame.time.Clock() 76 64 while True: … … 87 75 88 76 pg.get_data() 89 90 # phyeac.read_v()91 77 phyeac_vis.update(pg) 92 78 phyeac_raw.update(pg) 93 94 # phyeac.read_i()95 # print phyeac.current_values96 # phyeac.lla_report(2)97 79 98 80 screen.fill((0,0,0)) … … 101 83 102 84 app.paint(screen) 103 104 85 pygame.display.flip() 105 86 analog/pyeac/branches/pyeac_pygame/eeepc/raw_display.py
r1094 r1095 60 60 text.write(self.master_surface,self.font,loc,(0,0,255),"Io = %d" % (value)) 61 61 if pg.grid[y][x].mode == 'L': 62 62 63 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 64 75 65 76
