Fix/no signal detection (#1087)

This commit is contained in:
Florent Benoist 2020-11-18 19:25:43 +01:00 committed by GitHub
parent a0311bd8b5
commit c4e15dba00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -48,6 +48,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- AVAHI included in Webserver (#996) - AVAHI included in Webserver (#996)
- Fix add libcec to deb/rpm dependency list - Fix add libcec to deb/rpm dependency list
- Fix Hyperion configuration is corrected during start-up, if required - Fix Hyperion configuration is corrected during start-up, if required
- Fix color comparison / Signal detection (#1087)
### Removed ### Removed
- Replace Multi-Lightpack by multi-instance Lightpack configuration (#1049) - Replace Multi-Lightpack by multi-instance Lightpack configuration (#1049)

View File

@ -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 /// Compare operator to check if a color is 'smaller' than or 'equal' to another color
inline bool operator<=(const ColorRgb & lhs, const ColorRgb & rhs) 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 /// Compare operator to check if a color is 'greater' to another color
inline bool operator>(const ColorRgb & lhs, const ColorRgb & rhs) 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 /// Compare operator to check if a color is 'greater' than or 'equal' to another color
inline bool operator>=(const ColorRgb & lhs, const ColorRgb & rhs) 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;
} }