Callum and Adel's changes on 12/02/19
Dependencies: Crypto
Diff: main.cpp
- Revision:
- 45:402a8a9423b9
- Parent:
- 43:a6d20109b2f2
- Child:
- 46:b9081aa50bda
--- a/main.cpp Wed Mar 20 19:53:12 2019 +0000 +++ b/main.cpp Wed Mar 20 20:20:15 2019 +0000 @@ -125,14 +125,19 @@ _pc.putc('>'); for (int i = 0; i < _MAXCMDLENGTH; ++i) { // reset buffer inCharQ[i] = (char)'.'; // MbedOS prints 'Embedded Systems are fun and do awesome things!' - _pc.putc('.'); // if you print a null terminator + // _pc.putc('.'); // if you print a null terminator } - _pc.putc('<'); _pc.putc('\r'); _pc.putc('>'); + + inCharQ[_MAXCMDLENGTH] = (char)'\0'; sprintf(inCharQ, "%s", inCharQ); // sorts out the correct string correctly strncpy(newCmd, inCharQ, _MAXCMDLENGTH); + _pc.printf("%s\n\r", inCharQ); + + _pc.putc('<'); //_pc.putc('\r'); _pc.putc('>'); + _cmdIndex = 0; _inCharIndex = 0; @@ -348,23 +353,23 @@ void start_comm(){ _RUN = true; - for (int i = 0; i < _MAXCMDLENGTH; ++i) { // reset buffer - inCharQ[i] = (char)'.'; // MbedOS prints 'Embedded Systems are fun and do awesome things!' - } + // for (int i = 0; i < _MAXCMDLENGTH; ++i) { // reset buffer + // inCharQ[i] = (char)'.'; // MbedOS prints 'Embedded Systems are fun and do awesome things!' + // } - inCharQ[_MAXCMDLENGTH] = (char)'\0'; - sprintf(inCharQ, "%s", inCharQ); // sorts out the correct string correctly - strncpy(newCmd, inCharQ, _MAXCMDLENGTH); + // inCharQ[_MAXCMDLENGTH] = (char)'\0'; + // sprintf(inCharQ, "%s", inCharQ); // sorts out the correct string correctly + // strncpy(newCmd, inCharQ, _MAXCMDLENGTH); _t_comm_out.start(callback(this, &Comm::commOutFn)); } char newCmd[]; // because unallocated must be defined at the bottom of the class - char inCharQ[]; + static char inCharQ[]; }; - +char Comm::inCharQ[] = {'.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','\0'}; class Motor {