X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/6426f6ba86c8a2d3e390fab1ced35223a92d8647..bd9dfaa89129c05e9e96242bbf109e922363253c:/armsrc/lfsampling.c diff --git a/armsrc/lfsampling.c b/armsrc/lfsampling.c index 8931f41d..3a502eb6 100644 --- a/armsrc/lfsampling.c +++ b/armsrc/lfsampling.c @@ -40,11 +40,11 @@ void printConfig() void setSamplingConfig(sample_config *sc) { if(sc->divisor != 0) config.divisor = sc->divisor; - if(sc->bits_per_sample!= 0) config.bits_per_sample= sc->bits_per_sample; - if(sc->decimation!= 0) config.decimation= sc->decimation; - if(sc->trigger_threshold != -1) config.trigger_threshold= sc->trigger_threshold; + if(sc->bits_per_sample != 0) config.bits_per_sample = sc->bits_per_sample; + if(sc->decimation != 0) config.decimation = sc->decimation; + if(sc->trigger_threshold != -1) config.trigger_threshold = sc->trigger_threshold; - config.averaging= sc->averaging; + config.averaging = sc->averaging; if(config.bits_per_sample > 8) config.bits_per_sample = 8; if(config.decimation < 1) config.decimation = 1; @@ -271,7 +271,7 @@ void doT55x7Acquisition(size_t sample_size) { uint8_t curSample = 0; uint8_t lastSample = 0; uint16_t skipCnt = 0; - while(!BUTTON_PRESS() && !usb_poll_validate_length() && skipCnt<1000) { + while(!BUTTON_PRESS() && !usb_poll_validate_length() && skipCnt < 1000 && (i < bufsize) ) { WDT_HIT(); if (AT91C_BASE_SSC->SSC_SR & AT91C_SSC_TXRDY) { AT91C_BASE_SSC->SSC_THR = 0x43; @@ -306,11 +306,10 @@ void doT55x7Acquisition(size_t sample_size) { // if just found start - recover last sample if (!startFound) { dest[i++] = lastSample; - startFound = true; + startFound = true; } // collect samples dest[i++] = curSample; - if (i >= bufsize-1) break; } } }