X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/c6e5c7ea46eae6180eee3eb592a291257a0400b1..be67483e63430608982f1c92e02b59d7b4dc65b3:/client/graph.c diff --git a/client/graph.c b/client/graph.c index a0ba46d5..76210562 100644 --- a/client/graph.c +++ b/client/graph.c @@ -62,7 +62,6 @@ void save_restoreGB(uint8_t saveOpt) } // DETECT CLOCK NOW IN LFDEMOD.C - void setGraphBuf(uint8_t *buff, size_t size) { if ( buff == NULL ) return; @@ -146,9 +145,9 @@ int GetAskClock(const char str[], bool printAns, bool verbose) if (st == false) start = DetectASKClock(grph, size, &clock, 20); - // Only print this message if we're not looping something if (printAns) PrintAndLog("Auto-detected clock rate: %d, Best Starting Position: %d", clock, start); + SetGraphClock(clock, start); return clock; } @@ -185,9 +184,13 @@ int GetPskClock(const char str[], bool printAns, bool verbose) if (verbose) PrintAndLog("Failed to copy from graphbuffer"); return -1; } - clock = DetectPSKClock(grph, size, 0); - // Only print this message if we're not looping something - if (printAns) PrintAndLog("Auto-detected clock rate: %d", clock); + int start = 0; + clock = DetectPSKClock_ext(grph, size, 0, &start); + + if (printAns) + PrintAndLog("Auto-detected clock rate: %d, Best Starting Position: %d", clock, start); + + SetGraphClock(clock, start); return clock; } @@ -208,11 +211,13 @@ uint8_t GetNrzClock(const char str[], bool printAns, bool verbose) PrintAndLog("Failed to copy from graphbuffer"); return -1; } - clock = DetectNRZClock(grph, size, 0); + int start = 0; + clock = DetectNRZClock_ext(grph, size, 0, &start); // Only print this message if we're not looping something if (printAns) - PrintAndLog("Auto-detected clock rate: %d", clock); + PrintAndLog("Auto-detected clock rate: %d, Best Starting Position: %d", clock, start); + SetGraphClock(clock, start); return clock; } //by marshmellow @@ -252,11 +257,15 @@ uint8_t fskClocks(uint8_t *fc1, uint8_t *fc2, uint8_t *rf1, bool verbose) *fc1 = (ans >> 8) & 0xFF; *fc2 = ans & 0xFF; - *rf1 = detectFSKClk(BitStream, size, *fc1, *fc2); + int start = 0; + *rf1 = detectFSKClk_ext(BitStream, size, *fc1, *fc2, &start); if (*rf1 == 0) { if (verbose || g_debugMode) PrintAndLog("DEBUG: Clock detect error"); return 0; } + if (verbose || g_debugMode) + PrintAndLog("Detected Field Clocks: FC/%d, FC/%d - Bit Clock: RF/%d | Best Starting Position: %d", *fc1, *fc2, *rf1, start); + SetGraphClock(*rf1, start); return 1; } @@ -265,7 +274,6 @@ bool graphJustNoise(int *BitStream, int size) { //might not be high enough for noisy environments #define THRESHOLD 15; - bool isNoise = TRUE; for(int i=0; i < size && isNoise; i++){ isNoise = BitStream[i] < THRESHOLD;