From ac9beafcbcbd3f217a13d7f014d0a4111f69ebc6 Mon Sep 17 00:00:00 2001 From: Demon Singur Date: Sun, 22 Apr 2018 03:38:15 +0000 Subject: [PATCH] whyred: light: update state after notification is handled Change-Id: Ic36b112c58316da802a6dfd011cbd25a0e842eef --- light/Light.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/light/Light.cpp b/light/Light.cpp index 7a19a58..7afff31 100644 --- a/light/Light.cpp +++ b/light/Light.cpp @@ -179,18 +179,22 @@ static std::vector> notificationStates = { }; static void handleNotification(Type type, const LightState& state) { + bool handled = false; + for(auto it : notificationStates) { if (it.first == type) { it.second = state; } - if (isLit(it.second)) { + if (!handled && isLit(it.second)) { setNotification(it.second); - return; + handled = true; } } - setNotification(offState); + if (!handled) { + setNotification(offState); + } } static std::map> lights = {