editable serial input line buffer
Dependents: MAX5715BOB_Tester MAX11131BOB_Tester MAX5171BOB_Tester MAX11410BOB_Tester ... more
Diff: CmdLine.cpp
- Revision:
- 10:3e2ff983be1c
- Parent:
- 9:12e37800ecdd
- Child:
- 11:e8a4162d4fd1
--- a/CmdLine.cpp Mon Nov 11 23:27:59 2019 +0000 +++ b/CmdLine.cpp Wed Nov 13 16:04:28 2019 -0800 @@ -43,6 +43,8 @@ { indexOfNextEmptyCell = 0; memset(buf, 0, COMMAND_BUFFER_LENGTH); + chSeparator = 0; + match_is_case_sensitive = false; } /** CmdLine::clear empties the command-line buffer */ void CmdLine::clear(void) @@ -325,7 +327,12 @@ // serial().printf("\r\n parse_and_remove_key(\"%s\") no match", key); return false; /* no match */ } - if (buf[idxSearch] != key[0]) { continue; } + if (match_is_case_sensitive) { + if (buf[idxSearch] != key[0]) { continue; } + } + else { + if (toupper(buf[idxSearch]) != toupper(key[0])) { continue; } + } // possible match; compare buf[idxSearch..] to key[0..] unsigned int idxKey = idxSearch; // test whether buf[idxKey..] == key[0..] unsigned int idxSeparator = idxSearch; // test whether key=value pair