settext implemented
[PyX52.git] / x52.py
blobec4f2c18f2ea2cb18f9a0997531e85bf6687b088
1 #!/usr/bin/env python
2 from traceback import print_exc
4 x52 = None
6 try:
7 print "Importing PyX52... ",
8 import PyX52
9 print "[ OK ]"
11 print "Creating PyX52.X52... ",
12 x52 = PyX52.X52()
13 print "[ OK ]"
15 x52types = {PyX52.TYPE_X52: "X52", PyX52.TYPE_X52PRO: "X52 Pro", PyX52.TYPE_YOKE: "Yoke"}
16 print "Detecting X52 device type... ",
17 typestr = x52types[x52.gettype()]
18 print "[ OK ]"
19 print "X52 device type: [ %s ]" % typestr
21 print "Setting date... ",
22 x52.setdate()
23 print "[ OK ]"
25 print "Setting time... ",
26 x52.settime()
27 print "[ OK ]"
29 print "Setting MFD brightness... ",
30 x52.setbri(0, 127)
31 x52.setbri(0, 63)
32 x52.setbri(0, 0)
33 x52.setbri(0, 127)
34 print "[ OK ]"
36 print "Setting LED brightness... ",
37 x52.setbri(1, 127)
38 x52.setbri(1, 63)
39 x52.setbri(1, 0)
40 x52.setbri(1, 127)
41 print "[ OK ]"
43 print "Setting text... ",
44 x52.settext(1, "1234567890123456")
45 x52.settext(2, "1234567890123456")
46 x52.settext(3, "1234567890123456")
47 x52.settext(1, "")
48 x52.settext(2, "")
49 x52.settext(3, "")
50 print "[ OK ]"
52 print "Setting LED states... ",
53 print "[ OK ]"
55 print "Setting time offset... ",
56 print "[ OK ]"
57 except:
58 print "[ FAIL ]"
59 print_exc()
60 exit(-1)