FIX: moved from lfdemod.c -> graph.c SetGraphClock.

This commit is contained in:
iceman1001 2017-03-02 21:15:01 +01:00
commit 1ec412d97d
2 changed files with 6 additions and 7 deletions

View file

@ -123,6 +123,11 @@ void DetectHighLowInGraph(int *high, int *low, bool addFuzz) {
} }
} }
void SetGraphClock( int clock, int startidx){
PlotClock = clock;
PlockClockStartIndex = startidx;
}
// Get or auto-detect ask clock rate // Get or auto-detect ask clock rate
int GetAskClock(const char str[], bool printAns, bool verbose) int GetAskClock(const char str[], bool printAns, bool verbose)
{ {
@ -149,6 +154,7 @@ int GetAskClock(const char str[], bool printAns, bool verbose)
// Only print this message if we're not looping something // Only print this message if we're not looping something
if (printAns) if (printAns)
PrintAndLog("Auto-detected clock rate: %d, Best Starting Position: %d", clock, start); PrintAndLog("Auto-detected clock rate: %d, Best Starting Position: %d", clock, start);
SetGraphClock(clock, start);
return clock; return clock;
} }

View file

@ -940,10 +940,6 @@ int DetectStrongAskClock(uint8_t dest[], size_t size, uint8_t high, uint8_t low)
} }
return 0; return 0;
} }
void SetGraphClock( int clock, int startidx){
PlotClock = clock;
PlockClockStartIndex = startidx;
}
// by marshmellow // by marshmellow
// not perfect especially with lower clocks or VERY good antennas (heavy wave clipping) // not perfect especially with lower clocks or VERY good antennas (heavy wave clipping)
@ -1030,8 +1026,6 @@ int DetectASKClock(uint8_t dest[], size_t size, int *clock, int maxErr)
if (g_debugMode == 2) prnt("DEBUG ASK: clk %d, err %d, startpos %d, endpos %d", clk[clkCnt], errCnt, ii, i); if (g_debugMode == 2) prnt("DEBUG ASK: clk %d, err %d, startpos %d, endpos %d", clk[clkCnt], errCnt, ii, i);
if (errCnt==0 && clkCnt<7) { if (errCnt==0 && clkCnt<7) {
if (!clockFnd) *clock = clk[clkCnt]; if (!clockFnd) *clock = clk[clkCnt];
SetGraphClock(*clock, ii);
return ii; return ii;
} }
//if we found errors see if it is lowest so far and save it as best run //if we found errors see if it is lowest so far and save it as best run
@ -1055,7 +1049,6 @@ int DetectASKClock(uint8_t dest[], size_t size, int *clock, int maxErr)
} }
if (!clockFnd) *clock = clk[best]; if (!clockFnd) *clock = clk[best];
SetGraphClock(*clock, bestStart[best]);
return bestStart[best]; return bestStart[best];
} }