}
// DETECT CLOCK NOW IN LFDEMOD.C
-
void setGraphBuf(uint8_t *buff, size_t size)
{
if ( buff == NULL ) return;
}
}
-void SetGraphClock( int clock, int startidx){
- PlotClock = clock;
- PlockClockStartIndex = startidx;
-}
-
// Get or auto-detect ask clock rate
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);
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;
}
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
*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;
}
+
+ 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;
}
{
//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;