Exemple #1
0
    private void tim_10ms_update_Tick(object sender, EventArgs e)
    {
        //update values from joystick
        JoystickHandler.Update();

        //Update Joystick Status fields
        joystickSettings.Update();
        indexStats.UpdateAllValues();

        // Update graphics tab
        graphicsCreator.UpdateValues();

        //update hartbeat
        heartBeat = (int)st.status[0];
        if (heartBeat != heartBeat_prev)
        {
            pulse                 = true;
            heartBeat_ms          = heartBeatTimer.ElapsedMilliseconds;
            lbl_heartBeat_ms.Text = heartBeat_ms + "ms";
            heartBeatTimer.Reset();
        }
        heartBeat_prev = heartBeat;

        if (pulse)
        {
            pbr_heartBeat.Value = 100;
        }
        else
        {
            pbr_heartBeat.Value = 0;
        }



        #region navigation window updates

        double pitch = Convert.ToDouble(ST_Register.status[(int)nud_navigation_attitude_pitchindex.Value]);
        double roll  = Convert.ToDouble(ST_Register.status[(int)nud_navigation_attitude_rollindex.Value]);

        if (pitch == null)
        {
            pitch = 0;
        }
        if (roll == null)
        {
            roll = 0;
        }

        aii_navigation_attitude_instrument.SetAttitudeIndicatorParameters(pitch / (float)nud_navigation_attitude_pitchdiv.Value, roll / (float)nud_navigation_attitude_pitchdiv.Value);



        int height = Convert.ToInt32(ST_Register.status[(int)nud_navigation_height_index.Value]);

        if (height == null)
        {
            height = 0;
        }

        ali_navigation_height_instrument.SetAlimeterParameters(height);



        int depth = Convert.ToInt32(ST_Register.status[(int)nud_navigation_depth_index.Value]);

        if (depth == null)
        {
            depth = 0;
        }

        ali_navigation_depth_instrument.SetAlimeterParameters(depth);



        int heading = Convert.ToInt32(ST_Register.status[(int)nud_navigation_heading_index.Value]);

        if (heading == null)
        {
            heading = 0;
        }

        hdi_navigation_heading_instrument.SetHeadingIndicatorParameters(heading / 10);

        #endregion
    }