Fixed brightness for leds

This commit is contained in:
PS 2021-04-26 14:46:07 -10:00
parent 9ebadc543b
commit 965ca7c891
2 changed files with 11 additions and 20 deletions

View File

@ -566,16 +566,6 @@ BlumenLumen_CustomUpdate(gs_data UserData, app_state* State, context* Context)
{ {
temp_packet Temp = Packet.TempPacket; temp_packet Temp = Packet.TempPacket;
BLState->LastTemperatureReceived = Temp.Temperature; BLState->LastTemperatureReceived = Temp.Temperature;
if (Blumen_TempShouldDimLeds(BLState))
{
BLState->BrightnessPercent = HighTemperatureBrightnessPercent;
}
else
{
BLState->BrightnessPercent = FullBrightnessPercent;
}
DEBUG_ReceivedTemperature(Temp, Context->ThreadContext); DEBUG_ReceivedTemperature(Temp, Context->ThreadContext);
BLState->ShouldUpdateLog = true; BLState->ShouldUpdateLog = true;
}break; }break;
@ -751,15 +741,16 @@ BlumenLumen_CustomUpdate(gs_data UserData, app_state* State, context* Context)
LedOnTimesCount, LedOnTimesCount,
&RangeIn)) &RangeIn))
{ {
// If we're in one of the specified time ranges,
// play animations and set brightness if (Blumen_TempShouldDimLeds(BLState))
// {
// The values of BrightnessPercent and TimelineShouldAdvance OverrideBrightness = HighTemperatureBrightnessPercent;
// are set according to less strict rules above in this update }
// function. All we are doing is saying "If we are in a valid else
// time range, keep those values". {
OverrideBrightness = BLState->BrightnessPercent; OverrideBrightness = FullBrightnessPercent;
TimelineShouldAdvance = State->AnimationSystem.TimelineShouldAdvance; }
TimelineShouldAdvance = true;
} }
State->AnimationSystem.TimelineShouldAdvance = TimelineShouldAdvance; State->AnimationSystem.TimelineShouldAdvance = TimelineShouldAdvance;

View File

@ -151,7 +151,7 @@ SystemTimeIsAfterTime(system_time SysTime, s32 Hour, s32 Minute)
{ {
bool Result = false; bool Result = false;
if (SysTime.Hour == Hour) { if (SysTime.Hour == Hour) {
Result = SysTime.Minute > Minute; Result = SysTime.Minute >= Minute;
} else { } else {
Result = SysTime.Hour > Hour; Result = SysTime.Hour > Hour;
} }