![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
3rd year group project. Electronic and Electrical Engineering. Heriot-Watt University. This is the code for the mbed for the Automatic Little Object Organiser (ALOO).
Dependencies: MCP23017 TCS3472_I2C WattBob_TextLCD mbed
globals.cpp@28:7e4d29977d72, 2015-12-01 (annotated)
- Committer:
- dreamselec
- Date:
- Tue Dec 01 20:54:26 2015 +0000
- Revision:
- 28:7e4d29977d72
- Parent:
- 27:2cb1bdb7ae3d
- Child:
- 29:9c0339e3c593
Intialization sequence optimised, it will also sync with PC's current state.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dreamselec | 2:7a55cb10259f | 1 | #include "globals.h" |
dreamselec | 9:dc8f155b71c8 | 2 | #include "Block.h" |
dreamselec | 9:dc8f155b71c8 | 3 | #include "fpga.h" |
dreamselec | 10:16ba52f8e025 | 4 | #include "TCS3472_I2C.h" |
dreamselec | 10:16ba52f8e025 | 5 | #include "MCP23017.h" |
dreamselec | 10:16ba52f8e025 | 6 | #include "WattBob_TextLCD.h" |
dreamselec | 2:7a55cb10259f | 7 | |
dreamselec | 7:b6e31bfdb2af | 8 | int kDefaultBaudRate = 19200; |
dreamselec | 20:4e0f0944f28f | 9 | //TODO: Not let it be constant. |
dreamselec | 20:4e0f0944f28f | 10 | int ColourSensorError = 0.5; |
dreamselec | 2:7a55cb10259f | 11 | //SerialBase gParity = SerialBase::None; |
dreamselec | 2:7a55cb10259f | 12 | int gStopBits = 1; |
dreamselec | 28:7e4d29977d72 | 13 | float gIntegrationTime = 2.5; |
dreamselec | 25:792540d69c49 | 14 | int gToggleServoNumber = 0; |
dreamselec | 26:bbcc25418ffa | 15 | float currentMinError[3] = {0,0,0}; |
dreamselec | 26:bbcc25418ffa | 16 | float currentMaxError[3] = {0,0,0}; |
dreamselec | 20:4e0f0944f28f | 17 | |
dreamselec | 26:bbcc25418ffa | 18 | Block defaultHazBlock = Block(); |
dreamselec | 20:4e0f0944f28f | 19 | Block _HazBlock = Block(); |
dreamselec |
8:e1da2ae62885 | 20 | |
dreamselec |
8:e1da2ae62885 | 21 | bool connectedToPC = false; |
dreamselec | 10:16ba52f8e025 | 22 | bool runServoTest = false; |
dreamselec |
23:db91aaa43a9e | 23 | bool runBreakBeamTest = false; |
dreamselec | 25:792540d69c49 | 24 | bool runColourSensorTest = false; |
dreamselec | 25:792540d69c49 | 25 | bool getColourSensorValue = false; |
dreamselec | 25:792540d69c49 | 26 | bool getBlockColourValue = false; |
dreamselec | 28:7e4d29977d72 | 27 | bool pcModeChanged = false; |
dreamselec | 28:7e4d29977d72 | 28 | int errorMultiplier = 1; |
dreamselec | 27:2cb1bdb7ae3d | 29 | int hazReadingCount = 1; |
dreamselec | 26:bbcc25418ffa | 30 | |
dreamselec | 17:af373246bf80 | 31 | PCModes currentMode = None; |
dreamselec |
18:44a1c1a30166 | 32 | Controls currentState = Pause; |
dreamselec |
8:e1da2ae62885 | 33 | |
dreamselec | 20:4e0f0944f28f | 34 | void DefaultHazBlock(){ |
dreamselec | 26:bbcc25418ffa | 35 | |
dreamselec | 26:bbcc25418ffa | 36 | for (int i = 0; i < 3; i++){ |
dreamselec | 26:bbcc25418ffa | 37 | currentMaxError[i] = kMaxError[i]; |
dreamselec | 26:bbcc25418ffa | 38 | currentMinError[i] = kMinError[i]; |
dreamselec | 26:bbcc25418ffa | 39 | } |
dreamselec | 20:4e0f0944f28f | 40 | Colour _minRedBlock = Colour(); |
dreamselec | 20:4e0f0944f28f | 41 | Colour _maxRedBlock = Colour(); |
dreamselec | 20:4e0f0944f28f | 42 | Colour _averageRedBlock = Colour(); |
dreamselec | 20:4e0f0944f28f | 43 | |
dreamselec | 20:4e0f0944f28f | 44 | for (int i = 0; i < 4; i++){ |
dreamselec | 20:4e0f0944f28f | 45 | _minRedBlock.components[i] = kMinRedBlock[i]; |
dreamselec | 20:4e0f0944f28f | 46 | _maxRedBlock.components[i] = kMaxRedBlock[i]; |
dreamselec | 20:4e0f0944f28f | 47 | _averageRedBlock.components[i] = kAverageRedBlock[i]; |
dreamselec | 20:4e0f0944f28f | 48 | } |
dreamselec | 20:4e0f0944f28f | 49 | |
dreamselec | 26:bbcc25418ffa | 50 | // _HazBlock.minColour = Colour(_minRedBlock); |
dreamselec | 26:bbcc25418ffa | 51 | // _HazBlock.maxColour = Colour(_maxRedBlock); |
dreamselec | 26:bbcc25418ffa | 52 | // _HazBlock.averageColour = Colour(_averageRedBlock); |
dreamselec | 26:bbcc25418ffa | 53 | // _HazBlock.size = Block::Small; |
dreamselec | 26:bbcc25418ffa | 54 | |
dreamselec | 26:bbcc25418ffa | 55 | defaultHazBlock.minColour = Colour(_minRedBlock); |
dreamselec | 26:bbcc25418ffa | 56 | defaultHazBlock.maxColour = Colour(_maxRedBlock); |
dreamselec | 26:bbcc25418ffa | 57 | defaultHazBlock.averageColour = Colour(_averageRedBlock); |
dreamselec | 26:bbcc25418ffa | 58 | defaultHazBlock.size = Block::Small; |
dreamselec | 20:4e0f0944f28f | 59 | |
dreamselec | 26:bbcc25418ffa | 60 | _HazBlock = Block(defaultHazBlock); |
dreamselec | 27:2cb1bdb7ae3d | 61 | // pc.printf( "VALUE:HazBlock:\n \t Size:%i\n \t Min Colour:%f,%f,%f,%f\n \t Max Colour:%f,%f,%f,%f:VALUE", _HazBlock.size, _HazBlock.minColour.components[Colour::Red], _HazBlock.minColour.components[Colour::Blue], _HazBlock.minColour.components[Colour::Green], _HazBlock.minColour.components[Colour::Alpha], _HazBlock.maxColour.components[Colour::Red], _HazBlock.maxColour.components[Colour::Blue], _HazBlock.maxColour.components[Colour::Green], _HazBlock.maxColour.components[Colour::Alpha]); |
dreamselec | 26:bbcc25418ffa | 62 | } |
dreamselec | 26:bbcc25418ffa | 63 | |
dreamselec | 26:bbcc25418ffa | 64 | void printColourDescription(Colour colour){ |
dreamselec | 26:bbcc25418ffa | 65 | pc.printf("Red: %.3f, Green: %.3f, Blue: %.3f, Clear: %.3f\n", colour.components[0], colour.components[1], colour.components[2], colour.components[3]); |
dreamselec | 26:bbcc25418ffa | 66 | } |
dreamselec | 26:bbcc25418ffa | 67 | |
dreamselec | 26:bbcc25418ffa | 68 | void printBlockDescription(Block block){ |
dreamselec | 26:bbcc25418ffa | 69 | pc.printf("VALUE:Size: %i\n", block.size); |
dreamselec | 26:bbcc25418ffa | 70 | printColourDescription(block.minColour); |
dreamselec | 26:bbcc25418ffa | 71 | printColourDescription(block.averageColour); |
dreamselec | 26:bbcc25418ffa | 72 | printColourDescription(block.maxColour); |
dreamselec | 26:bbcc25418ffa | 73 | //TODO: print errors |
dreamselec | 26:bbcc25418ffa | 74 | pc.printf(":VALUE"); |
dreamselec | 20:4e0f0944f28f | 75 | } |
dreamselec | 20:4e0f0944f28f | 76 | |
dreamselec | 10:16ba52f8e025 | 77 | int readSwitches() |
dreamselec | 10:16ba52f8e025 | 78 | { |
dreamselec | 20:4e0f0944f28f | 79 | if(i2cport->read_bit(8)) { |
dreamselec | 20:4e0f0944f28f | 80 | while (i2cport->read_bit(8)) { } |
dreamselec | 20:4e0f0944f28f | 81 | return 1; |
dreamselec | 20:4e0f0944f28f | 82 | } else if (i2cport->read_bit(9)) { |
dreamselec | 20:4e0f0944f28f | 83 | while (i2cport->read_bit(9)) { } |
dreamselec | 20:4e0f0944f28f | 84 | return 2; |
dreamselec | 20:4e0f0944f28f | 85 | } else if (i2cport->read_bit(10)) { |
dreamselec | 20:4e0f0944f28f | 86 | while (i2cport->read_bit(10)) { } |
dreamselec | 20:4e0f0944f28f | 87 | return 3; |
dreamselec | 20:4e0f0944f28f | 88 | } else if (i2cport->read_bit(11)) { |
dreamselec | 20:4e0f0944f28f | 89 | while (i2cport->read_bit(11)) { } |
dreamselec | 20:4e0f0944f28f | 90 | return 4; |
dreamselec | 20:4e0f0944f28f | 91 | } else { |
dreamselec | 20:4e0f0944f28f | 92 | return 0; |
dreamselec | 20:4e0f0944f28f | 93 | } |
dreamselec | 10:16ba52f8e025 | 94 | |
dreamselec |
8:e1da2ae62885 | 95 | } |
dreamselec |
8:e1da2ae62885 | 96 | |
dreamselec | 10:16ba52f8e025 | 97 | void connectToPC(CommandTypeRaw typeRaw) |
dreamselec | 10:16ba52f8e025 | 98 | { |
dreamselec | 20:4e0f0944f28f | 99 | connectedToPC = true; |
dreamselec | 24:02c61793f90b | 100 | pc.printf("INFO:PC connected to MBED.\n"); |
dreamselec | 10:16ba52f8e025 | 101 | } |
dreamselec | 10:16ba52f8e025 | 102 | |
dreamselec | 10:16ba52f8e025 | 103 | void disconnectToPC(CommandTypeRaw typeRaw) |
dreamselec | 10:16ba52f8e025 | 104 | { |
dreamselec | 24:02c61793f90b | 105 | pc.printf("INFO:PC disconnected to MBED.\n"); |
dreamselec | 20:4e0f0944f28f | 106 | connectedToPC = false; |
dreamselec | 20:4e0f0944f28f | 107 | currentMode = None; |
dreamselec |
8:e1da2ae62885 | 108 | } |
dreamselec |
8:e1da2ae62885 | 109 | |
dreamselec | 10:16ba52f8e025 | 110 | void hazBlock(CommandTypeRaw typeRaw) |
dreamselec | 10:16ba52f8e025 | 111 | { |
dreamselec | 20:4e0f0944f28f | 112 | if (typeRaw == Set) { |
dreamselec | 27:2cb1bdb7ae3d | 113 | fpga->moveSortingServo(Haz); |
dreamselec | 20:4e0f0944f28f | 114 | pc.printf("INFO:Setting new haz block.\n"); |
dreamselec | 20:4e0f0944f28f | 115 | int lowerBeam = 0; |
dreamselec | 20:4e0f0944f28f | 116 | int higherBeam = 0; |
dreamselec | 20:4e0f0944f28f | 117 | char readyChar = '\0'; |
dreamselec | 20:4e0f0944f28f | 118 | |
dreamselec | 20:4e0f0944f28f | 119 | lcd->cls(); |
dreamselec | 20:4e0f0944f28f | 120 | lcd->locate(0,0); |
dreamselec | 20:4e0f0944f28f | 121 | lcd->printf("New haz block"); |
dreamselec | 27:2cb1bdb7ae3d | 122 | |
dreamselec | 20:4e0f0944f28f | 123 | do { |
dreamselec | 20:4e0f0944f28f | 124 | higherBeam = fpga->getBeamValue(Top); |
dreamselec | 20:4e0f0944f28f | 125 | if (readSwitches() == 4) { |
dreamselec | 20:4e0f0944f28f | 126 | if (displayAbortDialog()) { |
dreamselec | 27:2cb1bdb7ae3d | 127 | //TODO: tell pc |
dreamselec | 27:2cb1bdb7ae3d | 128 | pc.printf(":<mbed>haz-block=pause"); |
dreamselec | 20:4e0f0944f28f | 129 | pc.printf("INFO: Operation aborted form MBED.\n"); |
dreamselec | 27:2cb1bdb7ae3d | 130 | fpga->moveSortingServo(NonHaz); |
dreamselec | 20:4e0f0944f28f | 131 | displayPCStatus(); |
dreamselec | 20:4e0f0944f28f | 132 | return; |
dreamselec | 20:4e0f0944f28f | 133 | } else { |
dreamselec | 20:4e0f0944f28f | 134 | lcd->cls(); |
dreamselec | 20:4e0f0944f28f | 135 | lcd->locate(0,0); |
dreamselec | 20:4e0f0944f28f | 136 | lcd->printf("New haz block"); |
dreamselec | 20:4e0f0944f28f | 137 | } |
dreamselec |
18:44a1c1a30166 | 138 | |
dreamselec | 20:4e0f0944f28f | 139 | } |
dreamselec | 20:4e0f0944f28f | 140 | } while (higherBeam != 1); |
dreamselec | 27:2cb1bdb7ae3d | 141 | |
dreamselec | 27:2cb1bdb7ae3d | 142 | int colourValues[4]; |
dreamselec | 27:2cb1bdb7ae3d | 143 | int averageColourValues[4] = {0, 0, 0, 0}; |
dreamselec | 27:2cb1bdb7ae3d | 144 | int numberOfReadings = 3; |
dreamselec | 27:2cb1bdb7ae3d | 145 | for (int i = 0; i < 4; i++) { |
dreamselec | 27:2cb1bdb7ae3d | 146 | rgbSensor.getAllColors(colourValues); |
dreamselec | 27:2cb1bdb7ae3d | 147 | for (int j = 0; j < 4; j++) { |
dreamselec | 27:2cb1bdb7ae3d | 148 | averageColourValues[j] += colourValues[j]; |
dreamselec | 27:2cb1bdb7ae3d | 149 | } |
dreamselec | 27:2cb1bdb7ae3d | 150 | } |
dreamselec | 27:2cb1bdb7ae3d | 151 | for (int i = 0; i < 4; i++) { |
dreamselec | 27:2cb1bdb7ae3d | 152 | averageColourValues[i] = averageColourValues[i] / numberOfReadings; |
dreamselec | 27:2cb1bdb7ae3d | 153 | } |
dreamselec | 10:16ba52f8e025 | 154 | |
dreamselec | 20:4e0f0944f28f | 155 | int colourValue[4]; |
dreamselec | 20:4e0f0944f28f | 156 | rgbSensor.getAllColors(colourValue); |
dreamselec | 20:4e0f0944f28f | 157 | |
dreamselec | 20:4e0f0944f28f | 158 | do { |
dreamselec | 20:4e0f0944f28f | 159 | lowerBeam = fpga->checkForBlock(); |
dreamselec | 20:4e0f0944f28f | 160 | } while (lowerBeam != 1); |
dreamselec | 20:4e0f0944f28f | 161 | higherBeam = fpga->checkForSize(); |
dreamselec |
18:44a1c1a30166 | 162 | |
dreamselec | 20:4e0f0944f28f | 163 | _HazBlock = Block(); |
dreamselec | 20:4e0f0944f28f | 164 | if (higherBeam == 1) |
dreamselec | 20:4e0f0944f28f | 165 | _HazBlock.size = Block::Big; |
dreamselec | 20:4e0f0944f28f | 166 | else if (higherBeam == 0) |
dreamselec | 20:4e0f0944f28f | 167 | _HazBlock.size = Block::Small; |
dreamselec | 20:4e0f0944f28f | 168 | for (int i = 0; i < 3; i++) { |
dreamselec | 20:4e0f0944f28f | 169 | _HazBlock.minColour.components[i] = colourValue[i]/colourValue[3] - ColourSensorError; |
dreamselec | 20:4e0f0944f28f | 170 | _HazBlock.maxColour.components[i] = colourValue[i]/colourValue[3] + ColourSensorError; |
dreamselec | 20:4e0f0944f28f | 171 | } |
dreamselec | 20:4e0f0944f28f | 172 | fpga->moveSortingServo(Haz); |
dreamselec | 20:4e0f0944f28f | 173 | fpga->moveStoppingServo(Go); |
dreamselec | 20:4e0f0944f28f | 174 | while (fpga->checkForBlock()) {} |
dreamselec | 20:4e0f0944f28f | 175 | fpga->moveStoppingServo(Stop); |
dreamselec | 20:4e0f0944f28f | 176 | fpga->moveSortingServo(NonHaz); |
dreamselec |
18:44a1c1a30166 | 177 | |
dreamselec | 26:bbcc25418ffa | 178 | //TODO: Fix format. |
dreamselec | 22:993821a4c396 | 179 | pc.printf( "VALUE:HazBlock:\n \t Size:%i\n \tMin Colour:%i,%i,%i,%i\n \t Max Colour:%i,%i,%i,%i:VALUE", _HazBlock.size, colourValue[0], colourValue[1], colourValue[2], colourValue[3], _HazBlock.minColour.components[Colour::Red], _HazBlock.minColour.components[Colour::Blue], _HazBlock.minColour.components[Colour::Green], _HazBlock.minColour.components[Colour::Alpha], _HazBlock.maxColour.components[Colour::Red], _HazBlock.maxColour.components[Colour::Blue], _HazBlock.maxColour.components[Colour::Green], _HazBlock.maxColour.components[Colour::Alpha]); |
dreamselec | 20:4e0f0944f28f | 180 | } else if (typeRaw == Query) { |
dreamselec | 20:4e0f0944f28f | 181 | pc.printf( "VALUE:HazBlock:\n \t Size:%i\n \t Min Colour:%i,%i,%i,%i\n \t Max Colour:%i,%i,%i,%i:VALUE", _HazBlock.size, _HazBlock.minColour.components[Colour::Red], _HazBlock.minColour.components[Colour::Blue], _HazBlock.minColour.components[Colour::Green], _HazBlock.minColour.components[Colour::Alpha], _HazBlock.maxColour.components[Colour::Red], _HazBlock.maxColour.components[Colour::Blue], _HazBlock.maxColour.components[Colour::Green], _HazBlock.maxColour.components[Colour::Alpha]); |
dreamselec | 20:4e0f0944f28f | 182 | } |
dreamselec |
8:e1da2ae62885 | 183 | } |
dreamselec |
8:e1da2ae62885 | 184 | |
dreamselec | 10:16ba52f8e025 | 185 | void getCurrentBlock(CommandTypeRaw typeRaw) |
dreamselec | 10:16ba52f8e025 | 186 | { |
dreamselec | 20:4e0f0944f28f | 187 | pc.printf("DEBUG: Getting current block readings\n"); |
dreamselec |
8:e1da2ae62885 | 188 | } |
dreamselec |
8:e1da2ae62885 | 189 | |
dreamselec | 15:777390eb5afd | 190 | void setIntegrationTimeTo(float integrationTime) |
dreamselec | 10:16ba52f8e025 | 191 | { |
dreamselec | 25:792540d69c49 | 192 | gIntegrationTime = integrationTime; |
dreamselec | 25:792540d69c49 | 193 | rgbSensor.setIntegrationTime(gIntegrationTime); |
dreamselec | 25:792540d69c49 | 194 | pc.printf("DEBUG: Setting integration-time to %i.\n", gIntegrationTime); |
dreamselec |
8:e1da2ae62885 | 195 | } |
dreamselec |
8:e1da2ae62885 | 196 | |
dreamselec | 10:16ba52f8e025 | 197 | void previewOnPC(bool on) |
dreamselec | 10:16ba52f8e025 | 198 | { |
dreamselec | 20:4e0f0944f28f | 199 | pc.printf("setting preview on pc to %i.\n", on); |
dreamselec |
8:e1da2ae62885 | 200 | } |
dreamselec |
8:e1da2ae62885 | 201 | |
dreamselec | 25:792540d69c49 | 202 | void testColourSensor(Controls state){ |
dreamselec | 25:792540d69c49 | 203 | if (state == Start){ |
dreamselec | 25:792540d69c49 | 204 | pc.printf("INFO: Running colour test.\n"); |
dreamselec | 25:792540d69c49 | 205 | runColourSensorTest = true; |
dreamselec | 25:792540d69c49 | 206 | } else if (state == Pause){ |
dreamselec | 25:792540d69c49 | 207 | pc.printf("INFO: Finished colour test.\n"); |
dreamselec | 25:792540d69c49 | 208 | runColourSensorTest = false; |
dreamselec | 25:792540d69c49 | 209 | } |
dreamselec | 25:792540d69c49 | 210 | } |
dreamselec | 25:792540d69c49 | 211 | |
dreamselec | 20:4e0f0944f28f | 212 | void readColourSensor() |
dreamselec | 20:4e0f0944f28f | 213 | { |
dreamselec | 20:4e0f0944f28f | 214 | int colourValue[4]; |
dreamselec | 20:4e0f0944f28f | 215 | rgbSensor.getAllColors(colourValue); |
dreamselec | 20:4e0f0944f28f | 216 | pc.printf( "VALEU:Colour Reading:%i,%i,%i,%i\n:VALUE", colourValue[0], colourValue[1], colourValue[2], colourValue[3]); |
dreamselec |
18:44a1c1a30166 | 217 | |
dreamselec |
8:e1da2ae62885 | 218 | } |
dreamselec |
8:e1da2ae62885 | 219 | |
dreamselec | 17:af373246bf80 | 220 | void testServos(Controls state) |
dreamselec | 10:16ba52f8e025 | 221 | { |
dreamselec | 20:4e0f0944f28f | 222 | if (state == Start) { |
dreamselec | 20:4e0f0944f28f | 223 | pc.printf("INFO: Running servo test.\n"); |
dreamselec | 20:4e0f0944f28f | 224 | runServoTest = true; |
dreamselec | 20:4e0f0944f28f | 225 | } else if (state == Pause) { |
dreamselec | 20:4e0f0944f28f | 226 | pc.printf("INFO: Finished running servo test.\n"); |
dreamselec | 20:4e0f0944f28f | 227 | runServoTest = false; |
dreamselec | 20:4e0f0944f28f | 228 | } |
dreamselec |
8:e1da2ae62885 | 229 | } |
dreamselec |
8:e1da2ae62885 | 230 | |
dreamselec | 10:16ba52f8e025 | 231 | void resetServos() |
dreamselec | 10:16ba52f8e025 | 232 | { |
dreamselec | 20:4e0f0944f28f | 233 | pc.printf("resetting servos.\n"); |
dreamselec |
8:e1da2ae62885 | 234 | } |
dreamselec |
8:e1da2ae62885 | 235 | |
dreamselec | 10:16ba52f8e025 | 236 | void getPortInfo() |
dreamselec | 10:16ba52f8e025 | 237 | { |
dreamselec | 20:4e0f0944f28f | 238 | pc.printf("getting port info.\n"); |
dreamselec |
8:e1da2ae62885 | 239 | } |
dreamselec |
8:e1da2ae62885 | 240 | |
dreamselec | 17:af373246bf80 | 241 | void setPortBaudRate(int baudRate) |
dreamselec | 10:16ba52f8e025 | 242 | { |
dreamselec | 20:4e0f0944f28f | 243 | pc.baud(baudRate); |
dreamselec | 20:4e0f0944f28f | 244 | wait(0.1); |
dreamselec | 20:4e0f0944f28f | 245 | pc.printf("DEBUG: Setting port Baud Rate to: %i.\n", baudRate); |
dreamselec | 10:16ba52f8e025 | 246 | } |
dreamselec | 10:16ba52f8e025 | 247 | |
dreamselec | 20:4e0f0944f28f | 248 | void setPortParity(int parity) |
dreamselec | 20:4e0f0944f28f | 249 | { |
dreamselec | 20:4e0f0944f28f | 250 | SerialBase::Parity _parity = static_cast<SerialBase::Parity>(parity); |
dreamselec | 20:4e0f0944f28f | 251 | pc.format(8, _parity, 1); |
dreamselec | 20:4e0f0944f28f | 252 | wait(0.1); |
dreamselec | 20:4e0f0944f28f | 253 | pc.printf("DEBUG: Setting port parity to: %i.\n", parity); |
dreamselec |
14:cf2f255b5560 | 254 | } |
dreamselec |
23:db91aaa43a9e | 255 | |
dreamselec |
23:db91aaa43a9e | 256 | void testBreakBeams(Controls state){ |
dreamselec |
23:db91aaa43a9e | 257 | if (state == Start){ |
dreamselec |
23:db91aaa43a9e | 258 | pc.printf("INFO: Running break beam test.\n"); |
dreamselec |
23:db91aaa43a9e | 259 | runBreakBeamTest = true; |
dreamselec |
23:db91aaa43a9e | 260 | }else if (state == Pause){ |
dreamselec |
23:db91aaa43a9e | 261 | pc.printf("INFO: Exiting break beam test.\n"); |
dreamselec |
23:db91aaa43a9e | 262 | runBreakBeamTest = false; |
dreamselec |
23:db91aaa43a9e | 263 | } |
dreamselec |
23:db91aaa43a9e | 264 | } |