Beispiel #1
0
        static Pump AddPump(string ID, string ingredientName, int pinNumber)
        {
            Pump pump = new Pump();

            pump.ID         = ID;
            pump.Ingredient = ingredientName;

            if (gpio != null && pinNumber > 0)
            {
                GpioPin pin = gpio.OpenPin(pinNumber);
                pin.Write(GpioPinValue.High);
                pin.SetDriveMode(GpioPinDriveMode.Output);
                pump.Pin = pin;
            }

            Pumps.Add(pump);
            return(pump);
        }
Beispiel #2
0
        private void cmdPrime_Click(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;
            Pump   pump   = button?.DataContext as Pump;

            if (pump != null)
            {
                if (!pump.IsPriming)
                {
                    pump.StopRecover();
                    pump.StartPrime();
                }
                else
                {
                    pump.StopPrime();
                }
                button.Content = pump.CaptionPrimeButton;
            }
        }