biphase bug fixes

This commit is contained in:
marshmellow42 2015-03-09 15:27:20 -04:00
parent d66d484347
commit ada339a10f
2 changed files with 7 additions and 1 deletions

View file

@ -642,6 +642,11 @@ void CmdASKsimTag(uint16_t arg1, uint16_t arg2, size_t size, uint8_t *BitStream)
for (i=0; i<size; i++){ for (i=0; i<size; i++){
askSimBit(BitStream[i]^invert, &n, clk, manchester); askSimBit(BitStream[i]^invert, &n, clk, manchester);
} }
if (manchester==0 && BitStream[0]==BitStream[size-1]){ //run a second set inverted (for biphase phase)
for (i=0; i<size; i++){
askSimBit(BitStream[i]^invert^1, &n, clk, manchester);
}
}
if (separator==1) Dbprintf("sorry but separator option not yet available"); if (separator==1) Dbprintf("sorry but separator option not yet available");
Dbprintf("Simulating with clk: %d, invert: %d, manchester: %d, separator: %d, n: %d",clk, invert, manchester, separator, n); Dbprintf("Simulating with clk: %d, invert: %d, manchester: %d, separator: %d, n: %d",clk, invert, manchester, separator, n);

View file

@ -520,6 +520,7 @@ int CmdBiphaseDecodeRaw(const char *Cmd)
PrintAndLog("Biphase Decoded using offset: %d - # errors:%d - data:",offset,errCnt); PrintAndLog("Biphase Decoded using offset: %d - # errors:%d - data:",offset,errCnt);
printBitStream(BitStream, size); printBitStream(BitStream, size);
PrintAndLog("\nif bitstream does not look right try offset=1"); PrintAndLog("\nif bitstream does not look right try offset=1");
if (offset == 1) setDemodBuf(DemodBuffer,DemodBufferLen-1,1); //remove first bit from raw demod
return 1; return 1;
} }
@ -534,7 +535,7 @@ void setBiphaseDemodBuf(uint8_t *BitStream, size_t size)
return; return;
} }
for (size_t idx=0; idx<size; idx++){ for (size_t idx=0; idx<size; idx++){
if(BitStream[idx]){ if(!BitStream[idx]){
rawStream[i++] = curPhase; rawStream[i++] = curPhase;
rawStream[i++] = curPhase; rawStream[i++] = curPhase;
curPhase ^= 1; curPhase ^= 1;