Skip to content

Commit 82216e9

Browse files
committed
Fixed nxt_test to use find_one_brick, tweaked a few other things.
1 parent 6222948 commit 82216e9

File tree

5 files changed

+24
-29
lines changed

5 files changed

+24
-29
lines changed

README

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ Specific Stability Status:
8585
On Linux: Stable; well tested with both pybluez and lightblue.
8686
On Windows: Stable; working last I checked.
8787
On Mac: Some users having problems.
88+
Internet Communications System (nxt.ipsock)
89+
Seems to work for the most part. Occasionally has hiccups.
8890
Fantom Communications System (nxt.fantomsock)
8991
On Linux: N/A (Fantom driver not supported)
9092
On Windows: Not tested.
@@ -95,7 +97,7 @@ Specific Stability Status:
9597
Stable except for Synchronized Motor support, which is experimental at
9698
this stage and has not been extensively tested.
9799
nxt.sensor:
98-
Code not specific to a particular sensor is well tested and working
100+
Code not specific to a particular sensor is well-tested and working
99101
great. More than half of the sensor classes were last reported working;
100102
the rest have not to my knowlege been tested and were written blindly
101103
from the manuacturers' specifications.

examples/cnc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#http://groups.google.com/group/nxt-python/browse_thread/thread/f6ef0865ae768ef
88

99
import nxt, thread, time
10-
b = nxt.find_one_brick(name = 'MyNXT')
10+
b = nxt.find_one_brick()
1111
mx = nxt.Motor(b, nxt.PORT_A)
1212
my = nxt.Motor(b, nxt.PORT_B)
1313
motors = [mx, my]

scripts/nxt_filer

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ if __name__ == '__main__':
141141
Usage: nxt_filer [--host <macaddress>]'''
142142
exit(0)
143143

144-
brick = nxt.locator.find_one_brick(keyword_arguments['host'])
144+
brick = nxt.locator.find_one_brick(keyword_arguments.get('host',None))
145145
win = NXT_Filer(brick)
146146
win.show_all()
147147
gtk.main()

scripts/nxt_push

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ if __name__ == '__main__':
4747
Usage: nxt_push [--host <macaddress>] <file>'''
4848
exit(0)
4949

50-
brick = nxt.locator.find_one_brick(keyword_arguments['host'])
50+
brick = nxt.locator.find_one_brick(keyword_arguments.get('host',None))
5151
for filename in arguments:
5252
write_file(brick, filename)

scripts/nxt_test

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,21 @@ Usage: nxt_test (takes no arguments except --help)'''
1212
import nxt.locator
1313
import nxt.brick
1414

15-
b = None
16-
socks = nxt.locator.find_bricks()
17-
for sock in socks:
18-
try:
19-
b = sock.connect()
20-
21-
name, host, signal_strength, user_flash = b.get_device_info()
22-
print 'NXT brick name: %s' % name
23-
print 'Host address: %s' % host
24-
print 'Bluetooth signal strength: %s' % signal_strength
25-
print 'Free user flash: %s' % user_flash
26-
prot_version, fw_version = b.get_firmware_version()
27-
print 'Protocol version %s.%s' % prot_version
28-
print 'Firmware version %s.%s' % fw_version
29-
millivolts = b.get_battery_level()
30-
print 'Battery level %s mV' % millivolts
31-
except:
32-
print "Error with brick:"
33-
traceback.print_tb(sys.exc_info()[2])
34-
print str(sys.exc_info()[1])
35-
if b:
36-
b.sock.close()
37-
38-
if not b:
39-
print "No bricks found!"
15+
try:
16+
b = nxt.locator.find_one_brick()
17+
name, host, signal_strength, user_flash = b.get_device_info()
18+
print 'NXT brick name: %s' % name
19+
print 'Host address: %s' % host
20+
print 'Bluetooth signal strength: %s' % signal_strength
21+
print 'Free user flash: %s' % user_flash
22+
prot_version, fw_version = b.get_firmware_version()
23+
print 'Protocol version %s.%s' % prot_version
24+
print 'Firmware version %s.%s' % fw_version
25+
millivolts = b.get_battery_level()
26+
print 'Battery level %s mV' % millivolts
27+
except:
28+
print "Error while running test:"
29+
traceback.print_tb(sys.exc_info()[2])
30+
print str(sys.exc_info()[1])
31+
if b:
32+
b.sock.close()

0 commit comments

Comments
 (0)