From 00941c697587d9876ee5e3a70488b455a67e4fbe Mon Sep 17 00:00:00 2001 From: Maurice Makaay Date: Wed, 14 Apr 2021 00:29:37 +0200 Subject: [PATCH] Fixed some method access levels that got messy over time. --- light/color_instant_handler.h | 2 +- light/color_night_light.h | 2 +- light/color_off.h | 2 +- light/color_rgb_light.h | 3 ++- light/color_transition_handler.h | 8 ++++---- light/color_white_light.h | 3 ++- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/light/color_instant_handler.h b/light/color_instant_handler.h index 44194ab..29587e3 100644 --- a/light/color_instant_handler.h +++ b/light/color_instant_handler.h @@ -27,7 +27,7 @@ namespace bs2 { * - RGB light: based on RGB values + brightness */ class ColorInstantHandler : public GPIOOutputs { -protected: +public: bool set_light_color_values(light::LightColorValues v) { GPIOOutputs *delegate; diff --git a/light/color_night_light.h b/light/color_night_light.h index fa3efc4..fdce2ba 100644 --- a/light/color_night_light.h +++ b/light/color_night_light.h @@ -18,7 +18,7 @@ namespace bs2 { * more natural. */ class ColorNightLight : public GPIOOutputs { -protected: +public: bool set_light_color_values(light::LightColorValues v) { // Note: I do not check for a brightness at or below 0.01 (1%) here, // because the lowest brightness setting from Home Assistant turns diff --git a/light/color_off.h b/light/color_off.h index 0230d38..36973cc 100644 --- a/light/color_off.h +++ b/light/color_off.h @@ -14,7 +14,7 @@ namespace bs2 { * This class can handle the GPIO outputs in case the light of turned off. */ class ColorOff : public GPIOOutputs { -protected: +public: bool set_light_color_values(light::LightColorValues v) { if (v.get_state() != 0.0f && v.get_brightness() != 0.0f) { return false; diff --git a/light/color_rgb_light.h b/light/color_rgb_light.h index f7ff10c..fffadaa 100644 --- a/light/color_rgb_light.h +++ b/light/color_rgb_light.h @@ -245,7 +245,7 @@ static const RGBCircle rgb_circle_ {{ * based on RGB color values + brightness. */ class ColorRGBLight : public GPIOOutputs { -protected: +public: bool set_light_color_values(light::LightColorValues v) { if (v.get_white() > 0.0f) { return false; @@ -340,6 +340,7 @@ protected: apply_brightness_(p, brightness, rgb); } +protected: /** * Returns the position on an RGB ring in degrees (0 - 359). */ diff --git a/light/color_transition_handler.h b/light/color_transition_handler.h index d5fa01b..8cc72ae 100644 --- a/light/color_transition_handler.h +++ b/light/color_transition_handler.h @@ -49,6 +49,10 @@ class ColorTransitionHandler : public GPIOOutputs { public: ColorTransitionHandler(LightStateTransformerInspector *inspector) : transformer_(inspector) {} + light::LightColorValues get_end_values() { + return end_light_values_; + } + bool set_light_color_values(light::LightColorValues values) { if (!light_state_has_active_transition_()) { // Remember the last active light color values. When a transition @@ -90,10 +94,6 @@ public: return true; } - light::LightColorValues get_end_values() { - return end_light_values_; - } - protected: bool active_ = false; float progress_ = 0.0f; diff --git a/light/color_white_light.h b/light/color_white_light.h index a74209e..a761834 100644 --- a/light/color_white_light.h +++ b/light/color_white_light.h @@ -73,7 +73,7 @@ static const RGBWLevelsTable rgbw_levels_100_ {{ * based on color temperature + brightness. */ class ColorWhiteLight : public GPIOOutputs { -protected: +public: bool set_light_color_values(light::LightColorValues v) { if (v.get_white() == 0.0f) { return false; @@ -93,6 +93,7 @@ protected: return true; } +protected: float clamp_temperature_(float temperature) { if (temperature > MIRED_MAX)