private void UpdateDisplay() { display.WriteCentered("Power management", LCDColor.Grey); display.Write(""); display.WriteCentered("Solar power status", new LCDColor(1, 1, 2)); display.Write(" Currently " + solarState.GetName()); display.Write(" Output: " + SolarDisplay.FormatRatio(solarManager.MaxOutput, solarManager.MaxHistoricalOutput)); display.DrawRatio(solarManager.MaxOutput, solarManager.MaxHistoricalOutput); display.Write(""); display.Write(""); display.WriteCentered("Main batteries status", new LCDColor(1, 1, 2)); WriteBatteryStatus(mainBatteriesManager); display.Write(""); display.Write(""); display.WriteCentered("Connected batteries status", new LCDColor(1, 1, 2)); WriteBatteryStatus(connectedBatteriesManager); display.Write(""); display.Write(""); display.WriteCentered("Time management", new LCDColor(1, 1, 2)); TimeStruct time = dayTracker.GetTime(); display.Write("Time of day: " + time.GetTime().ToString()); display.Write("Length of day: " + time.GetDayLength().ToString()); display.Write(solarManager.GetOutputHistory()); display.Flush(); }
private TransitionTypeEnum GetTransitionType(SolarState newState) { if (_lastState == null) { return(TransitionTypeEnum.Irrelevant); } else if (_lastState.GetName() == newState.GetName()) { // apparently can't check types directly return(TransitionTypeEnum.None); } else if (_lastState is SolarStateIdlingDay && newState is SolarStateChasing) { return(TransitionTypeEnum.IdlingToChasing); } else if (_lastState is SolarStateChasing && newState is SolarStateIdlingDay) { return(TransitionTypeEnum.ChasingToIdling); } else if (_lastState is SolarStateChasing && newState is SolarStateIdlingDusk) { return(TransitionTypeEnum.DayToDusk); } else if (_lastState is SolarStateIdlingDusk && newState is SolarStateReseting) { return(TransitionTypeEnum.DuskToNight); } else if (_lastState is SolarStateIdlingNight && newState is SolarStateIdlingDawn) { return(TransitionTypeEnum.NightToDawn); } else if (_lastState is SolarStateIdlingDawn && newState is SolarStateChasing) { return(TransitionTypeEnum.DawnToDay); } else { return(TransitionTypeEnum.Irrelevant); } }