Changeset 213 for trunk/brainstorms/Puzzlebox
- Timestamp:
- 11/19/10 12:45:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/brainstorms/Puzzlebox/Brainstorms/Helicopter_Control.py
r212 r213 10 10 11 11 __changelog__ = """ 12 Last Update: 2010.11.1 712 Last Update: 2010.11.18 13 13 14 14 """ … … 36 36 ##################################################################### 37 37 38 DEBUG = 238 DEBUG = 3 39 39 40 40 DEFAULT_COMMAND = 'dump_packets' 41 41 42 42 SERIAL_DEVICE = '/dev/ttyUSB0' 43 DEFAULT_SERIAL_BAUDRATE = 115200 44 #DEFAULT_SERIAL_BAUDRATE = 125000 43 DEFAULT_SERIAL_BAUDRATE = 115200 # This is the closest "standard" baud rate the USB-to-Serial device will support 44 #DEFAULT_SERIAL_BAUDRATE = 125000 # This is the speed reported by the forum post 45 #DEFAULT_SERIAL_BAUDRATE = 133333 # This is the speed reported by the logic analyzer 46 #DEFAULT_SERIAL_BAUDRATE = 230400 # This is the next highest "standard" baud rate the USB-to-Serial device will support 45 47 DEFAULT_MODE = 'read' 46 48 … … 52 54 PACKET_LENGTH = 14 53 55 PAYLOAD_MINIMUM_LENGTH = 8 56 PACKET_READ_SIZE = 11 54 57 ECHO_ON = False 55 58 … … 60 63 'no_thrust': '\x80\xac\xdf\xa2\x9a\xb0\x8b\x8d\x54', \ 61 64 'minimum_thrust': '\x80\x59\x68\x81\x86\xd1\xa4\x29', \ 62 'maximum_thrust': '\x8 3\xad\xdf\x91\xe0\x83\x12\x8d\x54', \65 'maximum_thrust': '\x80\x83\xad\xe7\xa2\xad\xf0\x8b\x8d\x54\xff', 63 66 'test_packet': '\x00\x00\x03\x54\x06\x15\x09\xca\x0e\x2f\x13\x54\x14\xaa', \ 64 67 'maximum_forward': '\x83\xad\xde\x11\xcd\xb0\x8b\x8d\x54', \ … … 664 667 while self.keep_running: 665 668 669 670 # High-Speed Echo Mode 671 if (self.DEBUG > 3) and ECHO_ON: 672 byte = self.device.recv(PACKET_READ_SIZE) 673 self.device.write(byte) 674 continue 675 676 666 677 try: 667 678 #byte = self.device.read() 668 byte = self.device.recv( 1)679 byte = self.device.recv(PACKET_READ_SIZE) 669 680 670 if ECHO_ON:671 681 #if ECHO_ON: 682 self.device.write(byte) 672 683 673 684 if (len(byte) != 0): … … 675 686 print "Device read:", 676 687 print byte, 688 if ECHO_ON: 689 print byte.encode("hex"), 690 print "wrote:", 677 691 print byte.encode("hex") 678 692 … … 705 719 if self.DEBUG > 1: 706 720 print "Device wrote:", 707 print buffer 721 print buffer, 708 722 print buffer.encode("hex") 709 723
Note: See TracChangeset
for help on using the changeset viewer.