From 4f0dbfb38902cc474545cce1e7ba60966f78b5cb Mon Sep 17 00:00:00 2001 From: Alexey 'Cluster' Avdyukhin Date: Fri, 9 Oct 2020 23:26:51 +0300 Subject: [PATCH] LCD Zapper sensor logic should be inverted because 0: detected; 1: not detected --- src/input/lcdcompzapper.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/input/lcdcompzapper.cpp b/src/input/lcdcompzapper.cpp index 64be1b39..e3b387cc 100644 --- a/src/input/lcdcompzapper.cpp +++ b/src/input/lcdcompzapper.cpp @@ -35,8 +35,9 @@ void UpdateLCDCompZapper(int w, void* data, int arg) // In the '(*(uint32*)data)' variable, bit 0 holds the trigger value and bit 1 holds the light sense value. // Ultimately this needs to be converted from 0000 00lt to 000t l000 where l is the light bit and t // is the trigger bit. + // l must be inverted because 0: detected; 1: not detected lcdCompZapperData[w] = ((((*(uint32*)data) & 1) << 4) | - (((*(uint32*)data) & 2) << 2)); + (((*(uint32*)data) & 2 ^ 2) << 2)); } static INPUTC LCDCompZapperCtrl = { ReadLCDCompZapper,0,StrobeLCDCompZapper,UpdateLCDCompZapper,0,0 };