Subversion Repositories Projects

Rev

Rev 2274 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2274 Rev 2280
Line 172... Line 172...
172
        int _iCtrlAct = 0;
172
        int _iCtrlAct = 0;
173
        int _iLifeCounter = 0;
173
        int _iLifeCounter = 0;
174
        int iOSDPage = 0;
174
        int iOSDPage = 0;
175
        int iOSDMax = 0;
175
        int iOSDMax = 0;
176
        int[] serChan = new int[12] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
176
        int[] serChan = new int[12] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-
 
177
        int[] serChan_sub = new int[12] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
177
        string[] serChanTitle = new string[12];
178
        string[] serChanTitle = new string[12];
178
        /// <summary>
179
        /// <summary>
179
        /// interval for sending debugdata (multiplied by 10ms)
180
        /// interval for sending debugdata (multiplied by 10ms)
180
        /// </summary>
181
        /// </summary>
181
        byte debugInterval = 10; //(=> 100ms)
182
        byte debugInterval = 10; //(=> 100ms)
Line 1427... Line 1428...
1427
                if(sVal != "")
1428
                if(sVal != "")
1428
                    serChan[i] = Convert.ToInt16(sVal);
1429
                    serChan[i] = Convert.ToInt16(sVal);
1429
                sVal = ini.IniReadValue("serial", "ch" + i.ToString() + "Title");
1430
                sVal = ini.IniReadValue("serial", "ch" + i.ToString() + "Title");
1430
                if(sVal != "")
1431
                if(sVal != "")
1431
                    serChanTitle[i] = sVal;
1432
                    serChanTitle[i] = sVal;
-
 
1433
                for (int y = 0; i < 4 && y < 3; y++)
-
 
1434
                {
-
 
1435
                    sVal = ini.IniReadValue("serial", "ch" + i.ToString() + "ValSub" + y.ToString());
-
 
1436
                    if (sVal != "")
-
 
1437
                        serChan_sub[(i*3) + y] = Convert.ToInt16(sVal);
-
 
1438
                }
1432
            }
1439
            }
1433
        }
1440
        }
1434
        /// <summary>
1441
        /// <summary>
1435
        /// save settings to ini-file
1442
        /// save settings to ini-file
1436
        /// </summary>
1443
        /// </summary>
Line 1452... Line 1459...
1452
 
1459
 
1453
            for (int i = 0; i < 12; i++)
1460
            for (int i = 0; i < 12; i++)
1454
            {
1461
            {
1455
                ini.IniWriteValue("serial", "ch" + i.ToString() + "Val", serChan[i].ToString());
1462
                ini.IniWriteValue("serial", "ch" + i.ToString() + "Val", serChan[i].ToString());
-
 
1463
                ini.IniWriteValue("serial", "ch" + i.ToString() + "Title", serChanTitle[i]);
-
 
1464
                for (int y = 0; i < 4 && y < 3; y++)
-
 
1465
                {
-
 
1466
                    ini.IniWriteValue("serial", "ch" + i.ToString() + "ValSub" + y.ToString(), serChan_sub[(i * 3) + y].ToString());
1456
                ini.IniWriteValue("serial", "ch" + i.ToString() + "Title", serChanTitle[i]);
1467
                }
Line 1457... Line 1468...
1457
            }
1468
            }
Line 1458... Line 1469...
1458
 
1469
 
Line 1614... Line 1625...
1614
            textBoxSerial7.Text = serChanTitle[6];
1625
            textBoxSerial7.Text = serChanTitle[6];
1615
            lblTbSerial7.Text = serChan[6].ToString();
1626
            lblTbSerial7.Text = serChan[6].ToString();
1616
            trckbarSerial8.Value = serChan[7];
1627
            trckbarSerial8.Value = serChan[7];
1617
            textBoxSerial8.Text = serChanTitle[7];
1628
            textBoxSerial8.Text = serChanTitle[7];
1618
            lblTbSerial8.Text = serChan[7].ToString();
1629
            lblTbSerial8.Text = serChan[7].ToString();
-
 
1630
 
-
 
1631
            textBoxSerial1_val1.Text = serChan_sub[0].ToString();
-
 
1632
            textBoxSerial1_val2.Text = serChan_sub[1].ToString();
-
 
1633
            textBoxSerial1_val3.Text = serChan_sub[2].ToString();
-
 
1634
            textBoxSerial2_val1.Text = serChan_sub[3].ToString();
-
 
1635
            textBoxSerial2_val2.Text = serChan_sub[4].ToString();
-
 
1636
            textBoxSerial2_val3.Text = serChan_sub[5].ToString();
-
 
1637
            textBoxSerial3_val1.Text = serChan_sub[6].ToString();
-
 
1638
            textBoxSerial3_val2.Text = serChan_sub[7].ToString();
-
 
1639
            textBoxSerial3_val3.Text = serChan_sub[8].ToString();
-
 
1640
            textBoxSerial4_val1.Text = serChan_sub[9].ToString();
-
 
1641
            textBoxSerial4_val2.Text = serChan_sub[10].ToString();
-
 
1642
            textBoxSerial4_val3.Text = serChan_sub[11].ToString();
1619
        }
1643
        }
1620
        #endregion functions
1644
        #endregion functions
Line 1621... Line 1645...
1621
 
1645
 
1622
        #region buttons
1646
        #region buttons
Line 1951... Line 1975...
1951
        {
1975
        {
1952
            lblTbSerial8.Text = trckbarSerial8.Value.ToString();
1976
            lblTbSerial8.Text = trckbarSerial8.Value.ToString();
1953
            serChan[7] = trckbarSerial8.Value;
1977
            serChan[7] = trckbarSerial8.Value;
1954
            if (!_init) _sendSerialData();
1978
            if (!_init) _sendSerialData();
1955
        }
1979
        }
-
 
1980
        /// <summary>
-
 
1981
        /// checks the input of a textbox
-
 
1982
        /// for valid data
1956
        #endregion serial control channels
1983
        /// in this case values 0-254
-
 
1984
        /// </summary>
-
 
1985
        /// <param name="sender"></param>
-
 
1986
        /// <param name="e"></param>
-
 
1987
        private void textBox_serial_KeyPress(object sender, KeyPressEventArgs e)
-
 
1988
        {
-
 
1989
            if ("1234567890,\b".IndexOf(e.KeyChar.ToString()) < 0) //general check for valid chars(0-9) and backspace (\b)
-
 
1990
                e.Handled = true;
-
 
1991
            else
-
 
1992
            if ("\b".IndexOf(e.KeyChar.ToString()) < 0)
-
 
1993
                if (Convert.ToInt16(((TextBox)sender).Text + e.KeyChar) > 254) //if valid and not backspace, check for upper limit of the resulting number
-
 
1994
                    e.Handled = true;
-
 
1995
                else
-
 
1996
                {
-
 
1997
                    int i = -1;
-
 
1998
                    switch (((TextBox)sender).Name)
-
 
1999
                    {
-
 
2000
                        case "textBoxSerial1_val1":
-
 
2001
                            i = 0;
-
 
2002
                            break;
-
 
2003
                        case "textBoxSerial1_val2":
-
 
2004
                            i = 1;
-
 
2005
                            break;
-
 
2006
                        case "textBoxSerial1_val3":
-
 
2007
                            i = 2;
-
 
2008
                            break;
-
 
2009
                        case "textBoxSerial2_val1":
-
 
2010
                            i = 3;
-
 
2011
                            break;
-
 
2012
                        case "textBoxSerial2_val2":
-
 
2013
                            i = 4;
-
 
2014
                            break;
-
 
2015
                        case "textBoxSerial2_val3":
-
 
2016
                            i = 5;
-
 
2017
                            break;
-
 
2018
                        case "textBoxSerial3_val1":
-
 
2019
                            i = 6;
-
 
2020
                            break;
-
 
2021
                        case "textBoxSerial3_val2":
-
 
2022
                            i = 7;
-
 
2023
                            break;
-
 
2024
                        case "textBoxSerial3_val3":
-
 
2025
                            i = 8;
-
 
2026
                            break;
-
 
2027
                        case "textBoxSerial4_val1":
-
 
2028
                            i = 9;
-
 
2029
                            break;
-
 
2030
                        case "textBoxSerial4_val2":
-
 
2031
                            i = 10;
-
 
2032
                            break;
-
 
2033
                        case "textBoxSerial4_val3":
-
 
2034
                            i = 11;
-
 
2035
                            break;
-
 
2036
                    }
-
 
2037
                    if (i > -1)
-
 
2038
                        serChan_sub[i] = Convert.ToInt16(((TextBox)sender).Text + e.KeyChar);
-
 
2039
                }
-
 
2040
        }
Line -... Line 2041...
-
 
2041
 
-
 
2042
        private void btnSer1_val1_Click(object sender, EventArgs e)
-
 
2043
        {
-
 
2044
            if(textBoxSerial1_val1.Text.Length > 0)
-
 
2045
            {
-
 
2046
                trckbarSerial1.Value = Convert.ToInt16(textBoxSerial1_val1.Text);
-
 
2047
            }
-
 
2048
        }
-
 
2049
        private void btnSer1_val2_Click(object sender, EventArgs e)
-
 
2050
        {
-
 
2051
            if(textBoxSerial1_val2.Text.Length > 0)
-
 
2052
            {
-
 
2053
                trckbarSerial1.Value = Convert.ToInt16(textBoxSerial1_val2.Text);
-
 
2054
            }
-
 
2055
        }
-
 
2056
        private void btnSer1_val3_Click(object sender, EventArgs e)
-
 
2057
        {
-
 
2058
            if(textBoxSerial1_val3.Text.Length > 0)
-
 
2059
            {
-
 
2060
                trckbarSerial1.Value = Convert.ToInt16(textBoxSerial1_val3.Text);
-
 
2061
            }
-
 
2062
        }
-
 
2063
        private void btnSer2_val1_Click(object sender, EventArgs e)
-
 
2064
        {
-
 
2065
            if(textBoxSerial2_val1.Text.Length > 0)
-
 
2066
            {
-
 
2067
                trckbarSerial2.Value = Convert.ToInt16(textBoxSerial2_val1.Text);
-
 
2068
            }
-
 
2069
        }
-
 
2070
        private void btnSer2_val2_Click(object sender, EventArgs e)
-
 
2071
        {
-
 
2072
            if(textBoxSerial2_val2.Text.Length > 0)
-
 
2073
            {
-
 
2074
                trckbarSerial2.Value = Convert.ToInt16(textBoxSerial2_val2.Text);
-
 
2075
            }
-
 
2076
        }
-
 
2077
        private void btnSer2_val3_Click(object sender, EventArgs e)
-
 
2078
        {
-
 
2079
            if(textBoxSerial2_val3.Text.Length > 0)
-
 
2080
            {
-
 
2081
                trckbarSerial2.Value = Convert.ToInt16(textBoxSerial2_val3.Text);
-
 
2082
            }
-
 
2083
        }
-
 
2084
        private void btnSer3_val1_Click(object sender, EventArgs e)
-
 
2085
        {
-
 
2086
            if(textBoxSerial3_val1.Text.Length > 0)
-
 
2087
            {
-
 
2088
                trckbarSerial3.Value = Convert.ToInt16(textBoxSerial3_val1.Text);
-
 
2089
            }
-
 
2090
        }
-
 
2091
        private void btnSer3_val2_Click(object sender, EventArgs e)
-
 
2092
        {
-
 
2093
            if(textBoxSerial3_val2.Text.Length > 0)
-
 
2094
            {
-
 
2095
                trckbarSerial3.Value = Convert.ToInt16(textBoxSerial3_val2.Text);
-
 
2096
            }
-
 
2097
        }
-
 
2098
        private void btnSer3_val3_Click(object sender, EventArgs e)
-
 
2099
        {
-
 
2100
            if(textBoxSerial3_val3.Text.Length > 0)
-
 
2101
            {
-
 
2102
                trckbarSerial3.Value = Convert.ToInt16(textBoxSerial3_val3.Text);
-
 
2103
            }
-
 
2104
        }
-
 
2105
        private void btnSer4_val1_Click(object sender, EventArgs e)
-
 
2106
        {
-
 
2107
            if(textBoxSerial4_val1.Text.Length > 0)
-
 
2108
            {
-
 
2109
                trckbarSerial4.Value = Convert.ToInt16(textBoxSerial4_val1.Text);
-
 
2110
            }
-
 
2111
        }
-
 
2112
        private void btnSer4_val2_Click(object sender, EventArgs e)
-
 
2113
        {
-
 
2114
            if(textBoxSerial4_val2.Text.Length > 0)
-
 
2115
            {
-
 
2116
                trckbarSerial4.Value = Convert.ToInt16(textBoxSerial4_val2.Text);
-
 
2117
            }
-
 
2118
        }
-
 
2119
        private void btnSer4_val3_Click(object sender, EventArgs e)
-
 
2120
        {
-
 
2121
            if(textBoxSerial4_val3.Text.Length > 0)
-
 
2122
            {
-
 
2123
                trckbarSerial4.Value = Convert.ToInt16(textBoxSerial4_val3.Text);
-
 
2124
            }
-
 
2125
        }
1957
 
2126
        #endregion serial control channels
1958
    }
2127
    }
1959
    public class IniFile
2128
    public class IniFile
1960
    {
2129
    {