Replace "ERR" responses with "ERROR"

This commit is contained in:
Lexi / Zoe 2021-04-17 00:11:04 +02:00
parent 9e0ffd394b
commit 201b1db6a6
Signed by: binaryDiv
GPG Key ID: F8D4956E224DA232
2 changed files with 9 additions and 12 deletions

View File

@ -46,7 +46,7 @@ void executeCommand(CommandLine cmdLine) {
} }
else { else {
// unknown command: return error message // unknown command: return error message
uartPutLine("ERR invalid command"); uartPutLine("ERROR invalid command");
} }
} }
@ -89,14 +89,14 @@ void commandHelp() {
void commandRead(char* arg) { void commandRead(char* arg) {
if (arg == NULL) { if (arg == NULL) {
uartPutLine("ERR READ needs an address or address range"); uartPutLine("ERROR READ needs an address or address range");
return; return;
} }
// Parse address(es) // Parse address(es)
AddressRange range = parseAddressRange(arg); AddressRange range = parseAddressRange(arg);
if (!range.isValid) { if (!range.isValid) {
uartPutLine("ERR invalid address format"); uartPutLine("ERROR invalid address format");
return; return;
} }
@ -136,30 +136,27 @@ void commandRead(char* arg) {
void commandWrite(char* arg) { void commandWrite(char* arg) {
if (arg == NULL) { if (arg == NULL) {
uartPutLine("ERR WRITE needs a start address"); uartPutLine("ERROR WRITE needs a start address");
return; return;
} }
// Parse address // Parse address
AddressRange range = parseSingleAddress(arg); uartPutLine("ERROR invalid address format");
if (!range.isValid) {
uartPutLine("ERR invalid address format");
return; return;
} }
// Only binary mode // Only binary mode
if (!binary_mode) { if (!binary_mode) {
uartPutLine("ERR WRITE in ASCII mode is not implemented"); uartPutLine("ERROR WRITE in ASCII mode is not implemented");
return; return;
} }
// TODO read data from input and write to EEPROM // TODO read data from input and write to EEPROM
uartPutLine("ERR not implemented"); uartPutLine("ERROR not implemented");
} }
void commandErase() { void commandErase() {
// TODO uartPutLine("ERROR not implemented");
uartPutLine("ERR not implemented");
} }
// TESTREAD command: for testing purposes, reads a few bytes and returns them in a human readable format. // TESTREAD command: for testing purposes, reads a few bytes and returns them in a human readable format.

View File

@ -28,7 +28,7 @@ CommandLine readNextCommand(char* buffer, uint8_t bufferLength) {
if (readChars >= bufferLength - 1) { if (readChars >= bufferLength - 1) {
// Reading was aborted after bufferLength-1 characters to prevent buffer overflow. // Reading was aborted after bufferLength-1 characters to prevent buffer overflow.
uartPutLine("ERR buffer overflow, discarding line"); uartPutLine("ERROR buffer overflow, discarding line");
// Discard everything until we read an actual end of line // Discard everything until we read an actual end of line
for (unsigned char c = 0; c != '\n' && c != '\r'; c = uartGetChar()); for (unsigned char c = 0; c != '\n' && c != '\r'; c = uartGetChar());