Added setting for turning leds off at certain times of day

This commit is contained in:
PS 2021-04-09 00:58:50 -10:00
parent 7a103dae42
commit 0c96f6bd19
3 changed files with 31 additions and 94 deletions

View File

@ -1,92 +0,0 @@
lumenarium_animation_file;
animation_name: "ambient_0";
layers_count: 2;
blocks_count: 9;
playable_range:{
min: 0;
max: 1000;
};
layers:{
layer:{
name: "Color";
blend: "Add";
};
layer:{
name: "Mask";
blend: "Multiply";
};
};
blocks:{
block:{
frame_range:{
min: 88;
max: 315;
};
layer_index: 0;
animation_name: "Pattern_Rotary";
};
block:{
frame_range:{
min: 156;
max: 429;
};
layer_index: 1;
animation_name: "Pattern_LeafyPatchy";
};
block:{
frame_range:{
min: 403;
max: 675;
};
layer_index: 1;
animation_name: "Pattern_Patchy";
};
block:{
frame_range:{
min: 643;
max: 997;
};
layer_index: 1;
animation_name: "Pattern_LeafyPatchy";
};
block:{
frame_range:{
min: 253;
max: 571;
};
layer_index: 0;
animation_name: "Pattern_VerticalLines";
};
block:{
frame_range:{
min: 522;
max: 772;
};
layer_index: 0;
animation_name: "Pattern_Rotary";
};
block:{
frame_range:{
min: 737;
max: 998;
};
layer_index: 0;
animation_name: "Pattern_VerticalLines";
};
block:{
frame_range:{
min: 0;
max: 117;
};
layer_index: 0;
animation_name: "Pattern_VerticalLines";
};
block:{
frame_range:{
min: 0;
max: 179;
};
layer_index: 1;
animation_name: "Pattern_StemSolid";
};
};

View File

@ -693,6 +693,25 @@ BlumenLumen_CustomUpdate(gs_data UserData, app_state* State, context* Context)
}
}
bool TimelineShouldAdvance = false;
r32 OverrideBrightness = 0.0f;
for (u32 i = 0; i < LedOnTimesCount; i++)
{
time_range Range = LedOnTimes[i];
bool CurrTimeInRange = SystemTimeIsInTimeRange(Context->SystemTime_Current, Range);
if (CurrTimeInRange)
{
// If we're in one of the specified time ranges,
// play animations and set brightness
OverrideBrightness = BLState->BrightnessPercent;
TimelineShouldAdvance = State->AnimationSystem.TimelineShouldAdvance;
break;
}
}
State->AnimationSystem.TimelineShouldAdvance = TimelineShouldAdvance;
BLState->BrightnessPercent = OverrideBrightness;
// Dim the leds based on temp data
if (!BLState->DEBUG_IgnoreWeatherDimmingLeds)
{

View File

@ -27,17 +27,27 @@ gs_const_string AmbientPatternFolder = ConstString("data/blumen_animations/ambie
gs_const_string VoicePatternFolder = ConstString("data/blumen_animations/audio_responses/*.foldanim");
// The times of day when the motors should be open.
//
// @TimeFormat: documentation follows
// these are in the format { Start_Hour, Start_Minute, End_Hour, End_Minute }
// Hours are in the range 0-23 inclusive
// Minutes are in the range 0-59 inclusive
//
// NOTE: There is no need to modify the MotorOpenTimesCount variable -
// it is a compile time constant that gets calculated automatically
global time_range MotorOpenTimes[] = {
{ 12, 45, 17, 45 },
{ 19, 00, 23, 00 },
{ 12, 45, 17, 45 }, // 12:45pm to 5:45pm
{ 19, 00, 23, 00 }, // 7:00pm to 11:00pm
};
global u32 MotorOpenTimesCount = CArrayLength(MotorOpenTimes); // do not edit
// The times of day when the leds should be on
// Search for @TimeFormat to find documentation
global time_range LedOnTimes[] = {
{ 00, 00, 23, 59 }, // literally always
};
global u32 LedOnTimesCount = CArrayLength(LedOnTimes); // do not edit
// How long it takes to fade from the default pattern to the
// voice activated pattern
r32 VoiceCommandFadeDuration = 1.0f; // in seconds