Пример #1
0
        private void MenuTap(object sender)
        {
            GHI.Glide.Display.Window Main_menu = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MAIN_MENU));
            Glide.MainWindow = Main_menu;

            this.setupCallbackManiMenu(Main_menu);
        }
Пример #2
0
        private void Initialize_Components()
        {
            // window
            window           = new GHI.Glide.Display.Window("window_Main", Window_Manager.Display_Width, Window_Manager.Display_Heigth);
            window.BackColor = Colors.White;

            // textBox_Header
            textBox_Header           = new TextBox("textBox_Header", 255, 120, 20, 270, 32);
            textBox_Header.Text      = "Aqua-Comp";
            textBox_Header.TextAlign = 2;
            window.AddChild(textBox_Header);

            // textBox_Time
            textBox_Time           = new TextBox("textBox_Time", 255, 410, 20, 50, 32);
            textBox_Time.Text      = "--:--";
            textBox_Time.TextAlign = 2;
            window.AddChild(textBox_Time);

            // button_Calibrate
            textBox_Calibrate           = new TextBox("textBox_Calibrate", 255, 20, 20, 80, 32);
            textBox_Calibrate.Text      = "Calibrate";
            textBox_Calibrate.TextAlign = 2;
            textBox_Calibrate.TapEvent += new OnTap(button_Calibrate_TapEvent);
            window.AddChild(textBox_Calibrate);

            // button_Fertilize
            button_Fertilize           = new Button("button_Fertilize", 255, 20, 70, 80, 32);
            button_Fertilize.Text      = "Fertilize";
            button_Fertilize.TapEvent += new OnTap(button_Fertilize_TapEvent);
            window.AddChild(button_Fertilize);
        }
Пример #3
0
        private void setupCallbackManiMenu(GHI.Glide.Display.Window Main_menu)
        {
            /*Button Set_heating = (Button)Main_menu.GetChildByName("Set_heating");
             * Set_heating.TapEvent += TempTap;
             *
             * Button Set_light = (Button)Main_menu.GetChildByName("Set_light");
             * Set_light.TapEvent += LumTap;*/

            Button Up_motor   = (Button)Main_menu.GetChildByName("Up_motor");
            Button Down_motor = (Button)Main_menu.GetChildByName("Down_motor");

            Auto_heating = (Button)Main_menu.GetChildByName("Auto_heating");
            Auto_light   = (Button)Main_menu.GetChildByName("Auto_light");

            Auto_heating.PressEvent += Auto_heating_PressEvent;
            Auto_light.PressEvent   += Auto_light_PressEvent;

            Up_motor.PressEvent   += Up_motor_PressEvent;
            Up_motor.ReleaseEvent += Up_motor_ReleaseEvent;

            Down_motor.PressEvent   += Down_motor_PressEvent;
            Down_motor.ReleaseEvent += Up_motor_ReleaseEvent;


            ((Button)Main_menu.GetChildByName("On_heating")).TapEvent  += heatingOnTap;
            ((Button)Main_menu.GetChildByName("Off_heating")).TapEvent += heatingOffTap;

            ((Button)Main_menu.GetChildByName("On_light")).TapEvent  += lightOnTap;
            ((Button)Main_menu.GetChildByName("Off_light")).TapEvent += lightOffTap;

            luminosityText  = (TextBox)Main_menu.GetChildByName("Luminosity_box");
            presenceText    = (TextBox)Main_menu.GetChildByName("Presence_box");
            temperatureText = (TextBox)Main_menu.GetChildByName("Temperature_box");
        }
Пример #4
0
        void ProgramStarted()
        {

            this.last = new Point(0, 0);
            this.touched = false;

            this.displayCP7.ScreenPressed += this.OnScreenPressed;
            this.displayCP7.ScreenReleased += this.OnScreenReleased;
            this.displayCP7.GestureDetected += this.OnGesureDetected;

            Glide.FitToScreen = true;

            Debug.Print("Program Started");

            mainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.mainWindow));
            Image image = (Image)mainWindow.GetChildByName("earthImage");

            image.Bitmap = new Bitmap(Resources.GetBytes(Resources.BinaryResources.main),Bitmap.BitmapImageType.Jpeg);
            mainWindow.BackColor = Microsoft.SPOT.Presentation.Media.Color.White;
            Glide.MainWindow = mainWindow;

            DateTime dateTime = new DateTime(2015, 12, 18, 20, 53, 0);
            Utility.SetLocalTime(dateTime);
            RealTimeClock.SetDateTime(dateTime);

            GHI.Glide.UI.Button myText = (GHI.Glide.UI.Button)mainWindow.GetChildByName("keyboard");
            myText.PressEvent += new OnPress(Glide.OpenKeyboard);

            Gadgeteer.Timer timer = new Gadgeteer.Timer(500);

            timer.Tick += TimerTick;
            timer.Start();
        }
Пример #5
0
        /****************
         * FUNCTION
         * *************/
        void first_step()
        {
            flagmdf = 0;

            /*button plus(input 4)*/
            plus.ButtonPressed += Plus_ButtonPressed;
            plus.TurnLedOff();
            /*button minus(input 5)*/
            minus.ButtonPressed += Minus_ButtonPressed;
            minus.TurnLedOff();

            Glide.FitToScreen = true;
            _mainwindow       = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Window));

            GlideTouch.Initialize();
            Glide.MainWindow = _mainwindow;

            /*create button to start*/
            _startbtn = (GHI.Glide.UI.Button)_mainwindow.GetChildByName("startbtn");
            /*press button event*/
            _startbtn.PressEvent += Button_PressEvent;

            //_logo = (GHI.Glide.UI.Image)_mainwindow.GetChildByName("logo");
            //_logo.Bitmap = new Bitmap(Resources.GetBytes(Resources.BinaryResources.logo), Bitmap.BitmapImageType.Jpeg);
            //_logo.Invalidate();
            //Bitmap prova = new Bitmap(Resources.GetBytes(Resources.BinaryResources.logo), Bitmap.BitmapImageType.Gif);

            //displayTE35.SimpleGraphics.DisplayImage(prova, 30, 20);
            //displayTE35.BacklightEnabled = true;
        }
Пример #6
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            multicolorLED.BlinkOnce(GT.Color.Red);
            //7" Displays
            Display.Width  = 800;
            Display.Height = 480;
            Display.OutputEnableIsFixed      = false;
            Display.OutputEnablePolarity     = true;
            Display.PixelPolarity            = false;
            Display.PixelClockRateKHz        = 30000;
            Display.HorizontalSyncPolarity   = false;
            Display.HorizontalSyncPulseWidth = 48;
            Display.HorizontalBackPorch      = 88;
            Display.HorizontalFrontPorch     = 40;
            Display.VerticalSyncPolarity     = false;
            Display.VerticalSyncPulseWidth   = 3;
            Display.VerticalBackPorch        = 32;
            Display.VerticalFrontPorch       = 13;
            Display.Type = Display.DisplayType.Lcd;
            if (Display.Save())      // Reboot required?
            {
                PowerState.RebootDevice(false);
            }
            //set up touch screen
            CapacitiveTouchController.Initialize(GHI.Pins.FEZRaptor.Socket14.Pin3);

            window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MyForm));
            //glide init
            GlideTouch.Initialize();

            GHI.Glide.UI.Button btn = (GHI.Glide.UI.Button)window.GetChildByName("btnTest");
            img          = (GHI.Glide.UI.Image)window.GetChildByName("img1");
            txtLora      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtLora");
            txtStatus    = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtStatus");
            txtSPO2      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtSPO2");
            txtSignal    = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtSignal");
            txtPulseRate = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtPulseRate");
            txtDesc      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtDesc");
            img.Visible  = false;

            btn.TapEvent += btn_TapEvent;

            Glide.MainWindow = window;
            JoinWifi();
            Thread.Sleep(500);
            if (client == null)
            {
                // create client instance
                MQTT_BROKER_ADDRESS = "cloud.makestro.com";
                client = new MqttClient(MQTT_BROKER_ADDRESS);
                string clientId = Guid.NewGuid().ToString();
                client.Connect(clientId, "mifmasterz", "123qweasd");
                SubscribeMessage();
            }
            Thread th1 = new Thread(new ThreadStart(Loop));

            th1.Start();
        }
Пример #7
0
        /*apre pagina per il pagamento*/
        private void _payBtn_TapEvent(object sender)
        {
            /*load pagamento*/
            _pagamento       = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Pagamento));
            Glide.MainWindow = _pagamento;

            _paypal = (GHI.Glide.UI.TextBlock)_ordina.GetChildByName("paypal");
            _pagamento.Invalidate();
        }
Пример #8
0
        //Get input from the user
        public Player2Window()
        {
            Glide.FitToScreen = true;
            winPlayer2 = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Player2));
            currentGroup = 1;
            winPlayer2.Render();

            startNewRow();
        }
        //Get input from the user
        public Player2Window()
        {
            Glide.FitToScreen = true;
            winPlayer2        = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Player2));
            currentGroup      = 1;
            winPlayer2.Render();

            startNewRow();
        }
Пример #10
0
 public PromptForm(ref GHI.Glide.Display.Window window, ref Gadgeteer.Modules.GHIElectronics.DisplayTE35 displayTE35, ref SDCard sdCard, ref USBHost usbHost, ref USBClientEDP usbClientEDP, ref WiFiRS21 wifiRS21)
     : base(ref window)
 {
     this.usbClientEDP = usbClientEDP;
     this.usbHost      = usbHost;
     this.sdCard       = sdCard;
     this.displayTE35  = displayTE35;
     this.wifiRS21     = wifiRS21;
 }
Пример #11
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            /*******************************************************************************************
            *  Modules added in the Program.gadgeteer designer view are used by typing
            *  their name followed by a period, e.g.  button.  or  camera.
            *
            *  Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
            *   button.ButtonPressed +=<tab><tab>
            *
            *  If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
            *   GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
            *   timer.Tick +=<tab><tab>
            *   timer.Start();
            *******************************************************************************************/
            GHI.Glide.Display.Window Main_menu = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MAIN_MENU));
            //Debug.Print(Resources.GetString(Resources.StringResources.MAIN_MENU));
            Glide.MainWindow = Main_menu;

            GlideTouch.Initialize();
            setupCallbackManiMenu(Main_menu);

            multicolorLED.TurnOff(); //init the multicolor led
            //display = new DisplayController(this);
            status = new BoardStatus(this);
            presenceSensor.SomeoneDetected += presenceSensor_SomeoneDetected;

            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            //Debug.Print("Program Started");

            //starting the timer for the remperature sensor
            temperatureSensor.MeasurementComplete += ts_MeasurementComplete;
            GT.Timer timer = new GT.Timer(60000); // every second (1000ms)
            timer.Tick += temperature_timer_Tick;
            timer.Start();

            //setting up the ethernet interface
            ethernetJ11D.UseThisNetworkInterface();
            ethernetJ11D.UseStaticIP(boardIpAddress, "255.255.255.0", "192.168.1.1");
            ethernetJ11D.NetworkUp   += ethernetJ11D_NetworkUp;
            ethernetJ11D.NetworkDown += ethernetJ11D_NetworkDown;


            GT.Timer timer1 = new GT.Timer(60000); // every second (1000ms)
            timer1.Tick += luminosity_Getter;
            timer1.Start();

            //starting thread to send data to the server
            Thread t = new Thread(sendDataToServer);

            t.Start();
            temperatureSensor.RequestMeasurement();
            luminosity_Getter(timer1);
        }
Пример #12
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            //set display
            this.videoOut.SetDisplayConfiguration(VideoOut.Resolution.Vga800x600);
            //set glide
            window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MyForm));

            txtLora          = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtLora");
            txtStatus        = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtStatus");
            txtSPO2          = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtSPO2");
            txtSignal        = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtSignal");
            txtPulseRate     = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtPulseRate");
            Glide.MainWindow = window;

            //LORA init
            _loraSerial = new SimpleSerial(GHI.Pins.FEZSpiderII.Socket11.SerialPortName, 57600);
            _loraSerial.Open();
            _loraSerial.DataReceived += _loraSerial_DataReceived;
            //reset lora
            _restPort.Write(false);
            Thread.Sleep(1000);
            _restPort.Write(true);
            Thread.Sleep(1000);
            //setup lora for point to point
            //get lora version
            _loraSerial.WriteLine("sys get ver");
            Thread.Sleep(1000);
            //pause join
            _loraSerial.WriteLine("mac pause");
            Thread.Sleep(1000);
            //set antena power
            _loraSerial.WriteLine("radio set pwr 14");
            Thread.Sleep(1000);

            //var DT = new DateTime(2016, 6, 19, 12, 43, 0); // This will set the clock to 9:30:00 on 9/15/2014
            //RealTimeClock.SetDateTime(DT); //This will set the hardware Real-time Clock to what is in DT
            //Debug.Print("New Real-time Clock " + RealTimeClock.GetDateTime().ToString());

            new Thread(SendData).Start();
            //connect wifi
            SetupNetwork();

            //sync time
            var result = Waktu.UpdateTimeFromNtpServer("time.nist.gov", 7);  // Eastern Daylight Time

            Debug.Print(result ? "Time successfully updated" : "Time not updated");
        }
Пример #13
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            multicolorLED.BlinkOnce(GT.Color.Red);
            //7" Displays
            Display.Width  = 800;
            Display.Height = 480;
            Display.OutputEnableIsFixed      = false;
            Display.OutputEnablePolarity     = true;
            Display.PixelPolarity            = false;
            Display.PixelClockRateKHz        = 30000;
            Display.HorizontalSyncPolarity   = false;
            Display.HorizontalSyncPulseWidth = 48;
            Display.HorizontalBackPorch      = 88;
            Display.HorizontalFrontPorch     = 40;
            Display.VerticalSyncPolarity     = false;
            Display.VerticalSyncPulseWidth   = 3;
            Display.VerticalBackPorch        = 32;
            Display.VerticalFrontPorch       = 13;
            Display.Type = Display.DisplayType.Lcd;
            if (Display.Save())      // Reboot required?
            {
                PowerState.RebootDevice(false);
            }
            //set up touch screen
            CapacitiveTouchController.Initialize(GHI.Pins.FEZRaptor.Socket14.Pin3);

            window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MyForm));
            //glide init
            GlideTouch.Initialize();

            GHI.Glide.UI.Button btn = (GHI.Glide.UI.Button)window.GetChildByName("btnTest");
            img          = (GHI.Glide.UI.Image)window.GetChildByName("img1");
            txtLora      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtLora");
            txtStatus    = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtStatus");
            txtSPO2      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtSPO2");
            txtSignal    = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtSignal");
            txtPulseRate = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtPulseRate");
            txtDesc      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtDesc");
            img.Visible  = false;

            btn.TapEvent += btn_TapEvent;

            Glide.MainWindow = window;
            Thread th1 = new Thread(new ThreadStart(Loop));

            th1.Start();
        }
Пример #14
0
        //Constructor for 2 Players Game
        public MasterMind(int[] newSolution)
        {
            Glide.FitToScreen = true;
            masterMind = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MasterMind));
            currentGroup = 1;

            //Replace the solution with the input given by the user from 2 Player
            solution = newSolution;

            //Add color codes
            listColors[0] = 255;
            listColors[1] = 32768;
            listColors[2] = 16777215;
            listColors[3] = 16711680;
            listColors[4] = 65535;
            listColors[5] = 42495;

            masterMind.Render();
        }
Пример #15
0
        //Constructor for 2 Players Game
        public MasterMind(int[] newSolution)
        {
            Glide.FitToScreen = true;
            masterMind        = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MasterMind));
            currentGroup      = 1;

            //Replace the solution with the input given by the user from 2 Player
            solution = newSolution;

            //Add color codes
            listColors[0] = 255;
            listColors[1] = 32768;
            listColors[2] = 16777215;
            listColors[3] = 16711680;
            listColors[4] = 65535;
            listColors[5] = 42495;

            masterMind.Render();
        }
Пример #16
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            /*******************************************************************************************
            Modules added in the Program.gadgeteer designer view are used by typing
            their name followed by a period, e.g.  button.  or  camera.

            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>

            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>
                timer.Start();
            *******************************************************************************************/

            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");

            mainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.mainWindow));
            Glide.MainWindow = mainWindow;
        }
Пример #17
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            multicolorLED.BlinkOnce(GT.Color.Red);

            //7" Displays
            Display.Width  = 800;
            Display.Height = 480;
            Display.OutputEnableIsFixed      = false;
            Display.OutputEnablePolarity     = true;
            Display.PixelPolarity            = false;
            Display.PixelClockRateKHz        = 30000;
            Display.HorizontalSyncPolarity   = false;
            Display.HorizontalSyncPulseWidth = 48;
            Display.HorizontalBackPorch      = 88;
            Display.HorizontalFrontPorch     = 40;
            Display.VerticalSyncPolarity     = false;
            Display.VerticalSyncPulseWidth   = 3;
            Display.VerticalBackPorch        = 32;
            Display.VerticalFrontPorch       = 13;
            Display.Type = Display.DisplayType.Lcd;
            if (Display.Save())      // Reboot required?
            {
                PowerState.RebootDevice(false);
            }
            //set up touch screen
            CapacitiveTouchController.Initialize(GHI.Pins.FEZRaptor.Socket13.Pin3);
            //displayNHVN.Configure7InchDisplay();

            window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MyForm));
            //glide init
            GlideTouch.Initialize();

            btnReset = (GHI.Glide.UI.Button)window.GetChildByName("btnReset");
            dataGrid = (GHI.Glide.UI.DataGrid)window.GetChildByName("dataGrid");

            Glide.MainWindow = window;
            Thread th1 = new Thread(new ThreadStart(Looping));

            th1.Start();
        }
Пример #18
0
        //Constructor for 1 Player Game
        public MasterMind()
        {
            Glide.FitToScreen = true;
            masterMind = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MasterMind));
            currentGroup = 1;

            // Generate Random Sequence for colors
            for (int i = 0; i < solution.Length; i++)
            {
                solution[i] = new Random().Next(6);
                Debug.Print("\n Solution  :: " + solution[i]);
            }

            //Add color codes
            listColors[0] = 255;
            listColors[1] = 32768;
            listColors[2] = 16777215;
            listColors[3] = 16711680;
            listColors[4] = 65535;
            listColors[5] = 42495;

            masterMind.Render();
        }
Пример #19
0
        //Constructor for 1 Player Game
        public MasterMind()
        {
            Glide.FitToScreen = true;
            masterMind        = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MasterMind));
            currentGroup      = 1;

            // Generate Random Sequence for colors
            for (int i = 0; i < solution.Length; i++)
            {
                solution[i] = new Random().Next(6);
                Debug.Print("\n Solution  :: " + solution[i]);
            }

            //Add color codes
            listColors[0] = 255;
            listColors[1] = 32768;
            listColors[2] = 16777215;
            listColors[3] = 16711680;
            listColors[4] = 65535;
            listColors[5] = 42495;

            masterMind.Render();
        }
Пример #20
0
        private void Initialize_Components()
        {
            // window
            window           = new GHI.Glide.Display.Window("window_AWC_Edit", Window_Manager.Display_Width, Window_Manager.Display_Heigth);
            window.BackColor = Colors.White;

            // textBox_Header
            textBox_Header           = new TextBox("textBox_Header", 255, 120, 20, 270, 32);
            textBox_Header.Text      = "AWC Edit";
            textBox_Header.TextAlign = 2;
            window.AddChild(textBox_Header);

            // textBox_Time
            textBox_Time           = new TextBox("textBox_Time", 255, 410, 20, 50, 32);
            textBox_Time.Text      = "--:--";
            textBox_Time.TextAlign = 2;
            window.AddChild(textBox_Time);

            // textBox_Back
            textBox_Back           = new TextBox("button_Back", 255, 20, 20, 80, 32);
            textBox_Back.Text      = "Back";
            textBox_Back.TextAlign = 2;
            textBox_Back.TapEvent += new OnTap(button_Back_TapEvent);
            window.AddChild(textBox_Back);

            // textBox_Name_Pump1
            textBox_Name_Pump1      = new TextBox("textBox_Name_Pump1", 255, 120, 70, 170, 32);
            textBox_Name_Pump1.Text = Fertilize_Manager.Pump1.Name;
            window.AddChild(textBox_Name_Pump1);

            // textBox_Name_Pump2
            textBox_Name_Pump2      = new TextBox("textBox_Name_Pump2", 255, 120, 120, 170, 32);
            textBox_Name_Pump2.Text = Fertilize_Manager.Pump2.Name;
            window.AddChild(textBox_Name_Pump2);

            // textBox_Name_Pump3
            textBox_Name_Pump3      = new TextBox("textBox_Name_Pump3", 255, 120, 170, 170, 32);
            textBox_Name_Pump3.Text = Fertilize_Manager.Pump3.Name;
            window.AddChild(textBox_Name_Pump3);

            // textBox_Name_Pump4
            textBox_Name_Pump4      = new TextBox("textBox_Name_Pump4", 255, 120, 220, 170, 32);
            textBox_Name_Pump4.Text = Fertilize_Manager.Pump4.Name;
            window.AddChild(textBox_Name_Pump4);

            // textBox_Quantity_Pump1
            textBox_Quantity_Pump1                    = new TextBox("textBox_Quantity_Pump1", 255, 310, 70, 80, 32);
            textBox_Quantity_Pump1.Text               = Fertilize_Manager.Pump1.AWC_Quantity.ToString() + " ml";
            textBox_Quantity_Pump1.TextAlign          = 2;
            textBox_Quantity_Pump1.TapEvent          += textBox_Quantity_Pump1_TapEvent;
            textBox_Quantity_Pump1.ValueChangedEvent += textBox_Quantity_Pump1_ValueChangedEvent;
            window.AddChild(textBox_Quantity_Pump1);

            // textBox_Quantity_Pump2
            textBox_Quantity_Pump2                    = new TextBox("textBox_Quantity_Pump2", 255, 310, 120, 80, 32);
            textBox_Quantity_Pump2.Text               = Fertilize_Manager.Pump2.AWC_Quantity.ToString() + " ml";
            textBox_Quantity_Pump2.TextAlign          = 2;
            textBox_Quantity_Pump2.TapEvent          += textBox_Quantity_Pump2_TapEvent;
            textBox_Quantity_Pump2.ValueChangedEvent += textBox_Quantity_Pump2_ValueChangedEvent;
            window.AddChild(textBox_Quantity_Pump2);

            // textBox_Quantity_Pump3
            textBox_Quantity_Pump3                    = new TextBox("textBox_Quantity_Pump3", 255, 310, 170, 80, 32);
            textBox_Quantity_Pump3.Text               = Fertilize_Manager.Pump3.AWC_Quantity.ToString() + " ml";
            textBox_Quantity_Pump3.TextAlign          = 2;
            textBox_Quantity_Pump3.TapEvent          += textBox_Quantity_Pump3_TapEvent;
            textBox_Quantity_Pump3.ValueChangedEvent += textBox_Quantity_Pump3_ValueChangedEvent;
            window.AddChild(textBox_Quantity_Pump3);

            // textBox_Quantity_Pump4
            textBox_Quantity_Pump4                    = new TextBox("textBox_Quantity_Pump4", 255, 310, 220, 80, 32);
            textBox_Quantity_Pump4.Text               = Fertilize_Manager.Pump4.AWC_Quantity.ToString() + " ml";
            textBox_Quantity_Pump4.TextAlign          = 2;
            textBox_Quantity_Pump4.TapEvent          += textBox_Quantity_Pump4_TapEvent;
            textBox_Quantity_Pump4.ValueChangedEvent += textBox_Quantity_Pump4_ValueChangedEvent;
            window.AddChild(textBox_Quantity_Pump4);
        }
Пример #21
0
        void setup()
        {
            //rnd = new Random();
            Display.Width = 800;

            Display.Height = 480;

            Display.HorizontalSyncPulseWidth = 1;

            Display.HorizontalBackPorch = 88;

            Display.HorizontalFrontPorch = 40;

            Display.VerticalSyncPulseWidth = 3;

            Display.VerticalBackPorch = 32;

            Display.VerticalFrontPorch = 13;

            Display.PixelClockRateKHz = 25000;

            Display.OutputEnableIsFixed = true;

            Display.OutputEnablePolarity = true;

            Display.HorizontalSyncPolarity = false;

            Display.VerticalSyncPolarity = false;

            Display.PixelPolarity = true;

            Display.Type = Display.DisplayType.Lcd;



            if (Display.Save())      // Reboot required?
            {
                PowerState.RebootDevice(false);
            }

            //init touch

            i2cDevice = new I2CDevice(new I2CDevice.Configuration(0x38, 400));

            CapDriver = new CapTouchDriver(i2cDevice);

            CapDriver.SetBacklightTime(0);

            CapDriver.ResetBacklight();


            //CapacitiveTouchController.Initialize(GHI.Pins.G120.P2_21);

            //CapacitiveTouchController.Initialize(GHI.Pins.FEZCobraII.Socket4.Pin3);

            GlideTouch.Initialize();

            MainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Form1));
            //img = (GHI.Glide.UI.Image)MainWindow.GetChildByName("img");
            //btn = (GHI.Glide.UI.Button)MainWindow.GetChildByName("BtnChange");
            txt = (GHI.Glide.UI.TextBlock)MainWindow.GetChildByName("txtStatus");
            //GT.Picture pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.empty), GT.Picture.PictureEncoding.JPEG);
            //img.Bitmap = pic.MakeBitmap();

            GvData = (DataGrid)MainWindow.GetChildByName("GvData");
            GvData.AddColumn(new DataGridColumn("Time", 100));
            GvData.AddColumn(new DataGridColumn("Temp 1", 100));
            GvData.AddColumn(new DataGridColumn("Temp 2", 100));
            GvData.AddColumn(new DataGridColumn("Water Dist", 100));
            GvData.AddColumn(new DataGridColumn("Tds 1", 100));
            GvData.AddColumn(new DataGridColumn("Tds 2", 100));

            Random rnd = new Random();

            counter = 0;


            Glide.MainWindow = MainWindow;
            //btn.ReleaseEvent += btn_ReleaseEvent;

            Glide.FitToScreen = true;

            //Thread th1 = new Thread(new ThreadStart(LoopButton));
            //th1.Start();
            //Mainboard.LDR0.OnInterrupt += LDR0_OnInterrupt;
            //Mainboard.LDR1.OnInterrupt += LDR1_OnInterrupt;
            //logs = new LogHelper(usbHost);


            xBeeAdapter.Configure(9600, SerialParity.None, SerialStopBits.One, 8, HardwareFlowControl.NotRequired);
            //StartLora();

            xBeeAdapter.Port.LineReceived += Port_LineReceived;
            GT.Timer timer = new GT.Timer(5000); // every second (1000ms)
            timer.Tick += timer_Tick;
            timer.Start();

            // Timeout 10 seconds
            int timeout = 1000 * 10;

            // Enable Watchdog
            GHI.Processor.Watchdog.Enable(timeout);

            // Start a time counter reset thread
            WDTCounterReset = new Thread(WDTCounterResetLoop);
            WDTCounterReset.Start();
            // Normally, you can read this flag ***ONLY ONCE*** on power up
            if (GHI.Processor.Watchdog.LastResetCause == GHI.Processor.Watchdog.ResetCause.Watchdog)
            {
                //logs.WriteLogs("reset by watchdog");
                Debug.Print("Watchdog did Reset");
            }
            else
            {
                //logs.WriteLogs("system reboot / start");
                Debug.Print("Reset switch or system power");
            }
        }
Пример #22
0
 public ExecutorForm(ref GHI.Glide.Display.Window window, ref Gadgeteer.Modules.GHIElectronics.DisplayTE35 displayTE35) : base(ref window)
 {
     this.displayTE35 = displayTE35;
 }
Пример #23
0
 public Screen(ref GHI.Glide.Display.Window window)
 {
     MainWindow = window;
 }
Пример #24
0
 public SplashForm(ref GHI.Glide.Display.Window window) : base(ref window)
 {
 }
Пример #25
0
        /*ordBtn TapEvent*/
        void _ordBtn_PressEvent(object sender)
        {
            var    random       = new Random(System.DateTime.Now.Millisecond);
            uint   randomNumber = (uint)random.Next();
            string id_ordine    = randomNumber.ToString();
            string tot          = price.ToString();


            Hashtable order = new Hashtable();

            order.Add("id", id_ordine);
            order.Add("price", tot);

            // Preparing order array list
            ArrayList foods = new ArrayList();

            foreach (Product p in payment)
            {
                // Preparing food array list
                Hashtable new_food = new Hashtable();
                new_food.Add("name", p.nome);
                new_food.Add("price", p.prezzo);


                Hashtable food = new Hashtable();
                food.Add("food", new_food);
                food.Add("quantity", p.quantita);

                foods.Add(food);
            }

            order.Add("foods", foods);

            string order_as_json = Json.NETMF.JsonSerializer.SerializeObject(order);

            // TODO: MANDARE order_as_json al Desktop tramite Socket
            Debug.Print(order_as_json);

            /*load ordina*/
            _ordina          = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Ordina));
            Glide.MainWindow = _ordina;
            _gridOrdine      = (GHI.Glide.UI.DataGrid)_menu.GetChildByName("gridOrdine");
            _annullaBtn      = (GHI.Glide.UI.Button)_ordina.GetChildByName("annullaBtn");
            _payBtn          = (GHI.Glide.UI.Button)_ordina.GetChildByName("payBtn");
            _mdfBtn          = (GHI.Glide.UI.Button)_ordina.GetChildByName("mdfBtn");
            _pfinal          = (GHI.Glide.UI.TextBlock)_ordina.GetChildByName("pFinal");

            _annullaBtn.TapEvent += _annullaBtn_TapEvent;
            _mdfBtn.TapEvent     += _mdfBtn_TapEvent;
            _payBtn.TapEvent     += _payBtn_TapEvent;

            /*Setup the dataGrid reference*/
            _gridOrdine = (DataGrid)_ordina.GetChildByName("gridOrdine");

            /*Create our four columns*/
            _gridOrdine.AddColumn(new DataGridColumn("PIZZA", 125));
            _gridOrdine.AddColumn(new DataGridColumn("PREZZO", 80));
            _gridOrdine.AddColumn(new DataGridColumn("QNT", 50));

            foreach (Product p in payment)
            {
                _gridOrdine.AddItem(new DataGridItem(new object[3] {
                    p.nome, p.prezzo, p.quantita
                }));
            }

            _pfinal.Text = price.ToString();

            _ordina.Invalidate();
            _gridOrdine.Invalidate();
        }
        private void Initialize_Components()
        {
            // window
            window           = new GHI.Glide.Display.Window("window_Fertilize", Window_Manager.Display_Width, Window_Manager.Display_Heigth);
            window.BackColor = Colors.White;

            // textBox_Header
            textBox_Header           = new TextBox("textBox_Header", 255, 120, 20, 270, 32);
            textBox_Header.Text      = "Pump Schedule";
            textBox_Header.TextAlign = 2;
            window.AddChild(textBox_Header);

            // textBox_Time
            textBox_Time           = new TextBox("textBox_Time", 255, 410, 20, 50, 32);
            textBox_Time.Text      = "--:--";
            textBox_Time.TextAlign = 2;
            window.AddChild(textBox_Time);

            // textBox_Back
            textBox_Back           = new TextBox("button_Back", 255, 20, 20, 80, 32);
            textBox_Back.Text      = "Back";
            textBox_Back.TextAlign = 2;
            textBox_Back.TapEvent += new OnTap(button_Back_TapEvent);
            window.AddChild(textBox_Back);

            // dropDown_PumpSelection
            dropDown_PumpSelection      = new Dropdown("dropDown_PumpSelection", 255, 120, 70, 270, 32);
            dropDown_PumpSelection.Text = "Select Pump";
            dropDown_PumpSelection.Options.Add(new object[] { "Pump 1", 1 });
            dropDown_PumpSelection.Options.Add(new object[] { "Pump 2", 2 });
            dropDown_PumpSelection.Options.Add(new object[] { "Pump 3", 3 });
            dropDown_PumpSelection.Options.Add(new object[] { "Pump 4", 4 });
            dropDown_PumpSelection.TapEvent          += dropDown_PumpSelection_TapEvent;
            dropDown_PumpSelection.ValueChangedEvent += dropDown_PumpSelection_ValueChangedEvent;
            window.AddChild(dropDown_PumpSelection);

            // list_dropDown_PumpSelection
            list_dropDown_PumpSelection             = new List(dropDown_PumpSelection.Options, 4);
            list_dropDown_PumpSelection.CloseEvent += list_dropDown_PumpSelection_CloseEvent;

            // button_New
            button_New           = new Button("button_New", 255, 20, 70, 80, 32);
            button_New.Text      = "New";
            button_New.TapEvent += button_New_TapEvent;
            window.AddChild(button_New);

            // button_Delete
            button_Delete           = new Button("button_Delete", 255, 20, 120, 80, 32);
            button_Delete.Text      = "Delete";
            button_Delete.TapEvent += button_Delete_TapEvent;
            window.AddChild(button_Delete);

            // dataGrid_Schedule
            DataGridColumn dataGridColumn_StartTime    = new DataGridColumn("Start Time", 135);
            DataGridColumn dataGridColumn_Quantity     = new DataGridColumn("Quantity", 135);
            DataGridColumn dataGridColumn_FertilizeJob = new DataGridColumn("Job", 0);

            dataGrid_Schedule = new DataGrid("dataGrid_Schedule", 255, 120, 120, 270, 32, 4);
            dataGrid_Schedule.HeadersBackColor = Colors.LightGray;
            dataGrid_Schedule.HeadersFontColor = Colors.Black;
            dataGrid_Schedule.AddColumn(dataGridColumn_StartTime);
            dataGrid_Schedule.AddColumn(dataGridColumn_Quantity);
            dataGrid_Schedule.AddColumn(dataGridColumn_FertilizeJob);
            dataGrid_Schedule.TapCellEvent += dataGrid_Schedule_TapCellEvent;
            window.AddChild(dataGrid_Schedule);

            // textbox_StartTime
            textbox_StartTime                    = new TextBox("textbox_StartTime", 255, 20, 170, 80, 32);
            textbox_StartTime.TextAlign          = 3;
            textbox_StartTime.TapEvent          += textbox_StartTime_TapEvent;
            textbox_StartTime.ValueChangedEvent += textbox_StartTime_ValueChangedEvent;
            window.AddChild(textbox_StartTime);

            // textbox_Quantity
            textbox_Quantity                    = new TextBox("textbox_Quantity", 255, 20, 220, 80, 32);
            textbox_Quantity.TextAlign          = 3;
            textbox_Quantity.TapEvent          += textbox_Quantity_TapEvent;
            textbox_Quantity.ValueChangedEvent += textbox_Quantity_ValueChangedEvent;
            window.AddChild(textbox_Quantity);
        }
Пример #27
0
        void setup()
        {
            /*
             * //7" Displays
             * Display.Width = 800;
             * Display.Height = 480;
             * Display.OutputEnableIsFixed = false;
             * Display.OutputEnablePolarity = true;
             * Display.PixelPolarity = false;
             * Display.PixelClockRateKHz = 30000;
             * Display.HorizontalSyncPolarity = false;
             * Display.HorizontalSyncPulseWidth = 48;
             * Display.HorizontalBackPorch = 88;
             * Display.HorizontalFrontPorch = 40;
             * Display.VerticalSyncPolarity = false;
             * Display.VerticalSyncPulseWidth = 3;
             * Display.VerticalBackPorch = 32;
             * Display.VerticalFrontPorch = 13;
             * Display.Type = Display.DisplayType.Lcd;
             * if (Display.Save())      // Reboot required?
             * {
             *  PowerState.RebootDevice(false);
             * }*/
            Display.Width = 800;

            Display.Height = 480;

            Display.HorizontalSyncPulseWidth = 1;

            Display.HorizontalBackPorch = 88;

            Display.HorizontalFrontPorch = 40;

            Display.VerticalSyncPulseWidth = 3;

            Display.VerticalBackPorch = 32;

            Display.VerticalFrontPorch = 13;

            Display.PixelClockRateKHz = 25000;

            Display.OutputEnableIsFixed = true;

            Display.OutputEnablePolarity = true;

            Display.HorizontalSyncPolarity = false;

            Display.VerticalSyncPolarity = false;

            Display.PixelPolarity = true;

            Display.Type = Display.DisplayType.Lcd;



            if (Display.Save())      // Reboot required?
            {
                PowerState.RebootDevice(false);
            }

            //init touch

            i2cDevice = new I2CDevice(new I2CDevice.Configuration(0x38, 400));

            CapDriver = new CapTouchDriver(i2cDevice);

            CapDriver.SetBacklightTime(0);

            CapDriver.ResetBacklight();



            //CapacitiveTouchController.Initialize(GHI.Pins.G120.P2_21);

            //CapacitiveTouchController.Initialize(GHI.Pins.FEZCobraII.Socket4.Pin3);
            GlideTouch.Initialize();

            MainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Form1));
            img        = (GHI.Glide.UI.Image)MainWindow.GetChildByName("img");
            btn        = (GHI.Glide.UI.Button)MainWindow.GetChildByName("BtnChange");
            txt        = (GHI.Glide.UI.TextBlock)MainWindow.GetChildByName("txtStatus");
            GT.Picture pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.empty), GT.Picture.PictureEncoding.JPEG);
            img.Bitmap        = pic.MakeBitmap();
            Glide.MainWindow  = MainWindow;
            btn.ReleaseEvent += btn_ReleaseEvent;
            Glide.FitToScreen = true;
            //Thread th1 = new Thread(new ThreadStart(LoopButton));
            //th1.Start();
        }
Пример #28
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            multicolorLED.BlinkOnce(GT.Color.Red);
            //7" Displays
            Display.Width  = 800;
            Display.Height = 480;
            Display.OutputEnableIsFixed      = false;
            Display.OutputEnablePolarity     = true;
            Display.PixelPolarity            = false;
            Display.PixelClockRateKHz        = 30000;
            Display.HorizontalSyncPolarity   = false;
            Display.HorizontalSyncPulseWidth = 48;
            Display.HorizontalBackPorch      = 88;
            Display.HorizontalFrontPorch     = 40;
            Display.VerticalSyncPolarity     = false;
            Display.VerticalSyncPulseWidth   = 3;
            Display.VerticalBackPorch        = 32;
            Display.VerticalFrontPorch       = 13;
            Display.Type = Display.DisplayType.Lcd;
            if (Display.Save())      // Reboot required?
            {
                PowerState.RebootDevice(false);
            }
            //set up touch screen
            CapacitiveTouchController.Initialize(GHI.Pins.FEZRaptor.Socket13.Pin3);

            window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MyForm));
            //glide init
            GlideTouch.Initialize();

            GHI.Glide.UI.Button btn = (GHI.Glide.UI.Button)window.GetChildByName("btnTest");
            img          = (GHI.Glide.UI.Image)window.GetChildByName("img1");
            txtLora      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtLora");
            txtStatus    = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtStatus");
            txtSPO2      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtSPO2");
            txtSignal    = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtSignal");
            txtPulseRate = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtPulseRate");
            txtDesc      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtDesc");
            img.Visible  = false;

            btn.TapEvent += btn_TapEvent;

            Glide.MainWindow = window;
            //reset lora
            _restPort.Write(false);
            Thread.Sleep(1000);
            _restPort.Write(true);
            Thread.Sleep(1000);

            _loraSerial = new SimpleSerial(GHI.Pins.FEZRaptor.Socket10.SerialPortName, 57600);
            _loraSerial.Open();
            _loraSerial.DataReceived += _loraSerial_DataReceived;
            //get version
            _loraSerial.WriteLine("sys get ver");
            Thread.Sleep(1000);
            //pause join
            _loraSerial.WriteLine("mac pause");
            Thread.Sleep(1000);
            //antena power
            _loraSerial.WriteLine("radio set pwr 14");
            Thread.Sleep(1000);
            //set device to receive
            _loraSerial.WriteLine("radio rx 0"); //set module to RX
        }
Пример #29
0
        void initMenu()
        {
            Debug.Print("Init Menu!");

            /*inizio socket*/
            SocketClient.StartClient();
            /*fine socket*/

            /*load menu*/
            _menu            = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Menu));
            Glide.MainWindow = _menu;

            _dataGrid   = (GHI.Glide.UI.DataGrid)_menu.GetChildByName("dataGrid");
            _pCounter   = (GHI.Glide.UI.TextBlock)_menu.GetChildByName("pCounter");
            _qntCounter = (GHI.Glide.UI.TextBlock)_menu.GetChildByName("qntCounter");
            _errMsg     = (GHI.Glide.UI.TextBlock)_menu.GetChildByName("errMsg");

            _ordBtn = (GHI.Glide.UI.Button)_menu.GetChildByName("ordBtn");
            if (flagmdf == 0)
            {
                _ordBtn.Enabled = false;
            }
            else
            {
                _ordBtn.Enabled = true;
            }
            _menu.Invalidate();
            _ordBtn.PressEvent += _ordBtn_PressEvent;

            _deleteBtn = (GHI.Glide.UI.Button)_menu.GetChildByName("deleteBtn");
            if (flagmdf == 0)
            {
                _deleteBtn.Enabled = false;
            }
            else
            {
                _deleteBtn.Enabled = true;
            }
            _menu.Invalidate();
            _deleteBtn.PressEvent += deleteBtn_PressEvent;

            //_ingBtn = (GHI.Glide.UI.Button)_menu.GetChildByName("ingBtn");
            //_ingBtn.Visible = false;
            //_menu.Invalidate();
            //_ingBtn.PressEvent += ingBtn_PressEvent;

            /*Setup the dataGrid reference*/
            _dataGrid = (DataGrid)_menu.GetChildByName("dataGrid");

            // Listen for tap cell events.
            _dataGrid.TapCellEvent += new OnTapCell(dataGrid_TapCellEvent);

            /*Create our four columns*/
            _dataGrid.AddColumn(new DataGridColumn("ID", 0));
            _dataGrid.AddColumn(new DataGridColumn("PIZZA", 125));
            _dataGrid.AddColumn(new DataGridColumn("PREZZO", 80));
            _dataGrid.AddColumn(new DataGridColumn("QNT", 50));

            /*Populate the data grid with random data*/
            Populate();

            /*Add the data grid to the window before rendering it*/
            _menu.AddChild(_dataGrid);
            _dataGrid.Render();

            /*Create a timer & run method timer_trick when thr timer ticks (for joystick)*/
            GT.Timer timer = new GT.Timer(200);
            timer.Tick += Timer_Tick;
            timer.Start();
        }
Пример #30
0
 public EditorForm(ref GHI.Glide.Display.Window window, ref Gadgeteer.Modules.GHIElectronics.SDCard sdCard, ref Gadgeteer.Modules.GHIElectronics.DisplayTE35 displayTE35) : base(ref window)
 {
     this.sdCard      = sdCard;
     this.displayTE35 = displayTE35;
 }
Пример #31
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            //set display
            this.videoOut.SetDisplayConfiguration(VideoOut.Resolution.Vga800x600);
            //set glide
            window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Form1));

            txtTime          = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtTime");
            GvData           = (GHI.Glide.UI.DataGrid)window.GetChildByName("GvData");
            BtnReset         = (GHI.Glide.UI.Button)window.GetChildByName("BtnReset");
            txtMessage       = (GHI.Glide.UI.TextBlock)window.GetChildByName("TxtMessage");
            Glide.MainWindow = window;

            //setup grid
            //create grid column
            GvData.AddColumn(new DataGridColumn("Time", 200));
            GvData.AddColumn(new DataGridColumn("Temp", 200));
            GvData.AddColumn(new DataGridColumn("Humid", 200));
            GvData.AddColumn(new DataGridColumn("Light", 200));
            GvData.AddColumn(new DataGridColumn("Gas", 200));


            // Create a database in memory,
            // file system is possible however!
            myDatabase = new GHI.SQLite.Database();
            myDatabase.ExecuteNonQuery("CREATE Table Sensor" +
                                       " (Time TEXT, Temp DOUBLE,Humid DOUBLE,Light DOUBLE,Gas DOUBLE)");
            //reset database n display
            BtnReset.TapEvent += (object sender) =>
            {
                Counter = 0;
                myDatabase.ExecuteNonQuery("DELETE FROM Sensor");
                GvData.Clear();
                GvData.Invalidate();
            };

            //reset lora
            _restPort.Write(false);
            Thread.Sleep(1000);
            _restPort.Write(true);
            Thread.Sleep(1000);


            _loraSerial = new SimpleSerial(GHI.Pins.FEZSpiderII.Socket11.SerialPortName, 57600);
            _loraSerial.Open();
            _loraSerial.DataReceived += _loraSerial_DataReceived;
            //get version
            _loraSerial.WriteLine("sys get ver");
            Thread.Sleep(1000);
            //pause join
            _loraSerial.WriteLine("mac pause");
            Thread.Sleep(1500);
            //antena power
            _loraSerial.WriteLine("radio set pwr 14");
            Thread.Sleep(1500);
            //set device to receive
            _loraSerial.WriteLine("radio rx 0"); //set module to RX
            txtMessage.Text = "LORA-RN2483 setup has been completed...";
            txtMessage.Invalidate();
            window.Invalidate();
            //myDatabase.Dispose();
        }
Пример #32
0
        private void Initialize_Components()
        {
            // window
            window           = new GHI.Glide.Display.Window("window_Fertilize", Window_Manager.Display_Width, Window_Manager.Display_Heigth);
            window.BackColor = Colors.White;

            // textBox_Header
            textBox_Header           = new TextBox("textBox_Header", 255, 120, 20, 270, 32);
            textBox_Header.Text      = "Pump Properties";
            textBox_Header.TextAlign = 2;
            window.AddChild(textBox_Header);

            // textBox_Time
            textBox_Time           = new TextBox("textBox_Time", 255, 410, 20, 50, 32);
            textBox_Time.Text      = "--:--";
            textBox_Time.TextAlign = 2;
            window.AddChild(textBox_Time);

            // textBox_Back
            textBox_Back           = new TextBox("button_Back", 255, 20, 20, 80, 32);
            textBox_Back.Text      = "Back";
            textBox_Back.TextAlign = 2;
            textBox_Back.TapEvent += new OnTap(button_Back_TapEvent);
            window.AddChild(textBox_Back);

            // dropDown_PumpSelection
            dropDown_PumpSelection      = new Dropdown("dropDown_PumpSelection", 255, 120, 70, 270, 32);
            dropDown_PumpSelection.Text = "Select Pump";
            dropDown_PumpSelection.Options.Add(new object[] { "Pump 1", 1 });
            dropDown_PumpSelection.Options.Add(new object[] { "Pump 2", 2 });
            dropDown_PumpSelection.Options.Add(new object[] { "Pump 3", 3 });
            dropDown_PumpSelection.Options.Add(new object[] { "Pump 4", 4 });
            dropDown_PumpSelection.TapEvent          += dropDown_PumpSelection_TapEvent;
            dropDown_PumpSelection.ValueChangedEvent += dropDown_PumpSelection_ValueChangedEvent;
            window.AddChild(dropDown_PumpSelection);

            // list_dropDown_PumpSelection
            list_dropDown_PumpSelection             = new List(dropDown_PumpSelection.Options, 4);
            list_dropDown_PumpSelection.CloseEvent += list_dropDown_PumpSelection_CloseEvent;

            // textBox_PumpName
            textBox_PumpName                    = new TextBox("textBox_PumpName", 255, 120, 120, 270, 32);
            textBox_PumpName.TapEvent          += textBox_PumpName_TapEvent;
            textBox_PumpName.ValueChangedEvent += textBox_PumpName_ValueChangedEvent;
            window.AddChild(textBox_PumpName);

            // button_Calibration_Set
            button_Calibration_Run           = new Button("button_Calibration_Run", 255, 20, 170, 80, 32);
            button_Calibration_Run.Text      = "Run";
            button_Calibration_Run.TapEvent += button_Calibration_Run_TapEvent;
            window.AddChild(button_Calibration_Run);

            // button_Calibration_Adjust
            button_Calibration_Adjust           = new Button("button_Calibration_Adjust", 255, 20, 220, 80, 32);
            button_Calibration_Adjust.Text      = "Adjust";
            button_Calibration_Adjust.TapEvent += button_Calibration_Adjust_TapEvent;
            window.AddChild(button_Calibration_Adjust);

            // textBox_Calibration_Quantity_Header
            textBox_Calibration_Quantity_Header      = new TextBox("textBox_Calibration_Quantity_Header", 255, 120, 170, 170, 32);
            textBox_Calibration_Quantity_Header.Text = "Calibration Quantity:";
            window.AddChild(textBox_Calibration_Quantity_Header);

            // textBox_Calibration_Quantity_Value
            textBox_Calibration_Quantity_Value                    = new TextBox("textBox_Calibration_Quantity_Value", 255, 310, 170, 80, 32);
            textBox_Calibration_Quantity_Value.Text               = "15 ml";
            textBox_Calibration_Quantity_Value.TextAlign          = 3;
            textBox_Calibration_Quantity_Value.TapEvent          += textBox_Calibration_Quantity_Value_TapEvent;
            textBox_Calibration_Quantity_Value.ValueChangedEvent += textBox_Calibration_Quantity_Value_ValueChangedEvent;
            window.AddChild(textBox_Calibration_Quantity_Value);

            // textBox_Calibration_Measured_Header
            textBox_Calibration_Measured_Header      = new TextBox("textBox_Calibration_Measured_Header", 255, 120, 220, 170, 32);
            textBox_Calibration_Measured_Header.Text = "Calibration Measured:";
            window.AddChild(textBox_Calibration_Measured_Header);

            // textBox_Calibration_Measured_Value
            textBox_Calibration_Measured_Value                    = new TextBox("textBox_Calibration_Measured_Value", 255, 310, 220, 80, 32);
            textBox_Calibration_Measured_Value.Text               = "15 ml";
            textBox_Calibration_Measured_Value.TextAlign          = 3;
            textBox_Calibration_Measured_Value.TapEvent          += textBox_Calibration_Measured_Value_TapEvent;
            textBox_Calibration_Measured_Value.ValueChangedEvent += textBox_Calibration_Measured_Value_ValueChangedEvent;
            window.AddChild(textBox_Calibration_Measured_Value);

            // textBox_Calibration_Runtime_Value
            textBox_Calibration_Runtime_Value           = new TextBox("textBox_Calibration_Runtime_Value", 255, 20, 120, 80, 32);
            textBox_Calibration_Runtime_Value.Text      = "-.- s/ml";
            textBox_Calibration_Runtime_Value.TextAlign = 3;
            window.AddChild(textBox_Calibration_Runtime_Value);
        }
Пример #33
0
        private void Initialize_Components()
        {
            // window
            window           = new GHI.Glide.Display.Window("window_Fertilize", Window_Manager.Display_Width, Window_Manager.Display_Heigth);
            window.BackColor = Colors.White;

            // textBox_Header
            textBox_Header           = new TextBox("textBox_Header", 255, 120, 20, 270, 32);
            textBox_Header.Text      = "Fertilize";
            textBox_Header.TextAlign = 2;
            window.AddChild(textBox_Header);

            // textBox_Time
            textBox_Time           = new TextBox("textBox_Time", 255, 410, 20, 50, 32);
            textBox_Time.Text      = "--:--";
            textBox_Time.TextAlign = 2;
            window.AddChild(textBox_Time);

            // textBox_Back
            textBox_Back           = new TextBox("button_Back", 255, 20, 20, 80, 32);
            textBox_Back.Text      = "Back";
            textBox_Back.TextAlign = 2;
            textBox_Back.TapEvent += new OnTap(button_Back_TapEvent);
            window.AddChild(textBox_Back);

            // button_Properties
            button_Properties           = new Button("button_Properties", 255, 20, 70, 80, 32);
            button_Properties.Text      = "Properties";
            button_Properties.TapEvent += button_Properties_TapEvent;
            window.AddChild(button_Properties);

            // button_Schedule
            button_Schedule           = new Button("button_Schedule", 255, 20, 120, 80, 32);
            button_Schedule.Text      = "Schedule";
            button_Schedule.TapEvent += button_Schedule_TapEvent;
            window.AddChild(button_Schedule);

            // button_AwcSettings
            button_AwcSettings           = new Button("button_AwcSettings", 255, 20, 170, 80, 32);
            button_AwcSettings.Text      = "AWC Edit";
            button_AwcSettings.TapEvent += button_AwcSettings_TapEvent;
            window.AddChild(button_AwcSettings);

            // button_AwcRun
            button_AwcRun           = new Button("button_AwcRun", 255, 20, 220, 80, 32);
            button_AwcRun.Text      = "AWC Run";
            button_AwcRun.TapEvent += button_AwcRun_TapEvent;
            window.AddChild(button_AwcRun);

            // textBox_Name_Pump1
            textBox_Name_Pump1      = new TextBox("textBox_Name_Pump1", 255, 120, 70, 150, 32);
            textBox_Name_Pump1.Text = Fertilize_Manager.Pump1.Name;
            window.AddChild(textBox_Name_Pump1);

            // textBox_Name_Pump2
            textBox_Name_Pump2      = new TextBox("textBox_Name_Pump2", 255, 120, 120, 150, 32);
            textBox_Name_Pump2.Text = Fertilize_Manager.Pump2.Name;
            window.AddChild(textBox_Name_Pump2);

            // textBox_Name_Pump3
            textBox_Name_Pump3      = new TextBox("textBox_Name_Pump3", 255, 120, 170, 150, 32);
            textBox_Name_Pump3.Text = Fertilize_Manager.Pump3.Name;
            window.AddChild(textBox_Name_Pump3);

            // textBox_Name_Pump4
            textBox_Name_Pump4      = new TextBox("textBox_Name_Pump4", 255, 120, 220, 150, 32);
            textBox_Name_Pump4.Text = Fertilize_Manager.Pump4.Name;
            window.AddChild(textBox_Name_Pump4);

            // checkBox_Running_Pump1
            checkBox_Running_Pump1           = new CheckBox("checkBox_Running_Pump1", 255, 290, 70);
            checkBox_Running_Pump1.TapEvent += checkBox_Running_Pump1_TapEvent;
            window.AddChild(checkBox_Running_Pump1);

            // checkBox_Running_Pump2
            checkBox_Running_Pump2           = new CheckBox("checkBox_Running_Pump2", 255, 290, 120);
            checkBox_Running_Pump2.TapEvent += checkBox_Running_Pump2_TapEvent;
            window.AddChild(checkBox_Running_Pump2);

            // checkBox_Running_Pump3
            checkBox_Running_Pump3           = new CheckBox("checkBox_Running_Pump3", 255, 290, 170);
            checkBox_Running_Pump3.TapEvent += checkBox_Running_Pump3_TapEvent;
            window.AddChild(checkBox_Running_Pump3);

            // checkBox_Running_Pump4
            checkBox_Running_Pump4           = new CheckBox("checkBox_Running_Pump4", 255, 290, 220);
            checkBox_Running_Pump4.TapEvent += checkBox_Running_Pump4_TapEvent;
            window.AddChild(checkBox_Running_Pump4);

            // textBox_NextRun_Pump1
            textBox_NextRun_Pump1           = new TextBox("textBox_NextRun_Pump1", 255, 340, 70, 50, 32);
            textBox_NextRun_Pump1.Text      = "--:--";
            textBox_NextRun_Pump1.TextAlign = 2;
            window.AddChild(textBox_NextRun_Pump1);

            // textBox_NextRun_Pump2
            textBox_NextRun_Pump2           = new TextBox("textBox_NextRun_Pump2", 255, 340, 120, 50, 32);
            textBox_NextRun_Pump2.Text      = "--:--";
            textBox_NextRun_Pump2.TextAlign = 2;
            window.AddChild(textBox_NextRun_Pump2);

            // textBox_NextRun_Pump3
            textBox_NextRun_Pump3           = new TextBox("textBox_NextRun_Pump3", 255, 340, 170, 50, 32);
            textBox_NextRun_Pump3.Text      = "--:--";
            textBox_NextRun_Pump3.TextAlign = 2;
            window.AddChild(textBox_NextRun_Pump3);

            // textBox_NextRun_Pump4
            textBox_NextRun_Pump4           = new TextBox("textBox_NextRun_Pump4", 255, 340, 220, 50, 32);
            textBox_NextRun_Pump4.Text      = "--:--";
            textBox_NextRun_Pump4.TextAlign = 2;
            window.AddChild(textBox_NextRun_Pump4);

            // textBox_RemainingTime_Pump1
            textBox_RemainingTime_Pump1           = new TextBox("textBox_RemainingTime_Pump1", 255, 410, 70, 50, 32);
            textBox_RemainingTime_Pump1.Text      = "--:--";
            textBox_RemainingTime_Pump1.TextAlign = 2;
            window.AddChild(textBox_RemainingTime_Pump1);

            // textBox_RemainingTime_Pump2
            textBox_RemainingTime_Pump2           = new TextBox("textBox_RemainingTime_Pump2", 255, 410, 120, 50, 32);
            textBox_RemainingTime_Pump2.Text      = "--:--";
            textBox_RemainingTime_Pump2.TextAlign = 2;
            window.AddChild(textBox_RemainingTime_Pump2);

            // textBox_RemainingTime_Pump3
            textBox_RemainingTime_Pump3           = new TextBox("textBox_RemainingTime_Pump3", 255, 410, 170, 50, 32);
            textBox_RemainingTime_Pump3.Text      = "--:--";
            textBox_RemainingTime_Pump3.TextAlign = 2;
            window.AddChild(textBox_RemainingTime_Pump3);

            // textBox_RemainingTime_Pump4
            textBox_RemainingTime_Pump4           = new TextBox("textBox_RemainingTime_Pump4", 255, 410, 220, 50, 32);
            textBox_RemainingTime_Pump4.Text      = "--:--";
            textBox_RemainingTime_Pump4.TextAlign = 2;
            window.AddChild(textBox_RemainingTime_Pump4);
        }
Пример #34
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            multicolorLED.BlinkOnce(GT.Color.Red);
            //7" Displays
            Display.Width = 800;
            Display.Height = 480;
            Display.OutputEnableIsFixed = false;
            Display.OutputEnablePolarity = true;
            Display.PixelPolarity = false;
            Display.PixelClockRateKHz = 30000;
            Display.HorizontalSyncPolarity = false;
            Display.HorizontalSyncPulseWidth = 48;
            Display.HorizontalBackPorch = 88;
            Display.HorizontalFrontPorch = 40;
            Display.VerticalSyncPolarity = false;
            Display.VerticalSyncPulseWidth = 3;
            Display.VerticalBackPorch = 32;
            Display.VerticalFrontPorch = 13;
            Display.Type = Display.DisplayType.Lcd;
            if (Display.Save())      // Reboot required?
            {
                PowerState.RebootDevice(false);
            }
            //set up touch screen
            CapacitiveTouchController.Initialize(GHI.Pins.FEZRaptor.Socket13.Pin3);

            window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MyForm));
            //glide init
            GlideTouch.Initialize();

            GHI.Glide.UI.Button btn = (GHI.Glide.UI.Button)window.GetChildByName("btnTest");
            img = (GHI.Glide.UI.Image)window.GetChildByName("img1");
            txtLora = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtLora");
            txtStatus = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtStatus");
            txtSPO2 = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtSPO2");
            txtSignal = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtSignal");
            txtPulseRate = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtPulseRate");
            txtDesc = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtDesc");
            img.Visible = false;

            btn.TapEvent += btn_TapEvent;

            Glide.MainWindow = window;
            //reset lora
            _restPort.Write(false);
            Thread.Sleep(1000);
            _restPort.Write(true);
            Thread.Sleep(1000);

            _loraSerial = new SimpleSerial(GHI.Pins.FEZRaptor.Socket10.SerialPortName, 57600);
            _loraSerial.Open();
            _loraSerial.DataReceived += _loraSerial_DataReceived;
            //get version
            _loraSerial.WriteLine("sys get ver");
            Thread.Sleep(1000);
            //pause join
            _loraSerial.WriteLine("mac pause");
            Thread.Sleep(1000);
            //antena power
            _loraSerial.WriteLine("radio set pwr 14");
            Thread.Sleep(1000);
            //set device to receive
            _loraSerial.WriteLine("radio rx 0"); //set module to RX
        }