From 7ae76d003fc0bb881c55978e6bb8f7ea62869c50 Mon Sep 17 00:00:00 2001 From: Maurice Makaay Date: Thu, 22 Jul 2021 01:29:37 +0200 Subject: [PATCH] Small logic error fixed in new set_slider_level() function. --- components/xiaomi_bslamp2/front_panel_hal.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/components/xiaomi_bslamp2/front_panel_hal.h b/components/xiaomi_bslamp2/front_panel_hal.h index e07ad36..cbe524b 100644 --- a/components/xiaomi_bslamp2/front_panel_hal.h +++ b/components/xiaomi_bslamp2/front_panel_hal.h @@ -285,15 +285,16 @@ class FrontPanelHAL : public Component, public i2c::I2CDevice { void set_slider_level(float level) { turn_off_leds(LED_ALL_SLIDER); if (level == 0.00f) return; - if (level >= 0.15f) turn_on_leds(LED_2); - if (level >= 0.25f) turn_on_leds(LED_3); - if (level >= 0.35f) turn_on_leds(LED_4); - if (level >= 0.45f) turn_on_leds(LED_5); - if (level >= 0.55f) turn_on_leds(LED_6); - if (level >= 0.65f) turn_on_leds(LED_7); - if (level >= 0.75f) turn_on_leds(LED_8); - if (level >= 0.85f) turn_on_leds(LED_9); - if (level >= 0.95f) turn_on_leds(LED_10); + if (level > 0.00f) turn_on_leds(LED_1); + if (level > 0.15f) turn_on_leds(LED_2); + if (level > 0.25f) turn_on_leds(LED_3); + if (level > 0.35f) turn_on_leds(LED_4); + if (level > 0.45f) turn_on_leds(LED_5); + if (level > 0.55f) turn_on_leds(LED_6); + if (level > 0.65f) turn_on_leds(LED_7); + if (level > 0.75f) turn_on_leds(LED_8); + if (level > 0.85f) turn_on_leds(LED_9); + if (level > 0.95f) turn_on_leds(LED_10); } protected: