/// <summary>
        ///
        /// </summary>
        /// <param name="temp"></param>
        void SetupWindowTimer_Tick(object temp)
        {
            _txtBlWheelOut.Text = Program.steeringWheelAnalog.ReadRaw().ToString();
            _window.FillRect(_txtBlWheelOut.Rect);
            _txtBlWheelOut.Invalidate();

            _txtBlWhlScaled.Text = Program.convertLinearScale(Program.steeringWheelAnalog.ReadRaw(), Program.steeringWheelMin, Program.steeringWheelMax, 0, 255).ToString();
            _window.FillRect(_txtBlWhlScaled.Rect);
            _txtBlWhlScaled.Invalidate();

            _txtBlTriggerOut.Text = Program.speedTriggerAnalog.ReadRaw().ToString();
            _window.FillRect(_txtBlTriggerOut.Rect);
            _txtBlTriggerOut.Invalidate();

            //_txtBlTrigScaled.Text = Program.convertLinearScale(Program.speedTriggerAnalog.ReadRaw(), Program.speedTriggerMin, Program.speedTriggerMax, 0, 255).ToString();
            _txtBlTrigScaled.Text = Program.triggerSpeedCmd().ToString();
            _window.FillRect(_txtBlTrigScaled.Rect);
            _txtBlTrigScaled.Invalidate();
        }
Пример #2
0
        public void Selection()
        {
            Glide.MainWindow = fenetreSelection;                                                //Affiche la fenetre de selection sur l'écran LCD

            BoutonBleu    = (GHI.Glide.UI.Button)fenetreSelection.GetChildByName("BoutonBleu"); //Créer les différents boutons
            BoutonJaune   = (GHI.Glide.UI.Button)fenetreSelection.GetChildByName("BoutonJaune");
            BoutonDispo1  = (GHI.Glide.UI.Button)fenetreSelection.GetChildByName("BoutonHomologation");
            BoutonDispo2  = (GHI.Glide.UI.Button)fenetreSelection.GetChildByName("BoutonDispo2");
            BoutonDispo3  = (GHI.Glide.UI.Button)fenetreSelection.GetChildByName("BoutonDispo3");
            BoutonDispo4  = (GHI.Glide.UI.Button)fenetreSelection.GetChildByName("BoutonDispo4");
            BoutonDispo5  = (GHI.Glide.UI.Button)fenetreSelection.GetChildByName("BoutonDispo5");
            BoutonValider = (GHI.Glide.UI.Button)fenetreSelection.GetChildByName("BoutonValider");

            TexteCouleur = (TextBlock)fenetreSelection.GetChildByName("TexteCouleur");        //Bloc de texte pour la selection (affiche la couleur et la disposition choisie)
            TexteDispo   = (TextBlock)fenetreSelection.GetChildByName("TexteDispo");          //

            BoutonBleu.TapEvent += new OnTap(sender => { m_equipe               = Couleur.Bleu;
                                                         TexteCouleur.Text      = "Equipe bleue";
                                                         TexteCouleur.BackColor = (Color)0xE8D630;
                                                         fenetreSelection.FillRect(TexteCouleur.Rect);
                                                         TexteCouleur.Invalidate(); });

            BoutonJaune.TapEvent += new OnTap(sender => { m_equipe               = Couleur.Jaune;
                                                          TexteCouleur.Text      = "Equipe jaune";
                                                          TexteCouleur.BackColor = (Color)0x1E7FCB;
                                                          fenetreSelection.FillRect(TexteCouleur.Rect);
                                                          TexteCouleur.Invalidate(); });

            BoutonDispo1.TapEvent += new OnTap(sender => { m_disposition   = 1;
                                                           TexteDispo.Text = "Strategie 1";
                                                           fenetreSelection.FillRect(TexteDispo.Rect);
                                                           TexteDispo.Invalidate(); });

            BoutonDispo2.TapEvent += new OnTap(sender => { m_disposition   = 2;
                                                           TexteDispo.Text = "Strategie 2";
                                                           fenetreSelection.FillRect(TexteDispo.Rect);
                                                           TexteDispo.Invalidate(); });

            BoutonDispo3.TapEvent += new OnTap(sender => { m_disposition   = 3;
                                                           TexteDispo.Text = "Dispo. no. 3";
                                                           fenetreSelection.FillRect(TexteDispo.Rect);
                                                           TexteDispo.Invalidate(); });

            BoutonDispo4.TapEvent += new OnTap(sender => { m_disposition   = 4;
                                                           TexteDispo.Text = "Dispo. no. 4";
                                                           fenetreSelection.FillRect(TexteDispo.Rect);
                                                           TexteDispo.Invalidate(); });

            BoutonDispo5.TapEvent += new OnTap(sender => { m_disposition   = 5;
                                                           TexteDispo.Text = "Dispo. no. 5";
                                                           fenetreSelection.FillRect(TexteDispo.Rect);
                                                           TexteDispo.Invalidate(); });

            while (m_equipe == Couleur.Null || m_disposition == 0)      //Execution de la boucle tant que l'equipe et la disposition du terrain ne sont pas validés



            {
                while (validation == false)
                {
                    BoutonValider.TapEvent += new OnTap(sender => { validation = true; });
                }
            }

            Fermer();                                                                        //ferme la fenetre de selection

            Glide.MainWindow = fenetreAffichage;                                             //Affiche la fenetre d'affichage sur l'écran LCD
            TexteAffichage   = (TextBlock)fenetreAffichage.GetChildByName("TexteAffichage"); //Bloc de texte pour l'affichage des instructions
        }
        /// <summary>
        /// Button tap event to configure ground efx byte to start light show.
        /// </summary>
        /// <param name="sender"></param>
        void btnGndEfxShow_TapEvent(object sender)
        {
            string tempString     = new string(GNDEFX_ARRAY);
            byte   tempConfigByte = (byte)Convert.ToInt32(tempString.Substring(5, 2), 16);

            EFX_STATE = (GRDEFX)(((int)EFX_STATE + 1) % ((int)GRDEFX.OFF + 1));

            switch (EFX_STATE)
            {
            case GRDEFX.OFF:
                //if ((tempConfigByte & 1) == 1) //if show is on, turn it off
                tempConfigByte           = (byte)(tempConfigByte & 0xFE);
                _btnGndEfxShow.Text      = "EfxOff";
                _btnGndEfxShow.TintColor = GHI.Glide.Colors.LightGray;
                break;

            case GRDEFX.SHOW_ON:    //turn show on

                tempConfigByte           = (byte)(tempConfigByte | 1);
                _btnGndEfxShow.Text      = "EfxOn";
                _btnGndEfxShow.TintColor = GHI.Glide.Colors.Fuchsia;
                break;

            case GRDEFX.BLUE:

                //if right blue led is on, turn it off
                if ((tempConfigByte & 64) == 64)
                {
                    tempConfigByte = (byte)(tempConfigByte & (0xFF - 64));
                }
                else
                {
                    tempConfigByte = (byte)(tempConfigByte | 64);
                }

                //if left blue led is on, turn it off
                if ((tempConfigByte & 8) == 8)     //if led is on, turn it off
                {
                    tempConfigByte = (byte)(tempConfigByte & (0xFF - 8));
                }
                else
                {
                    tempConfigByte = (byte)(tempConfigByte | 8);
                }

                _btnGndEfxShow.TintColor = GHI.Glide.Colors.Blue;
                _btnGndEfxShow.Text      = "EfxBlue";

                break;

            case GRDEFX.RED:

                //if right red led is on, turn it off
                if ((tempConfigByte & 16) == 16)
                {
                    tempConfigByte = (byte)(tempConfigByte & (0xFF - 16));
                }
                else
                {
                    tempConfigByte = (byte)(tempConfigByte | 16);
                }

                //if left red led is on, turn it off
                if ((tempConfigByte & 2) == 2)     //if led is on, turn it off
                {
                    tempConfigByte = (byte)(tempConfigByte & (0xFF - 2));
                }
                else
                {
                    tempConfigByte = (byte)(tempConfigByte | 2);
                }

                _btnGndEfxShow.Text      = "EfxRed";
                _btnGndEfxShow.TintColor = GHI.Glide.Colors.Red;

                break;

            case GRDEFX.GREEN:

                //if right green led is on, turn it off
                if ((tempConfigByte & 32) == 32)
                {
                    tempConfigByte = (byte)(tempConfigByte & (0xFF - 32));
                }
                else
                {
                    tempConfigByte = (byte)(tempConfigByte | 32);
                }

                //if left green led is on, turn it off
                if ((tempConfigByte & 4) == 4)
                {
                    tempConfigByte = (byte)(tempConfigByte & (0xFF - 4));
                }
                else
                {
                    tempConfigByte = (byte)(tempConfigByte | 4);
                }

                _btnGndEfxShow.TintColor = GHI.Glide.Colors.Green;
                _btnGndEfxShow.Text      = "EfxGreen";

                break;
            }

            Array.Copy(Program.byteToHex(tempConfigByte), 0, GNDEFX_ARRAY, 5, 2);

            _btnGndEfxShow.TintAmount = 50;
            _window.FillRect(_btnGndEfxShow.Rect);
            _btnGndEfxShow.Invalidate();

            sendGndEfxArray();
        }