mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-19 12:59:44 -07:00
implement marking the second STT when detected
on the graph window
This commit is contained in:
parent
f9f0e83b7c
commit
ab812dfae5
3 changed files with 18 additions and 4 deletions
|
@ -341,11 +341,14 @@ int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType,
|
||||||
askAmp(BitStream, BitLen);
|
askAmp(BitStream, BitLen);
|
||||||
}
|
}
|
||||||
bool st = false;
|
bool st = false;
|
||||||
if (*stCheck) st = DetectST(BitStream, &BitLen, &foundclk);
|
size_t ststart = 0, stend = 0;
|
||||||
|
if (*stCheck) st = DetectST_ext(BitStream, &BitLen, &foundclk, &ststart, &stend);
|
||||||
if (st) {
|
if (st) {
|
||||||
*stCheck = st;
|
*stCheck = st;
|
||||||
clk = (clk == 0) ? foundclk : clk;
|
clk = (clk == 0) ? foundclk : clk;
|
||||||
if (verbose || g_debugMode) PrintAndLog("\nFound Sequence Terminator");
|
CursorCPos = ststart;
|
||||||
|
CursorDPos = stend;
|
||||||
|
if (verbose || g_debugMode) PrintAndLog("\nFound Sequence Terminator - Second one is shown by orange and blue graph markers");
|
||||||
}
|
}
|
||||||
int errCnt = askdemod(BitStream, &BitLen, &clk, &invert, maxErr, askamp, askType);
|
int errCnt = askdemod(BitStream, &BitLen, &clk, &invert, maxErr, askamp, askType);
|
||||||
if (errCnt<0 || BitLen<16){ //if fatal error (or -1)
|
if (errCnt<0 || BitLen<16){ //if fatal error (or -1)
|
||||||
|
|
|
@ -1596,9 +1596,14 @@ int pskRawDemod(uint8_t dest[], size_t *size, int *clock, int *invert)
|
||||||
return errCnt;
|
return errCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DetectST(uint8_t buffer[], size_t *size, int *foundclock) {
|
||||||
|
size_t ststart = 0, stend = 0;
|
||||||
|
return DetectST_ext(buffer, size, foundclock, &ststart, &stend);
|
||||||
|
}
|
||||||
|
|
||||||
//by marshmellow
|
//by marshmellow
|
||||||
//attempt to identify a Sequence Terminator in ASK modulated raw wave
|
//attempt to identify a Sequence Terminator in ASK modulated raw wave
|
||||||
bool DetectST(uint8_t buffer[], size_t *size, int *foundclock) {
|
bool DetectST_ext(uint8_t buffer[], size_t *size, int *foundclock, size_t *ststart, size_t *stend) {
|
||||||
size_t bufsize = *size;
|
size_t bufsize = *size;
|
||||||
//need to loop through all samples and identify our clock, look for the ST pattern
|
//need to loop through all samples and identify our clock, look for the ST pattern
|
||||||
uint8_t fndClk[] = {8,16,32,40,50,64,128};
|
uint8_t fndClk[] = {8,16,32,40,50,64,128};
|
||||||
|
@ -1751,7 +1756,7 @@ bool DetectST(uint8_t buffer[], size_t *size, int *foundclock) {
|
||||||
size_t newloc = 0;
|
size_t newloc = 0;
|
||||||
i=0;
|
i=0;
|
||||||
if (g_debugMode==2) prnt("DEBUG STT: Starting STT trim - start: %d, datalen: %d ",dataloc, datalen);
|
if (g_debugMode==2) prnt("DEBUG STT: Starting STT trim - start: %d, datalen: %d ",dataloc, datalen);
|
||||||
|
bool firstrun = true;
|
||||||
// warning - overwriting buffer given with raw wave data with ST removed...
|
// warning - overwriting buffer given with raw wave data with ST removed...
|
||||||
while ( dataloc < bufsize-(clk/2) ) {
|
while ( dataloc < bufsize-(clk/2) ) {
|
||||||
//compensate for long high at end of ST not being high due to signal loss... (and we cut out the start of wave high part)
|
//compensate for long high at end of ST not being high due to signal loss... (and we cut out the start of wave high part)
|
||||||
|
@ -1764,6 +1769,11 @@ bool DetectST(uint8_t buffer[], size_t *size, int *foundclock) {
|
||||||
buffer[dataloc] = buffer[dataloc+2];
|
buffer[dataloc] = buffer[dataloc+2];
|
||||||
buffer[dataloc+1] = buffer[dataloc+2];
|
buffer[dataloc+1] = buffer[dataloc+2];
|
||||||
}
|
}
|
||||||
|
if (firstrun) {
|
||||||
|
*ststart = dataloc;
|
||||||
|
*stend = dataloc+(clk*4);
|
||||||
|
firstrun=false;
|
||||||
|
}
|
||||||
for (i=0; i<datalen; ++i) {
|
for (i=0; i<datalen; ++i) {
|
||||||
if (i+newloc < bufsize) {
|
if (i+newloc < bufsize) {
|
||||||
if (i+newloc < dataloc)
|
if (i+newloc < dataloc)
|
||||||
|
|
|
@ -31,6 +31,7 @@ int DetectNRZClock(uint8_t dest[], size_t size, int clock);
|
||||||
int DetectPSKClock(uint8_t dest[], size_t size, int clock);
|
int DetectPSKClock(uint8_t dest[], size_t size, int clock);
|
||||||
int DetectStrongAskClock(uint8_t dest[], size_t size, uint8_t high, uint8_t low);
|
int DetectStrongAskClock(uint8_t dest[], size_t size, uint8_t high, uint8_t low);
|
||||||
bool DetectST(uint8_t buffer[], size_t *size, int *foundclock);
|
bool DetectST(uint8_t buffer[], size_t *size, int *foundclock);
|
||||||
|
bool DetectST_ext(uint8_t buffer[], size_t *size, int *foundclock, size_t *ststart, size_t *stend);
|
||||||
int fskdemod(uint8_t *dest, size_t size, uint8_t rfLen, uint8_t invert, uint8_t fchigh, uint8_t fclow);
|
int fskdemod(uint8_t *dest, size_t size, uint8_t rfLen, uint8_t invert, uint8_t fchigh, uint8_t fclow);
|
||||||
int getHiLo(uint8_t *BitStream, size_t size, int *high, int *low, uint8_t fuzzHi, uint8_t fuzzLo);
|
int getHiLo(uint8_t *BitStream, size_t size, int *high, int *low, uint8_t fuzzHi, uint8_t fuzzLo);
|
||||||
uint32_t manchesterEncode2Bytes(uint16_t datain);
|
uint32_t manchesterEncode2Bytes(uint16_t datain);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue