replace macros with DEBUG_LEVEL aware timestamp function

This commit is contained in:
Conor Patrick
2019-02-12 20:28:48 -05:00
parent e7e83820a9
commit 831976f3a2
6 changed files with 30 additions and 61 deletions

View File

@@ -541,14 +541,6 @@ uint8_t ctaphid_handle_packet(uint8_t * pkt_raw)
static CTAPHID_WRITE_BUFFER wb;
CTAP_RESPONSE ctap_resp;
#ifndef DISABLE_CTAPHID_PING
#ifndef DISABLE_CTAPHID_CBOR
#if DEBUG_LEVEL > 0
uint32_t t1,t2;
#endif
#endif
#endif
int bufstatus = ctaphid_buffer_packet(pkt_raw, &cmd, &cid, &len);
if (bufstatus == HID_IGNORE)
@@ -589,15 +581,11 @@ uint8_t ctaphid_handle_packet(uint8_t * pkt_raw)
wb.cid = cid;
wb.cmd = CTAPHID_PING;
wb.bcnt = len;
#if DEBUG_LEVEL > 0
t1 = millis();
#endif
timestamp();
ctaphid_write(&wb, ctap_buffer, len);
ctaphid_write(&wb, NULL,0);
#if DEBUG_LEVEL > 0
t2 = millis();
printf1(TAG_TIME,"PING writeback: %d ms\n",(uint32_t)(t2-t1));
#endif
printf1(TAG_TIME,"PING writeback: %d ms\n",timestamp());
break;
#endif
#ifndef DISABLE_CTAPHID_WINK
@@ -641,16 +629,11 @@ uint8_t ctaphid_handle_packet(uint8_t * pkt_raw)
wb.bcnt = (ctap_resp.length+1);
#if DEBUG_LEVEL > 0
t1 = millis();
#endif
timestamp();
ctaphid_write(&wb, &status, 1);
ctaphid_write(&wb, ctap_resp.data, ctap_resp.length);
ctaphid_write(&wb, NULL, 0);
#if DEBUG_LEVEL > 0
t2 = millis();
printf1(TAG_TIME,"CBOR writeback: %d ms\n",(uint32_t)(t2-t1));
#endif
printf1(TAG_TIME,"CBOR writeback: %d ms\n",timestamp());
is_busy = 0;
break;
#endif