From 9686a8d4d589ada3b61bf6c259aeaf21668fc8d8 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 20 Jun 2016 13:21:36 +0200 Subject: [PATCH] @marshmellow42 's fix askAMP https://github.com/marshmellow42/proxmark3/commit/16ea2b8ca301b008e109528a96fd9ba12815b7a9 --- common/lfdemod.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/common/lfdemod.c b/common/lfdemod.c index f797911c3..a410fd7c3 100644 --- a/common/lfdemod.c +++ b/common/lfdemod.c @@ -259,13 +259,15 @@ int cleanAskRawDemod(uint8_t *BinStream, size_t *size, int clk, int invert, int //by marshmellow void askAmp(uint8_t *BitStream, size_t size) { - for(size_t i = 1; i=30) //large jump up - BitStream[i]=255; - else if(BitStream[i]-BitStream[i-1]<=-20) //large jump down - BitStream[i]=0; + uint8_t last = 128; + for(size_t i = 1; i < size; ++i){ + if (BitStream[i]-BitStream[i-1] >= 30) //large jump up + last = 255; + else if(BitStream[i-1] - BitStream[i] >= 20) //large jump down + last = 0; + + BitStream[i] = last; } - return; } //by marshmellow