diff --git a/CLI/CLI.c b/CLI/CLI.c index 70a0386..a17eac0 100644 --- a/CLI/CLI.c +++ b/CLI/CLI.c @@ -15,12 +15,12 @@ CLI_charOutFn CLI_charOut; CMDList_t* CMDList; FIFOBuffChar_t* FIFO; -#ifdef HISTORY enum { CLI_State_Default, CLI_State_Esc, CLI_State_ANSIVT100 } CLI_State = CLI_State_Default; +#ifdef HISTORY History_t* History; #endif @@ -168,11 +168,9 @@ bool CLI_charIn(char c) C &= (~0x20); // convert to uppercase } -#ifdef HISTORY switch (CLI_State) { case CLI_State_Default: -#endif if ( //TODO: update list of accepted characters ((C >= 'A') && (C <= 'Z')) || ((c >= '0') && (c <= '9')) @@ -209,14 +207,8 @@ bool CLI_charIn(char c) break; case 27: // escape (start for arrow keys) -#ifdef HISTORY CLI_State = CLI_State_Esc; break; -#else - sprintf(&str[0], "\ninvlid char: ESC - (%i)\n", c); - CLI_stringOut(&str[0]); - break; -#endif default: sprintf(&str[0], "\ninvlid char: '%c' - (%i)\n", c, c); @@ -224,7 +216,6 @@ bool CLI_charIn(char c) break; } } -#ifdef HISTORY break; case CLI_State_Esc: @@ -241,25 +232,28 @@ bool CLI_charIn(char c) case CLI_State_ANSIVT100: switch (c) { +#ifdef HISTORY case 'A': // arrow up // history previus - CLI_stringOut((char*)"(key arrow up)"); + CLI_stringOut((char*)"(key: arrow up)"); CLI_State = CLI_State_Default; break; case 'B': // arrow down - CLI_stringOut((char*)"(key arrow down)"); // history next + CLI_stringOut((char*)"(key: arrow down)"); CLI_State = CLI_State_Default; break; case 'C': // arrow right - CLI_stringOut((char*)"(key arrow right)"); + CLI_stringOut((char*)"(key: arrow right)"); CLI_State = CLI_State_Default; break; case 'D': // arrow left - CLI_stringOut((char*)"(key arrow left)"); + CLI_stringOut((char*)"(key: arrow left)"); CLI_State = CLI_State_Default; break; +#endif default: + // only to back on on alpha char. seems to be the with all '\x1d[' commands if ((C >= 'A') && (C <= 'Z')) { CLI_State = CLI_State_Default; @@ -268,7 +262,6 @@ bool CLI_charIn(char c) break; } -#endif return ok; }