mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
fancy timers
This commit is contained in:
parent
af47a3fd34
commit
6a006677ef
2 changed files with 11 additions and 9 deletions
|
@ -1671,19 +1671,21 @@ int CmdTuneSamples(const char *Cmd) {
|
|||
RepaintGraphWindow();
|
||||
|
||||
int timeout = 0;
|
||||
int timeout_max = 20;
|
||||
PrintAndLogEx(INFO, "Measuring antenna characteristics, please wait...");
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_MEASURE_ANTENNA_TUNING, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
while (!WaitForResponseTimeout(CMD_MEASURE_ANTENNA_TUNING, &resp, 2000)) {
|
||||
timeout++;
|
||||
printf(".");
|
||||
PrintAndLogEx(INPLACE, "% 3i", timeout_max - timeout);
|
||||
while (!WaitForResponseTimeout(CMD_MEASURE_ANTENNA_TUNING, &resp, 500)) {
|
||||
fflush(stdout);
|
||||
if (timeout > 7) {
|
||||
if (timeout >= timeout_max) {
|
||||
PrintAndLogEx(WARNING, "\nNo response from Proxmark3. Aborting...");
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
timeout++;
|
||||
PrintAndLogEx(INPLACE, "% 3i", timeout_max - timeout);
|
||||
}
|
||||
|
||||
if (resp.status != PM3_SUCCESS) {
|
||||
|
|
|
@ -547,12 +547,12 @@ bool OpenProxmark(void *port, bool wait_for_port, int timeout, bool flash_mode,
|
|||
PrintAndLogEx(SUCCESS, "Waiting for Proxmark3 to appear on " _YELLOW_("%s"), portname);
|
||||
fflush(stdout);
|
||||
int openCount = 0;
|
||||
PrintAndLogEx(INPLACE, "");
|
||||
PrintAndLogEx(INPLACE, "% 3i", timeout);
|
||||
do {
|
||||
sp = uart_open(portname, speed);
|
||||
msleep(500);
|
||||
printf(".");
|
||||
fflush(stdout);
|
||||
PrintAndLogEx(INPLACE, "% 3i", timeout - openCount -1);
|
||||
|
||||
} while (++openCount < timeout && (sp == INVALID_SERIAL_PORT || sp == CLAIMED_SERIAL_PORT));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue