add timeout and some debug messages

This commit is contained in:
merlokk 2022-07-06 19:41:08 +03:00
parent 7c2379ac9f
commit 1a620c5563
2 changed files with 7 additions and 2 deletions

View file

@ -224,6 +224,7 @@ int HfSimulateTkm(uint8_t *uid, uint8_t modulation, uint32_t timeout) {
bool exit_loop = false;
bool field_on = false;
uint32_t startTime = GetTickCount();
while (exit_loop == false) {
button_pressed = BUTTON_PRESS();
@ -233,6 +234,9 @@ int HfSimulateTkm(uint8_t *uid, uint8_t modulation, uint32_t timeout) {
WDT_HIT();
if (startTime > 0 && startTime + timeout < GetTickCount())
break;
// in mV
int vHf = (MAX_ADC_HF_VOLTAGE * SumAdc(ADC_CHAN_HF, 32)) >> 15;
if (vHf > MF_MINFIELDV) {
@ -261,7 +265,7 @@ int HfSimulateTkm(uint8_t *uid, uint8_t modulation, uint32_t timeout) {
switch_off();
if (button_pressed)
DbpString("button pressed");
DbpString("Exit by press button");
reply_ng(CMD_HF_TEXKOM_SIMULATE, PM3_SUCCESS, NULL, 0);

View file

@ -627,6 +627,7 @@ static int CmdHFTexkomSim(const char *Cmd) {
SendCommandNG(CMD_HF_TEXKOM_SIMULATE, (uint8_t*)&payload, sizeof(payload));
if (payload.timeout > 0 && payload.timeout < 2800) {
PrintAndLogEx(INFO, "simulate command started");
PacketResponseNG resp;
if (WaitForResponseTimeout(CMD_HF_TEXKOM_SIMULATE, &resp, 3000) == false) {
if (verbose) {
@ -636,7 +637,7 @@ static int CmdHFTexkomSim(const char *Cmd) {
}
PrintAndLogEx(INFO, "simulate command execution done");
} else {
PrintAndLogEx(INFO, "simulate command started");
PrintAndLogEx(INFO, "simulate command started...");
}
return PM3_SUCCESS;