From ada339a10f1dbe7694ae92393271a9e156fe9ec4 Mon Sep 17 00:00:00 2001 From: marshmellow42 <marshmellowrf@gmail.com> Date: Mon, 9 Mar 2015 15:27:20 -0400 Subject: [PATCH] biphase bug fixes --- armsrc/lfops.c | 5 +++++ client/cmddata.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/armsrc/lfops.c b/armsrc/lfops.c index a5c4a64d..468f5830 100644 --- a/armsrc/lfops.c +++ b/armsrc/lfops.c @@ -642,6 +642,11 @@ void CmdASKsimTag(uint16_t arg1, uint16_t arg2, size_t size, uint8_t *BitStream) for (i=0; i<size; i++){ 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"); Dbprintf("Simulating with clk: %d, invert: %d, manchester: %d, separator: %d, n: %d",clk, invert, manchester, separator, n); diff --git a/client/cmddata.c b/client/cmddata.c index 0bd8a7a9..e6e4dc0a 100644 --- a/client/cmddata.c +++ b/client/cmddata.c @@ -520,6 +520,7 @@ int CmdBiphaseDecodeRaw(const char *Cmd) PrintAndLog("Biphase Decoded using offset: %d - # errors:%d - data:",offset,errCnt); printBitStream(BitStream, size); 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; } @@ -534,7 +535,7 @@ void setBiphaseDemodBuf(uint8_t *BitStream, size_t size) return; } for (size_t idx=0; idx<size; idx++){ - if(BitStream[idx]){ + if(!BitStream[idx]){ rawStream[i++] = curPhase; rawStream[i++] = curPhase; curPhase ^= 1; -- 2.39.5