55< meta name ="viewport " content ="width=device-width, initial-scale=1, minimum-scale=1 " />
66< meta name ="generator " content ="pdoc 0.10.0 " />
77< title > rot2prog.utils.run API documentation</ title >
8- < meta name ="description " content ="" />
8+ < meta name ="description " content ="Standalone program to manually interact with the ROT2Prog hardware. " />
99< link rel ="preload stylesheet " as ="style " href ="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css " integrity ="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs= " crossorigin >
1010< link rel ="preload stylesheet " as ="style " href ="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css " integrity ="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg= " crossorigin >
1111< link rel ="stylesheet preload " as ="style " href ="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css " crossorigin >
2222< h1 class ="title "> Module < code > rot2prog.utils.run</ code > </ h1 >
2323</ header >
2424< section id ="section-intro ">
25+ < p > Standalone program to manually interact with the ROT2Prog hardware.</ p >
2526< details class ="source ">
2627< summary >
2728< span > Expand source code</ span >
2829</ summary >
29- < pre > < code class ="python "> import logging
30+ < pre > < code class ="python "> """Standalone program to manually interact with the ROT2Prog hardware.
31+ """
32+ import logging
3033import rot2prog
3134
3235def help():
36+ """Displays a help message.
37+ """
3338 print()
3439 print('ROT2Prog Live Interface Commands.')
3540 print()
3641 print('options:')
3742 print(' help display this help message')
3843 print(' quit end the program')
39- print(' ppd show pulses per degree')
4044 print(' stop send stop command')
4145 print(' status send status command')
46+ print(' ppd show pulses per degree')
4247 print(' set [azimuth] [elevation] send set command with a position')
4348
4449if __name__ == '__main__':
45- log = logging.getLogger(__name__)
46-
47- debug = ''
48-
49- while debug.lower() not in ['y', 'n']:
50- debug = input('Run debugger? (y/n) ')
51-
52- if debug.lower() == 'y':
53- logging.basicConfig(level = logging.DEBUG)
54- print('Running in debug mode')
55- else:
56- logging.basicConfig(level = logging.INFO)
50+ logging.basicConfig(level = logging.DEBUG)
5751
5852 port = input('Please enter the serial port: ')
59-
6053 rot = rot2prog.ROT2Prog(port)
54+
6155 help()
6256
6357 run = True
@@ -67,26 +61,26 @@ <h1 class="title">Module <code>rot2prog.utils.run</code></h1>
6761 args = cmd.split(' ')
6862
6963 try:
70- if args[0].lower() == 'stop':
64+ if args[0].lower() == 'help':
65+ help()
66+ elif args[0].lower() == 'quit':
67+ run = False
68+ elif args[0].lower() == 'stop':
7169 rsp = rot.stop()
72- log.info ('Azimuth: ' + str(rsp[0]))
73- log.info ('Elevation: ' + str(rsp[1]))
70+ print ('Azimuth: ' + str(rsp[0]))
71+ print ('Elevation: ' + str(rsp[1]))
7472 elif args[0].lower() == 'status':
7573 rsp = rot.status()
76- log.info('Azimuth: ' + str(rsp[0]))
77- log.info('Elevation: ' + str(rsp[1]))
74+ print('Azimuth: ' + str(rsp[0]))
75+ print('Elevation: ' + str(rsp[1]))
76+ elif args[0].lower() == 'ppd':
77+ print('Pulses Per Degree: ' + str(rot.get_pulses_per_degree()))
7878 elif args[0].lower() == 'set':
7979 rot.set(float(args[1]), float(args[2]))
80- elif args[0].lower() == 'ppd':
81- log.info('Pulses Per Degree: ' + str(rot.get_pulses_per_degree()))
82- elif args[0].lower() == 'help':
83- help()
84- elif args[0].lower() == 'quit':
85- run = False
8680 else:
87- raise Exception
88- except:
89- log.error('Invalid command!' )
81+ raise Exception('Invalid command!')
82+ except Exception as e :
83+ print(e )
9084 help()</ code > </ pre >
9185</ details >
9286</ section >
@@ -101,21 +95,23 @@ <h2 class="section-title" id="header-functions">Functions</h2>
10195< span > def < span class ="ident "> help</ span > </ span > (< span > )</ span >
10296</ code > </ dt >
10397< dd >
104- < div class ="desc "> </ div >
98+ < div class ="desc "> < p > Displays a help message. </ p > < /div >
10599< details class ="source ">
106100< summary >
107101< span > Expand source code</ span >
108102</ summary >
109103< pre > < code class ="python "> def help():
104+ """Displays a help message.
105+ """
110106 print()
111107 print('ROT2Prog Live Interface Commands.')
112108 print()
113109 print('options:')
114110 print(' help display this help message')
115111 print(' quit end the program')
116- print(' ppd show pulses per degree')
117112 print(' stop send stop command')
118113 print(' status send status command')
114+ print(' ppd show pulses per degree')
119115 print(' set [azimuth] [elevation] send set command with a position')</ code > </ pre >
120116</ details >
121117</ dd >
0 commit comments