unified verbose param text and fixed behavior

This commit is contained in:
iceman1001 committed 2024-01-18 19:46:14 +01:00
1 parent 5b090701f0
commit 05353deb4a
16 files changed
+111 -101

No files matched your search

+10 -10
View File
@@ -116,7 +116,7 @@ static int CmdLFTune(const char *Cmd) {
arg_lit0(NULL, "bar", "bar style"),
arg_lit0(NULL, "mix", "mixed style"),
arg_lit0(NULL, "value", "values style"),
arg_lit0(NULL, "stat", "show statistical data after tuning"),
arg_lit0("v", "verbose", "verbose output"),
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, true);
@@ -127,7 +127,7 @@ static int CmdLFTune(const char *Cmd) {
bool is_bar = arg_get_lit(ctx, 4);
bool is_mix = arg_get_lit(ctx, 5);
bool is_value = arg_get_lit(ctx, 6);
bool stat_on = arg_get_lit(ctx, 7);
bool verbose = arg_get_lit(ctx, 7);
CLIParserFree(ctx);
if (divisor < 19) {
@@ -171,7 +171,7 @@ static int CmdLFTune(const char *Cmd) {
clearCommandBuffer();
SendCommandNG(CMD_MEASURE_ANTENNA_TUNING_LF, params, sizeof(params));
if (!WaitForResponseTimeout(CMD_MEASURE_ANTENNA_TUNING_LF, &resp, 1000)) {
if (WaitForResponseTimeout(CMD_MEASURE_ANTENNA_TUNING_LF, &resp, 1000) == false) {
PrintAndLogEx(WARNING, "Timeout while waiting for Proxmark LF initialization, aborting");
return PM3_ETIMEOUT;
}
@@ -194,7 +194,7 @@ static int CmdLFTune(const char *Cmd) {
}
SendCommandNG(CMD_MEASURE_ANTENNA_TUNING_LF, params, sizeof(params));
if (!WaitForResponseTimeout(CMD_MEASURE_ANTENNA_TUNING_LF, &resp, 1000)) {
if (WaitForResponseTimeout(CMD_MEASURE_ANTENNA_TUNING_LF, &resp, 1000) == false) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(WARNING, "Timeout while waiting for Proxmark LF measure, aborting");
break;
@@ -212,7 +212,7 @@ static int CmdLFTune(const char *Cmd) {
first = false;
}
v_max = (volt > v_max) ? volt : v_max;
if (stat_on) {
if (verbose) {
v_min = (volt < v_min) ? volt : v_min;
v_sum += volt;
v_count++;
@@ -227,12 +227,12 @@ static int CmdLFTune(const char *Cmd) {
return PM3_ETIMEOUT;
}
PrintAndLogEx(NORMAL, "\x1b%c[2K\r", 30);
PrintAndLogEx(INFO, "Done.");
if (stat_on) {
PrintAndLogEx(INFO, "Min:%u mV", v_min);
PrintAndLogEx(INFO, "Max:%u mV", v_max);
PrintAndLogEx(INFO, "Average:%.3lf mV", v_sum / (double)v_count);
if (verbose) {
PrintAndLogEx(INFO, "Min....... %u mV", v_min);
PrintAndLogEx(INFO, "Max....... %u mV", v_max);
PrintAndLogEx(INFO, "Average... %.3lf mV", v_sum / (double)v_count);
}
PrintAndLogEx(INFO, "Done!");
return PM3_SUCCESS;
}