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
Diff: commander.cpp
- Revision:
- 20:4e0f0944f28f
- Parent:
- 19:61b21ac4896e
- Child:
- 23:db91aaa43a9e
--- a/commander.cpp Tue Nov 24 01:38:46 2015 +0000 +++ b/commander.cpp Tue Nov 24 20:53:51 2015 +0000 @@ -53,7 +53,7 @@ if (this->replyCommands == true) { pc.printf("VALUE:%s:VALUE\n", this->description().c_str()); } - //TODO: Send request with response descriptor. + //TODO: Send request with response descriptor. // pc.("DEBUG:Finished executine command"); return; } @@ -200,20 +200,23 @@ getCurrentBlock(this->typeRaw); } else if (this->commandIndex[i] == 3) { if (this->commandValue[i] == "maintanence") { - currentMode = Maintanence; - pc.printf("DEBUG:Running in maintanence mode.\n"); - }else if (this->commandValue[i] == "normal"){ - currentMode = Normal; - pc.printf("DEBUG:Running in nomal mode.\n"); - } - } else if (this->commandIndex[i] == 4 && currentMode == Normal){ - if (this->commandValue[i] == "start"){ - currentState = Start; - pc.printf("DEBUG:Starting sorting."); - }else if (this->commandValue[i] == "pause"){ - pc.printf("DEBUG:Pausing sorting."); - currentState = Pause; - } + currentMode = Maintanence; + pc.printf("INFO:Running in maintanence mode.\n"); + } else if (this->commandValue[i] == "normal") { + currentMode = Normal; + pc.printf("INFO:Running in nomal mode.\n"); + } else if (this->commandValue[i] == "none") { + currentMode = None; + pc.printf("INOF:Running in none mode"); + } + } else if (this->commandIndex[i] == 4 && currentMode == Normal) { + if (this->commandValue[i] == "start") { + currentState = Start; + pc.printf("INFO:Starting sorting.\n"); + } else if (this->commandValue[i] == "pause") { + currentState = Pause; + pc.printf("INFO:Pausing sorting.\n"); + } } } break; @@ -244,7 +247,7 @@ float integrationTime; sscanf(this->commandValue[i].c_str(), "%f", &integrationTime); if (integrationTime < 2.4 || integrationTime > 600) { - pc.printf("INFO:Integration Time invalid: %.3f\n", integrationTime); + pc.printf("ERROR:Integration Time invalid: %.3f\n", integrationTime); continue; } setIntegrationTimeTo(integrationTime); @@ -298,7 +301,7 @@ default: break; } - return; + return; }