From 965ca7c89186d3adc1cb63a75f001c4cf1079e2d Mon Sep 17 00:00:00 2001 From: PS Date: Mon, 26 Apr 2021 14:46:07 -1000 Subject: [PATCH] Fixed brightness for leds --- src/app/ss_blumen_lumen/blumen_lumen.cpp | 29 ++++++++---------------- src/app/ss_blumen_lumen/blumen_lumen.h | 2 +- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/app/ss_blumen_lumen/blumen_lumen.cpp b/src/app/ss_blumen_lumen/blumen_lumen.cpp index 2833d6c..349db9c 100644 --- a/src/app/ss_blumen_lumen/blumen_lumen.cpp +++ b/src/app/ss_blumen_lumen/blumen_lumen.cpp @@ -566,16 +566,6 @@ BlumenLumen_CustomUpdate(gs_data UserData, app_state* State, context* Context) { temp_packet Temp = Packet.TempPacket; BLState->LastTemperatureReceived = Temp.Temperature; - - if (Blumen_TempShouldDimLeds(BLState)) - { - BLState->BrightnessPercent = HighTemperatureBrightnessPercent; - } - else - { - BLState->BrightnessPercent = FullBrightnessPercent; - } - DEBUG_ReceivedTemperature(Temp, Context->ThreadContext); BLState->ShouldUpdateLog = true; }break; @@ -751,15 +741,16 @@ BlumenLumen_CustomUpdate(gs_data UserData, app_state* State, context* Context) LedOnTimesCount, &RangeIn)) { - // If we're in one of the specified time ranges, - // play animations and set brightness - // - // The values of BrightnessPercent and TimelineShouldAdvance - // are set according to less strict rules above in this update - // function. All we are doing is saying "If we are in a valid - // time range, keep those values". - OverrideBrightness = BLState->BrightnessPercent; - TimelineShouldAdvance = State->AnimationSystem.TimelineShouldAdvance; + + if (Blumen_TempShouldDimLeds(BLState)) + { + OverrideBrightness = HighTemperatureBrightnessPercent; + } + else + { + OverrideBrightness = FullBrightnessPercent; + } + TimelineShouldAdvance = true; } State->AnimationSystem.TimelineShouldAdvance = TimelineShouldAdvance; diff --git a/src/app/ss_blumen_lumen/blumen_lumen.h b/src/app/ss_blumen_lumen/blumen_lumen.h index 6c5ab47..fb04238 100644 --- a/src/app/ss_blumen_lumen/blumen_lumen.h +++ b/src/app/ss_blumen_lumen/blumen_lumen.h @@ -151,7 +151,7 @@ SystemTimeIsAfterTime(system_time SysTime, s32 Hour, s32 Minute) { bool Result = false; if (SysTime.Hour == Hour) { - Result = SysTime.Minute > Minute; + Result = SysTime.Minute >= Minute; } else { Result = SysTime.Hour > Hour; }