FIX: 'hf tune' - now works...

This commit is contained in:
iceman1001 2019-01-06 20:28:23 +01:00
commit 0dee369a58
3 changed files with 27 additions and 37 deletions

View file

@ -113,7 +113,7 @@ void print_result(char *name, uint8_t *buf, size_t len) {
void DbpStringEx(char *str, uint32_t cmd) {
#if DEBUG
uint8_t len = strlen(str);
cmd_send(CMD_DEBUG_PRINT_STRING, len, cmd, 0, (byte_t*)str, len);
cmd_send(CMD_DEBUG_PRINT_STRING, len, cmd, 0, (uint8_t*)str, len);
#endif
}
@ -307,10 +307,10 @@ void MeasureAntennaTuningHf(void) {
} else {
volt = (MAX_ADC_HF_VOLTAGE_RDV40 * AvgAdc(ADC_CHAN_HF_RDV40)) >> 10;
}
DbprintfEx(CMD_MEASURE_ANTENNA_TUNING_HF, "%u mV / %5u V", volt, (uint16_t)(volt/1000));
DbprintfEx(FLAG_NONEWLINE, "%u mV / %5u V", volt, (uint16_t)(volt/1000));
}
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
DbpString("\n[+] cancelled");
DbprintfEx(FLAG_NOOPT, "\n[+] cancelled", 1);
}
void ReadMem(int addr) {

View file

@ -154,36 +154,25 @@ static void UsbCommandReceived(UsbCommand* c) {
char s[USB_CMD_DATA_SIZE+1];
memset(s, 0x00, sizeof(s));
size_t len = MIN(c->arg[0], USB_CMD_DATA_SIZE);
memcpy(s, c->d.asBytes, len);
//#define FLAG_RAWPRINT 0x0111
//#define FLAG_NOOPT 0x0000
//#define FLAG_NOLOG 0x0001
//#define FLAG_NONEWLINE 0x0010
//#define FLAG_NOPROMPT 0x0100
memcpy(s, c->d.asBytes, len);
uint64_t flag = c->arg[1];
if (flag > 0) { // FLAG_RAWPRINT) {
switch (flag) {
case FLAG_RAWPRINT:
printf("%s", s);
return;
case FLAG_NONEWLINE:
printf("%s\r", s);
return;
case FLAG_NOLOG:
printf("%s\r\n", s);
return;
}
fflush(stdout);
return;
}
// print debug line on same row. escape seq \r
if ( c->arg[1] == CMD_MEASURE_ANTENNA_TUNING_HF) {
PrintAndLogEx(NORMAL, "\r#db# %s", s);
} else {
PrintAndLogEx(NORMAL, "#db# %s", s);
switch (flag) {
case FLAG_RAWPRINT:
printf("%s", s);
break;
case FLAG_NONEWLINE:
printf("\r%s", s);
break;
case FLAG_NOLOG:
printf("%s\r\n", s);
break;
//case FLAG_NOPROMPT:
// break;
case FLAG_NOOPT:
default:
PrintAndLogEx(NORMAL, "#db# %s", s);
break;
}
fflush(stdout);
break;

View file

@ -300,11 +300,12 @@ typedef struct{
#define FLAG_ICLASS_READER_CEDITKEY 0x40
// Dbprintf flags
#define FLAG_RAWPRINT 0x0111
#define FLAG_NOOPT 0x0000
#define FLAG_NOLOG 0x0001
#define FLAG_NONEWLINE 0x0010
#define FLAG_NOPROMPT 0x0100
#define FLAG_RAWPRINT 0x0111
#define FLAG_NOOPT 0x0000
#define FLAG_NOLOG 0x0001
#define FLAG_NONEWLINE 0x0010
#define FLAG_NOPROMPT 0x0100
// CMD_DEVICE_INFO response packet has flags in arg[0], flag definitions:
/* Whether a bootloader that understands the common_area is present */