static void Main(string[] args) { var schedule = new Schedule(); var timeClock = new TimeClock(schedule); timeClock.Start(); }
public void SetHeatingMode(TimeClock context) { Console.WriteLine(nameof(OnState)); context.SetState(new Offstate()); }
public void SetHeatingMode(TimeClock context) { Console.WriteLine(nameof(Offstate)); // loop here // Check for boost mode. Cancellation token? // context.SetState(Boost); // check for if it is time for boiler to switch on context.SetState(new OnState()); }
public void SetHeatingMode(TimeClock context) { Console.WriteLine(nameof(BoostState)); BoostIsOn = true; var boostDurationTimeSpan = new TimeSpan(0, context.Schedule.BoostDurationMinutes, 0); var boostTimer = new System.Timers.Timer(boostDurationTimeSpan.TotalMilliseconds); boostTimer.Enabled = true; boostTimer.Elapsed += OnBoostTimerElapsed; boostTimer.Start(); while (BoostIsOn) { Console.WriteLine("Checking if Boost is On (Should be every second)"); Thread.Sleep(1000); break; } // Set GPIO Pins here context.SetStateFromSchedule(); }