|
1 | 1 | #!/usr/bin/env python3 |
2 | 2 |
|
| 3 | +# This is the program that should be run during use; it creates the interactive menu. |
| 4 | +# It is also the only executable file other than test.py, which is only for testing things. |
| 5 | + |
3 | 6 | # Initialize loopIndex variable, used in displaySensor() |
4 | 7 | loopIndex = 0 |
5 | 8 |
|
|
26 | 29 |
|
27 | 30 | # Define the functions for button presses |
28 | 31 | def left(): |
29 | | - # Make sure there is no mission process running; if it is not, decrease count and update the display |
30 | | - # Otherwise, abort the current mission |
| 32 | + """ |
| 33 | + Called when left button pressed; if there is no mission running, |
| 34 | + decrease count and update the display. Otherwise, abort the current mission. |
| 35 | + """ |
31 | 36 | if not mission.is_alive(): |
32 | 37 | minusCount() |
33 | 38 | display() |
34 | 39 | else: |
35 | 40 | abort() |
36 | 41 | def right(): |
37 | | - # Make sure there is no mission process running; if it is not, increase count and update the display |
38 | | - # Otherwise, abort the current mission |
| 42 | + """ |
| 43 | + Called when right button pressed; if there is no mission running, |
| 44 | + increase count and update the display. Otherwise, abort the current mission. |
| 45 | + """ |
39 | 46 | if not mission.is_alive(): |
40 | 47 | addCount() |
41 | 48 | display() |
42 | 49 | else: |
43 | 50 | abort() |
44 | 51 | def down(): |
45 | | - # Make sure there is no mission process running; if it is not, recalibrate the gyro |
46 | | - # Otherwise, abort the current mission |
| 52 | + """ |
| 53 | + Called when bottom button pressed; if there is no mission running, |
| 54 | + recalibrate the gyro. Otherwise, abort the current mission. |
| 55 | + """ |
47 | 56 | if not mission.is_alive(): |
48 | 57 | calibrate() |
49 | 58 | else: |
50 | 59 | abort() |
51 | 60 | def up(): |
52 | | - # Make sure there is no mission process running; if it is not, recalibrate the color sensor |
53 | | - # Otherwise, abort the current mission |
| 61 | + """ |
| 62 | + Called when top button pressed; if there is no mission running, |
| 63 | + recalibrate the color sensor. Otherwise, abort the current mission. |
| 64 | + """ |
54 | 65 | if not mission.is_alive(): |
55 | 66 | robot.reflectCal() |
56 | 67 | else: |
57 | 68 | abort() |
58 | 69 | def enter(): |
59 | | - # Make sure there is no mission process running; if it is not, run the current mission, increase count, and update the display |
60 | | - # Otherwise, abort the current mission |
| 70 | + """ |
| 71 | + Called when center button pressed; if there is no mission running, launch the selected mission, |
| 72 | + increase count, and update the display. Otherwise, abort the current mission. |
| 73 | + """ |
61 | 74 | if not mission.is_alive(): |
62 | 75 | run() |
63 | 76 | addCount() |
|
0 commit comments