From c4e15dba00c137335d33a5c339cf1512c20a6f03 Mon Sep 17 00:00:00 2001 From: Florent Benoist Date: Wed, 18 Nov 2020 19:25:43 +0100 Subject: [PATCH] Fix/no signal detection (#1087) --- CHANGELOG.md | 1 + include/utils/ColorRgb.h | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a74f4c7..93924d24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - AVAHI included in Webserver (#996) - Fix add libcec to deb/rpm dependency list - Fix Hyperion configuration is corrected during start-up, if required +- Fix color comparison / Signal detection (#1087) ### Removed - Replace Multi-Lightpack by multi-instance Lightpack configuration (#1049) diff --git a/include/utils/ColorRgb.h b/include/utils/ColorRgb.h index 780f44d0..7f11849c 100644 --- a/include/utils/ColorRgb.h +++ b/include/utils/ColorRgb.h @@ -97,17 +97,23 @@ inline bool operator!=(const ColorRgb & lhs, const ColorRgb & rhs) /// Compare operator to check if a color is 'smaller' than or 'equal' to another color inline bool operator<=(const ColorRgb & lhs, const ColorRgb & rhs) { - return lhs < rhs || lhs == rhs; + return lhs.red <= rhs.red && + lhs.green <= rhs.green && + lhs.blue <= rhs.blue; } /// Compare operator to check if a color is 'greater' to another color inline bool operator>(const ColorRgb & lhs, const ColorRgb & rhs) { - return !(lhs < rhs) && lhs != rhs; + return lhs.red > rhs.red && + lhs.green > rhs.green && + lhs.blue > rhs.blue; } /// Compare operator to check if a color is 'greater' than or 'equal' to another color inline bool operator>=(const ColorRgb & lhs, const ColorRgb & rhs) { - return lhs > rhs || lhs == rhs; + return lhs.red >= rhs.red && + lhs.green >= rhs.green && + lhs.blue >= rhs.blue; }