#include "command_handler.h" //----------------------------------------------------------------------------- void Command_Handler::Update() { Keyboard* ourKeyboard = parent->GetModule(IO_KEYBOARD_MAIN); uint8 curInput = ourKeyboard->GetInput(); while(curInput != 0xEE && curInput != 0xFF) { if(curInput == 10) { ExecuteCommand(); } else if(curInput == 11) { if(this->currentCommandLength > 0) { this->currentCommandLength--; this->buffer[currentCommandLength] = NULL; } } else if(curInput >= 0 && curInput <= 9) { if(this->currentCommandLength < COMMAND_BUFFER_SIZE) { this->buffer[this->currentCommandLength] = curInput; this->currentCommandLength++; } } curInput = ourKeyboard->GetInput(); } } //----------------------------------------------------------------------------- void Command_Handler::ExecuteCommand() { if(this->buffer[0] == 5) { this->displayDistanceSensors = true; } }