From: iceman1001 Date: Mon, 20 Jun 2016 11:21:36 +0000 (+0200) Subject: @marshmellow42 's fix askAMP https://github.com/marshmellow42/proxmark3/commit/16ea2b... X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/9686a8d4d589ada3b61bf6c259aeaf21668fc8d8 @marshmellow42 's fix askAMP https://github.com/marshmellow42/proxmark3/commit/16ea2b8ca301b008e109528a96fd9ba12815b7a9 --- diff --git a/common/lfdemod.c b/common/lfdemod.c index f797911c..a410fd7c 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