CHG: 'lf cotag read' - it now follows "lf config" settings when collecting signaldata.

This commit is contained in:
iceman1001
2017-02-01 14:11:11 +01:00
parent d760c7b3d9
commit 507afbf3e6
6 changed files with 41 additions and 32 deletions

View File

@@ -497,24 +497,24 @@ int CmdLFSetConfig(const char *Cmd) {
cmdp++;
break;
case 'q':
errors |= param_getdec(Cmd,cmdp+1,&divisor);
errors |= param_getdec(Cmd, cmdp+1, &divisor);
cmdp+=2;
break;
case 't':
errors |= param_getdec(Cmd,cmdp+1,&unsigned_trigg);
errors |= param_getdec(Cmd, cmdp+1, &unsigned_trigg);
cmdp+=2;
if(!errors) trigger_threshold = unsigned_trigg;
break;
case 'b':
errors |= param_getdec(Cmd,cmdp+1,&bps);
errors |= param_getdec(Cmd, cmdp+1, &bps);
cmdp+=2;
break;
case 'd':
errors |= param_getdec(Cmd,cmdp+1,&decimation);
errors |= param_getdec(Cmd, cmdp+1, &decimation);
cmdp+=2;
break;
case 'a':
averaging = param_getchar(Cmd,cmdp+1) == '1';
averaging = param_getchar(Cmd, cmdp+1) == '1';
cmdp+=2;
break;
default:
@@ -531,14 +531,13 @@ int CmdLFSetConfig(const char *Cmd) {
//Validations
if (errors) return usage_lf_config();
//Bps is limited to 8, so fits in lower half of arg1
//Bps is limited to 8
if (bps >> 4) bps = 8;
sample_config config = { decimation, bps, averaging, divisor, trigger_threshold };
//Averaging is a flag on high-bit of arg[1]
UsbCommand c = {CMD_SET_LF_SAMPLING_CONFIG};
memcpy(c.d.asBytes,&config,sizeof(sample_config));
UsbCommand c = {CMD_SET_LF_SAMPLING_CONFIG, {0,0,0} };
memcpy(c.d.asBytes, &config, sizeof(sample_config));
clearCommandBuffer();
SendCommand(&c);
return 0;

View File

@@ -46,6 +46,8 @@
int CmdLF(const char *Cmd);
int CmdLFSetConfig(const char *Cmd);
int CmdLFCommandRead(const char *Cmd);
int CmdFlexdemod(const char *Cmd);
int CmdIndalaDemod(const char *Cmd);

View File

@@ -15,6 +15,8 @@ int CmdCOTAGRead(const char *Cmd) {
// if (Cmd[0] == 'h' || Cmd[0] == 'H') return usage_lf_cotag_read();
CmdLFSetConfig("q 89");
UsbCommand c = {CMD_COTAG, {0, 0, 0}};
clearCommandBuffer();
SendCommand(&c);
@@ -22,7 +24,7 @@ int CmdCOTAGRead(const char *Cmd) {
PrintAndLog("command execution time out");
return 1;
}
getSamples("20000", true);
getSamples("", true);
return 0;
}

View File

@@ -16,6 +16,8 @@
#include "cmddata.h" // getSamples
#include "cmdparser.h" // CmdsParse, CmdsHelp
#include "cmdmain.h"
#include "ui.h" // PrintAndLog
#include "cmdlf.h" // Setconfig
int CmdLFCOTAG(const char *Cmd);
int CmdCOTAGRead(const char *Cmd);