Skip to content

Commit

Permalink
Option to Ignore cooldwon
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenithVal committed Mar 15, 2024
1 parent 1b8ff71 commit eab5f11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions Configs/TimerMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class TimerMode {

[TomlInlineComment("Cooldown (miliseconds) between allowed inputs, 0 to disable.")]
public int input_cooldown { get; set; }
public bool input_cooldown_ignore { get; set; }


[TomlPrecedingComment("-- Outgoing OSC Parameters ---")]
Expand Down
10 changes: 7 additions & 3 deletions Logic/OSCTimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ public static class OSCTimer {
private static int inc_step;
private static string dec_parameter;
private static int dec_step;
private static float input_cooldown;

private static int readout_mode;
private static string readout_parameter;
private static string readout_parameter2;

private static float input_cooldown;
private static bool input_cooldown_ignore;
private static bool cooldown_tracker;
private static string cooldown_parameter;
private static DateTime cooldownEndTime = DateTime.Now;
Expand All @@ -43,7 +44,7 @@ public static async Task OnIncParam(OscMessage message) {
if (shouldAdd) {
Console.WriteLine($"Param recieved - Attempting to add {inc_step} seconds(s)");

if (input_cooldown > 0 && DateTime.Now < cooldownEndTime)
if (input_cooldown > 0 && !input_cooldown_ignore && DateTime.Now < cooldownEndTime)
{
ColorConsole.WithYellowText.WriteLine($"Restricted by input cooldown until: " + cooldownEndTime);
}
Expand Down Expand Up @@ -123,7 +124,10 @@ public static void Setup() {
}

input_cooldown = timerConfig.input_cooldown;
Console.WriteLine($"input_cooldoown: {input_cooldown}\n");
input_cooldown_ignore = timerConfig.input_cooldown_ignore;
Console.WriteLine($"input_cooldoown: {input_cooldown}");
Console.WriteLine($"input_cooldown_ignore: {input_cooldown_ignore}");
Console.WriteLine();

readout_mode = timerConfig.readout_mode;
readout_parameter = timerConfig.readout_parameter;
Expand Down

0 comments on commit eab5f11

Please sign in to comment.