sparkfun / SparkFun_MAX3010x_Sensor_Library

An Arduino Library for the MAX3015 particle sensor and MAX30102 Pulse Ox sensor
Other
221 stars 148 forks source link

Bitwise AND or Boolean??? #39

Open jaggzh opened 2 years ago

jaggzh commented 2 years ago

https://github.com/sparkfun/SparkFun_MAX3010x_Sensor_Library/blob/master/src/heartRate.cpp#L108

In multiple places, this strange use of bitwise AND is used:

src/heartRate.cpp:108:33: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
     if ((IR_AC_Max - IR_AC_Min) > 20 & (IR_AC_Max - IR_AC_Min) < 1000)
nseidle commented 2 years ago

Strange indeed. I believe it's a hold over from Maxim's PBA implementation. If you think it's worth fixing, a PR would be much appreciated.