mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-15 11:43:14 +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
|
@ -754,19 +754,53 @@ int AutoCorrelate(const int *in, int *out, size_t len, int window, bool SaveGrph
|
|||
lastmax = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose && ( correlation > 1 ) ) {
|
||||
PrintAndLogEx(SUCCESS, "possible correlation %4d samples", correlation);
|
||||
} else {
|
||||
PrintAndLogEx(FAILED, "no repeating pattern found");
|
||||
|
||||
//
|
||||
int hi = 0, idx = 0;
|
||||
int distance = 0, hi_1 = 0, idx_1 = 0;
|
||||
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;
|
||||
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();
|
||||
}
|
||||
return correlation;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int CmdAutoCorr(const char *Cmd) {
|
||||
|
|
Loading…
Reference in a new issue