|
|
@@ -76,7 +76,7 @@ void iButtonApp::cli_cmd_callback(string_t args, void* context) {
|
|
|
// Parse write / emulate commands
|
|
|
size_t ws = string_search_char(args, ' ');
|
|
|
if(ws == STRING_FAILURE) {
|
|
|
- printf("Incorrect input. Try tm <read | write | emulate> [key_type] [key_data]\r\n");
|
|
|
+ printf("Incorrect input. Try tm <read | write | emulate> [key_type] [key_data]");
|
|
|
string_clear(cmd);
|
|
|
return;
|
|
|
} else {
|
|
|
@@ -89,7 +89,7 @@ void iButtonApp::cli_cmd_callback(string_t args, void* context) {
|
|
|
} else if(!string_cmp_str(cmd, "emulate")) {
|
|
|
scene = iButtonApp::Scene::SceneCliEmulate;
|
|
|
} else {
|
|
|
- printf("Incorrect input. Try tm <write | emulate> <key_type> <key_data>\r\n");
|
|
|
+ printf("Incorrect input. Try tm <write | emulate> <key_type> <key_data>");
|
|
|
string_clear(cmd);
|
|
|
return;
|
|
|
}
|
|
|
@@ -125,7 +125,7 @@ void iButtonApp::cli_cmd_callback(string_t args, void* context) {
|
|
|
ret = read_hex_byte(args, &key_data[i++]);
|
|
|
}
|
|
|
if(i != bytes_to_read) {
|
|
|
- printf("Incorrect key data\r\n");
|
|
|
+ printf("Incorrect key data. Type %d key data hex digits", bytes_to_read);
|
|
|
return;
|
|
|
}
|
|
|
key.set_data(key_data, bytes_to_read);
|
|
|
@@ -140,30 +140,32 @@ void iButtonApp::cli_cmd_callback(string_t args, void* context) {
|
|
|
// Wait return event
|
|
|
iButtonApp::CliEvent result;
|
|
|
if(osMessageQueueGet(cli_event_result, &result, NULL, osWaitForever) != osOK) {
|
|
|
- printf("Command execution error\r\n");
|
|
|
+ printf("Command execution error");
|
|
|
return;
|
|
|
}
|
|
|
// Process return event
|
|
|
switch(result) {
|
|
|
case iButtonApp::CliEvent::CliReadSuccess:
|
|
|
- print_key_data();
|
|
|
case iButtonApp::CliEvent::CliReadCRCError:
|
|
|
- printf("Read error: invalid CRC\r\n");
|
|
|
+ print_key_data();
|
|
|
+ if(result == iButtonApp::CliEvent::CliReadCRCError) {
|
|
|
+ printf("Warning: invalid CRC");
|
|
|
+ }
|
|
|
break;
|
|
|
case iButtonApp::CliEvent::CliReadNotKeyError:
|
|
|
- printf("Read error: not a key\r\n");
|
|
|
+ printf("Read error: not a key");
|
|
|
break;
|
|
|
case iButtonApp::CliEvent::CliTimeout:
|
|
|
- printf("Timeout error\r\n");
|
|
|
+ printf("Timeout error");
|
|
|
break;
|
|
|
case iButtonApp::CliEvent::CliInterrupt:
|
|
|
- printf("Command interrupted\r\n");
|
|
|
+ printf("Command interrupted");
|
|
|
break;
|
|
|
case iButtonApp::CliEvent::CliWriteSuccess:
|
|
|
- printf("Write success\r\n");
|
|
|
+ printf("Write success");
|
|
|
break;
|
|
|
case iButtonApp::CliEvent::CliWriteFail:
|
|
|
- printf("Write fail\r\n");
|
|
|
+ printf("Write fail");
|
|
|
break;
|
|
|
default:
|
|
|
break;
|