From e99918961c592a350fd6fa17a0d485bedcb91242 Mon Sep 17 00:00:00 2001 From: Paul Ortyl Date: Wed, 19 Aug 2015 22:43:38 +0200 Subject: [PATCH] GT-WT-02: minor code cleanup --- src/devices/gt_wt_02.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/gt_wt_02.c b/src/devices/gt_wt_02.c index 8f6614ed..37aad2a7 100644 --- a/src/devices/gt_wt_02.c +++ b/src/devices/gt_wt_02.c @@ -56,11 +56,11 @@ static int gt_wt_02_process_row(int row, const bitbuffer_t *bitbuffer) //fprintf(stderr, "GT-WT-02: %02x %02x %02x %02x %02x\n", b[0], b[1], b[2], b[3], b[4]); - // sum 8 nibbles (use 31 bits, the last one fill with 0 on 31st bit) + // sum 8 nibbles (use 31 bits, the last one fill with 0 on 32nd bit) const int sum_nimbbles = ((b[0] >> 4) & 0xF) + (b[0] & 0xF) + ((b[1] >> 4) & 0xF) + (b[1] & 0xF) + ((b[2] >> 4) & 0xF) + (b[2] & 0xF) - + ((b[3] >> 4) & 0xF) + ((((b[3] >> 1)) & 0x7) << 1); + + ((b[3] >> 4) & 0xF) + (b[3] & 0xe); // put last 6 bits into a number const int checksum = ((b[3] & 1 )<<5) + (b[4]>>3);