mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-16 04:09:10 +08:00
chg: 'data autocorrelate g' - visual with gridclock patter and markup of two tops. Also added a "visual" inspection of peaks with 3% tolerance. This increases usability quite much.
This commit is contained in:
parent
a8eb0fd05f
commit
711d384e7d
1 changed files with 41 additions and 7 deletions
|
@ -755,18 +755,52 @@ int AutoCorrelate(const int *in, int *out, size_t len, int window, bool SaveGrph
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verbose && ( correlation > 1 ) ) {
|
//
|
||||||
PrintAndLogEx(SUCCESS, "possible correlation %4d samples", correlation);
|
int hi = 0, idx = 0;
|
||||||
} else {
|
int distance = 0, hi_1 = 0, idx_1 = 0;
|
||||||
PrintAndLogEx(FAILED, "no repeating pattern found");
|
for (int i=0; i<=len; ++i){
|
||||||
|
if ( CorrelBuffer[i] > hi) {
|
||||||
|
hi = CorrelBuffer[i];
|
||||||
|
idx = i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SaveGrph){
|
for (int i=idx+1; i<=window; ++i){
|
||||||
|
if ( CorrelBuffer[i] > hi_1 ) {
|
||||||
|
hi_1 = CorrelBuffer[i];
|
||||||
|
idx_1 = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int foo = ABS(hi-hi_1);
|
||||||
|
int bar = ((int)(((hi+hi_1) / 2) * 0.03));
|
||||||
|
if ( verbose && foo < bar ) {
|
||||||
|
distance = idx_1 - idx;
|
||||||
|
PrintAndLogEx(SUCCESS, "possible 3% visible correlation %4d samples", distance);
|
||||||
|
} else if (verbose && ( correlation > 1 ) ) {
|
||||||
|
PrintAndLogEx(SUCCESS, "possible correlation %4d samples", correlation);
|
||||||
|
} else {
|
||||||
|
PrintAndLogEx(FAILED, "no repeating pattern found, try increasing window size");
|
||||||
|
}
|
||||||
|
|
||||||
|
int retval = correlation;
|
||||||
|
if (SaveGrph) {
|
||||||
//GraphTraceLen = GraphTraceLen - window;
|
//GraphTraceLen = GraphTraceLen - window;
|
||||||
memcpy(out, CorrelBuffer, len * sizeof(int));
|
memcpy(out, CorrelBuffer, len * sizeof(int));
|
||||||
|
if ( distance > 0) {
|
||||||
|
setClockGrid(distance, idx);
|
||||||
|
retval = distance;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
setClockGrid(correlation, idx);
|
||||||
|
|
||||||
|
CursorCPos = idx_1;
|
||||||
|
CursorDPos = idx_1+retval;
|
||||||
|
DemodBufferLen = 0;
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
}
|
}
|
||||||
return correlation;
|
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdAutoCorr(const char *Cmd) {
|
int CmdAutoCorr(const char *Cmd) {
|
||||||
|
|
Loading…
Reference in a new issue