Skip to content

Commit ca65399

Browse files
author
marcusw
committed
Branch v1.0.1 should have been a tag.
1 parent cfd98dd commit ca65399

File tree

12 files changed

+136
-468
lines changed

12 files changed

+136
-468
lines changed

LICENSE renamed to LICENSE.txt

File renamed without changes.

MANIFEST.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
include docs/*.html *.url *.css *.txt
2-
include README LICENSE
3-
include examples/*.py
2+
include README.txt LICENSE.txt

README renamed to README.txt

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@ Releases halted in May 2007.
99
NXT-Python is based on NXT_Python, but is significantly newer, and, as time
1010
goes on, different/better. This is NXT-Python.
1111

12-
For support, you can ask on the mailing list at:
13-
http://groups.google.com/group/nxt-python
14-
You can report bugs to the bug tracker here:
15-
http://code.google.com/p/nxt-python/issues/list
16-
17-
Note: NXT-Python has not been tested and may not work with
18-
custom nxt firmware versions (if you don't know what that means, you don't
19-
need to worry about it).
20-
2112
Requirements:
2213

2314
* Python 2.6 (http://www.python.org)
@@ -31,11 +22,11 @@ Installation:
3122
* In package directory, run "python setup.py install" (as root), or if
3223
under windows, copy the nxt folder to the site-packages
3324
directory in your python installation.
34-
* For USB on Linux, at a root terminal type:
35-
groupadd lego
36-
usermod -a -G lego [username]
37-
echo 'BUS=="usb", SYSFS{idVendor}=="0694", GROUP="lego", MODE="0660"' > \
38-
/etc/udev/rules.d/70-lego.rules
25+
* For USB on Linux, create udev rule:
26+
27+
Create file at /etc/udev/rules.d/70-lego.rules, containing one line:
28+
29+
BUS=="usb", SYSFS{idVendor}=="0694", GROUP="lego", MODE="0660"
3930

4031
Contact:
4132
NXT_Python's Author:

docs/nxt_python.html

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,15 @@ <h2>Requirements</h2>
5555
</ul>
5656
<h2>Download</h2>
5757
<ul>
58-
<li>Version 1.1<br/>
59-
&mdash;New motor functions, namely run() and stop().<br/>
60-
&mdash;Motor braking is finally usable!<br/>
61-
&mdash;Slightly changed behavior when there are errors searching for a brick.<br/>
62-
&mdash;New server functionality for light sensor illumination.
58+
<li>Version 1.0.1<br/>
59+
&mdash;Motor braking bugfix by Steve Castellotti.
6360
<ul>
64-
<li><a href='http://NXT-Python.googlecode.com/files/nxt-python-1.1.zip'>nxt-python-1.1.zip</a>
65-
source ZIP archive</li>
66-
<li><a href='http://NXT-Python.googlecode.com/files/nxt-python-1.1.win32.exe'>nxt-python-1.1.win32.exe</a>
67-
source ZIP archive</li>
68-
<li><a href='http://NXT-Python.googlecode.com/files/nxt-python-1.1.win-amd64.exe'>nxt-python-1.1.win-amd64.exe</a>
61+
<li><a href='http://NXT-Python.googlecode.com/files/NXT-Python-1.0.1.zip'>NXT-Python-1.0.1.zip</a>
6962
source ZIP archive</li>
63+
<li><a href='http://NXT-Python.googlecode.com/files/NXT-Python-1.0.1.win32.exe'>NXT-Python-1.0.1.win32.exe</a>
64+
x86 windows installer</li>
65+
<li><a href='http://NXT-Python.googlecode.com/files/NXT-Python-1.0.1.win-amd64.exe'>NXT-Python-1.0.1.win-amd64.exe</a>
66+
x64 windows installer</li>
7067
</ul>
7168
</li>
7269
</ul>
@@ -78,9 +75,9 @@ <h2>Download</h2>
7875
<li><a href='http://NXT-Python.googlecode.com/files/NXT-Python-1.0.zip'>NXT-Python-1.0.zip</a>
7976
source ZIP archive</li>
8077
<li><a href='http://NXT-Python.googlecode.com/files/NXT-Python-1.0.win32.exe'>NXT-Python-1.0.win32.exe</a>
81-
source ZIP archive</li>
78+
x86 windows installer</li>
8279
<li><a href='http://NXT-Python.googlecode.com/files/NXT-Python-1.0.win-amd64.exe'>NXT-Python-1.0.win-amd64.exe</a>
83-
source ZIP archive</li>
80+
x64 windows installer</li>
8481
</ul>
8582
</li>
8683
</ul>
@@ -93,9 +90,9 @@ <h2>Download</h2>
9390
<li><a href='http://NXT-Python.googlecode.com/files/NXT-Python-0.9.zip'>NXT-Python-0.9.zip</a>
9491
source ZIP archive</li>
9592
<li><a href='http://NXT-Python.googlecode.com/files/NXT-Python-0.9.win32.exe'>NXT-Python-0.9.win32.exe</a>
96-
source ZIP archive</li>
93+
x86 windows installer</li>
9794
<li><a href='http://NXT-Python.googlecode.com/files/NXT-Python-0.9.win-amd64.exe'>NXT-Python-0.9.win-amd64.exe</a>
98-
source ZIP archive</li>
95+
x64 windows installer</li>
9996
</ul>
10097
</li>
10198
</ul>
@@ -107,9 +104,9 @@ <h2>Download</h2>
107104
<li><a href='http://NXT-Python.googlecode.com/files/NXT-Python-0.8.1.zip'>NXT-Python-0.8.1.zip</a>
108105
source ZIP archive</li>
109106
<li><a href='http://NXT-Python.googlecode.com/files/NXT-Python-0.8.1.win32.exe'>NXT-Python-0.8.1.win32.exe</a>
110-
source ZIP archive</li>
107+
x86 windows installer</li>
111108
<li><a href='http://NXT-Python.googlecode.com/files/NXT-Python-0.8.1.win-amd64.exe'>NXT-Python-0.8.1.win-amd64.exe</a>
112-
source ZIP archive</li>
109+
x64 windows installer</li>
113110
</ul>
114111
</li>
115112
</ul>
@@ -123,9 +120,9 @@ <h2>Download</h2>
123120
<li><a href='http://NXT-Python.googlecode.com/files/NXT-Python-0.8.zip'>NXT-Python-0.8.zip</a>
124121
source ZIP archive</li>
125122
<li><a href='http://NXT-Python.googlecode.com/files/NXT-Python-0.8.win32.exe'>NXT-Python-0.8.win32.exe</a>
126-
source ZIP archive</li>
123+
x86 windows installer</li>
127124
<li><a href='http://NXT-Python.googlecode.com/files/NXT-Python-0.8.win-amd64.exe'>NXT-Python-0.8.win-amd64.exe</a>
128-
source ZIP archive</li>
125+
x64 windows installer</li>
129126
</ul>
130127
</li>
131128
</ul>

nxt/bluesock.py

Lines changed: 47 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -12,67 +12,64 @@
1212
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1313
# GNU General Public License for more details.
1414

15-
try:
16-
import bluetooth
17-
except ImportError:
18-
import lightblueglue as bluetooth
15+
import bluetooth
1916
import os
20-
from .brick import Brick
17+
from nxt.brick import Brick
2118

2219
class BlueSock(object):
2320

24-
bsize = 118 # Bluetooth socket block size
25-
PORT = 1 # Standard NXT rfcomm port
21+
bsize = 118 # Bluetooth socket block size
22+
PORT = 1 # Standard NXT rfcomm port
2623

27-
def __init__(self, host):
28-
self.host = host
29-
self.sock = None
30-
self.debug = False
24+
def __init__(self, host):
25+
self.host = host
26+
self.sock = None
27+
self.debug = False
3128

32-
def __str__(self):
33-
return 'Bluetooth (%s)' % self.host
29+
def __str__(self):
30+
return 'Bluetooth (%s)' % self.host
3431

35-
def connect(self):
36-
if self.debug:
37-
print 'Connecting via Bluetooth...'
38-
sock = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
39-
sock.connect((self.host, BlueSock.PORT))
40-
self.sock = sock
41-
if self.debug:
42-
print 'Connected.'
43-
return Brick(self)
32+
def connect(self):
33+
if self.debug:
34+
print 'Connecting via USB...'
35+
sock = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
36+
sock.connect((self.host, BlueSock.PORT))
37+
self.sock = sock
38+
if self.debug:
39+
print 'Connected.'
40+
return Brick(self)
4441

45-
def close(self):
46-
if self.debug:
47-
print 'Closing Bluetooth connection...'
48-
self.sock.close()
49-
if self.debug:
50-
print 'Bluetooth connection closed.'
42+
def close(self):
43+
if self.debug:
44+
print 'Closing USB connection...'
45+
self.sock.close()
46+
if self.debug:
47+
print 'USB connection closed.'
5148

52-
def send(self, data):
53-
if self.debug:
54-
print 'Send:',
55-
print ':'.join('%02x' % ord(c) for c in data)
56-
l0 = len(data) & 0xFF
57-
l1 = (len(data) >> 8) & 0xFF
58-
d = chr(l0) + chr(l1) + data
59-
self.sock.send(d)
49+
def send(self, data):
50+
if self.debug:
51+
print 'Send:',
52+
print ':'.join('%02x' % ord(c) for c in data)
53+
l0 = len(data) & 0xFF
54+
l1 = (len(data) >> 8) & 0xFF
55+
d = chr(l0) + chr(l1) + data
56+
self.sock.send(d)
6057

61-
def recv(self):
62-
data = self.sock.recv(2)
63-
l0 = ord(data[0])
64-
l1 = ord(data[1])
65-
plen = l0 + (l1 << 8)
66-
data = self.sock.recv(plen)
67-
if self.debug:
68-
print 'Recv:',
69-
print ':'.join('%02x' % ord(c) for c in data)
70-
return data
58+
def recv(self):
59+
data = self.sock.recv(2)
60+
l0 = ord(data[0])
61+
l1 = ord(data[1])
62+
plen = l0 + (l1 << 8)
63+
data = self.sock.recv(plen)
64+
if self.debug:
65+
print 'Recv:',
66+
print ':'.join('%02x' % ord(c) for c in data)
67+
return data
7168

7269
def _check_brick(arg, value):
73-
return arg is None or arg == value
70+
return arg is None or arg == value
7471

7572
def find_bricks(host=None, name=None):
76-
for h, n in bluetooth.discover_devices(lookup_names=True):
77-
if _check_brick(host, h) and _check_brick(name, n):
78-
yield BlueSock(h)
73+
for h, n in bluetooth.discover_devices(lookup_names=True):
74+
if _check_brick(host, h) and _check_brick(name, n):
75+
yield BlueSock(h)

nxt/htcompass.py

Lines changed: 0 additions & 108 deletions
This file was deleted.

nxt/lightblueglue.py

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)