174,6 → 174,7 |
int iOSDPage = 0; |
int iOSDMax = 0; |
int[] serChan = new int[12] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
int[] serChan_sub = new int[12] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
string[] serChanTitle = new string[12]; |
/// <summary> |
/// interval for sending debugdata (multiplied by 10ms) |
1429,6 → 1430,12 |
sVal = ini.IniReadValue("serial", "ch" + i.ToString() + "Title"); |
if(sVal != "") |
serChanTitle[i] = sVal; |
for (int y = 0; i < 4 && y < 3; y++) |
{ |
sVal = ini.IniReadValue("serial", "ch" + i.ToString() + "ValSub" + y.ToString()); |
if (sVal != "") |
serChan_sub[(i*3) + y] = Convert.ToInt16(sVal); |
} |
} |
} |
/// <summary> |
1454,6 → 1461,10 |
{ |
ini.IniWriteValue("serial", "ch" + i.ToString() + "Val", serChan[i].ToString()); |
ini.IniWriteValue("serial", "ch" + i.ToString() + "Title", serChanTitle[i]); |
for (int y = 0; i < 4 && y < 3; y++) |
{ |
ini.IniWriteValue("serial", "ch" + i.ToString() + "ValSub" + y.ToString(), serChan_sub[(i * 3) + y].ToString()); |
} |
} |
|
} |
1616,6 → 1627,19 |
trckbarSerial8.Value = serChan[7]; |
textBoxSerial8.Text = serChanTitle[7]; |
lblTbSerial8.Text = serChan[7].ToString(); |
|
textBoxSerial1_val1.Text = serChan_sub[0].ToString(); |
textBoxSerial1_val2.Text = serChan_sub[1].ToString(); |
textBoxSerial1_val3.Text = serChan_sub[2].ToString(); |
textBoxSerial2_val1.Text = serChan_sub[3].ToString(); |
textBoxSerial2_val2.Text = serChan_sub[4].ToString(); |
textBoxSerial2_val3.Text = serChan_sub[5].ToString(); |
textBoxSerial3_val1.Text = serChan_sub[6].ToString(); |
textBoxSerial3_val2.Text = serChan_sub[7].ToString(); |
textBoxSerial3_val3.Text = serChan_sub[8].ToString(); |
textBoxSerial4_val1.Text = serChan_sub[9].ToString(); |
textBoxSerial4_val2.Text = serChan_sub[10].ToString(); |
textBoxSerial4_val3.Text = serChan_sub[11].ToString(); |
} |
#endregion functions |
|
1953,8 → 1977,153 |
serChan[7] = trckbarSerial8.Value; |
if (!_init) _sendSerialData(); |
} |
/// <summary> |
/// checks the input of a textbox |
/// for valid data |
/// in this case values 0-254 |
/// </summary> |
/// <param name="sender"></param> |
/// <param name="e"></param> |
private void textBox_serial_KeyPress(object sender, KeyPressEventArgs e) |
{ |
if ("1234567890,\b".IndexOf(e.KeyChar.ToString()) < 0) //general check for valid chars(0-9) and backspace (\b) |
e.Handled = true; |
else |
if ("\b".IndexOf(e.KeyChar.ToString()) < 0) |
if (Convert.ToInt16(((TextBox)sender).Text + e.KeyChar) > 254) //if valid and not backspace, check for upper limit of the resulting number |
e.Handled = true; |
else |
{ |
int i = -1; |
switch (((TextBox)sender).Name) |
{ |
case "textBoxSerial1_val1": |
i = 0; |
break; |
case "textBoxSerial1_val2": |
i = 1; |
break; |
case "textBoxSerial1_val3": |
i = 2; |
break; |
case "textBoxSerial2_val1": |
i = 3; |
break; |
case "textBoxSerial2_val2": |
i = 4; |
break; |
case "textBoxSerial2_val3": |
i = 5; |
break; |
case "textBoxSerial3_val1": |
i = 6; |
break; |
case "textBoxSerial3_val2": |
i = 7; |
break; |
case "textBoxSerial3_val3": |
i = 8; |
break; |
case "textBoxSerial4_val1": |
i = 9; |
break; |
case "textBoxSerial4_val2": |
i = 10; |
break; |
case "textBoxSerial4_val3": |
i = 11; |
break; |
} |
if (i > -1) |
serChan_sub[i] = Convert.ToInt16(((TextBox)sender).Text + e.KeyChar); |
} |
} |
|
private void btnSer1_val1_Click(object sender, EventArgs e) |
{ |
if(textBoxSerial1_val1.Text.Length > 0) |
{ |
trckbarSerial1.Value = Convert.ToInt16(textBoxSerial1_val1.Text); |
} |
} |
private void btnSer1_val2_Click(object sender, EventArgs e) |
{ |
if(textBoxSerial1_val2.Text.Length > 0) |
{ |
trckbarSerial1.Value = Convert.ToInt16(textBoxSerial1_val2.Text); |
} |
} |
private void btnSer1_val3_Click(object sender, EventArgs e) |
{ |
if(textBoxSerial1_val3.Text.Length > 0) |
{ |
trckbarSerial1.Value = Convert.ToInt16(textBoxSerial1_val3.Text); |
} |
} |
private void btnSer2_val1_Click(object sender, EventArgs e) |
{ |
if(textBoxSerial2_val1.Text.Length > 0) |
{ |
trckbarSerial2.Value = Convert.ToInt16(textBoxSerial2_val1.Text); |
} |
} |
private void btnSer2_val2_Click(object sender, EventArgs e) |
{ |
if(textBoxSerial2_val2.Text.Length > 0) |
{ |
trckbarSerial2.Value = Convert.ToInt16(textBoxSerial2_val2.Text); |
} |
} |
private void btnSer2_val3_Click(object sender, EventArgs e) |
{ |
if(textBoxSerial2_val3.Text.Length > 0) |
{ |
trckbarSerial2.Value = Convert.ToInt16(textBoxSerial2_val3.Text); |
} |
} |
private void btnSer3_val1_Click(object sender, EventArgs e) |
{ |
if(textBoxSerial3_val1.Text.Length > 0) |
{ |
trckbarSerial3.Value = Convert.ToInt16(textBoxSerial3_val1.Text); |
} |
} |
private void btnSer3_val2_Click(object sender, EventArgs e) |
{ |
if(textBoxSerial3_val2.Text.Length > 0) |
{ |
trckbarSerial3.Value = Convert.ToInt16(textBoxSerial3_val2.Text); |
} |
} |
private void btnSer3_val3_Click(object sender, EventArgs e) |
{ |
if(textBoxSerial3_val3.Text.Length > 0) |
{ |
trckbarSerial3.Value = Convert.ToInt16(textBoxSerial3_val3.Text); |
} |
} |
private void btnSer4_val1_Click(object sender, EventArgs e) |
{ |
if(textBoxSerial4_val1.Text.Length > 0) |
{ |
trckbarSerial4.Value = Convert.ToInt16(textBoxSerial4_val1.Text); |
} |
} |
private void btnSer4_val2_Click(object sender, EventArgs e) |
{ |
if(textBoxSerial4_val2.Text.Length > 0) |
{ |
trckbarSerial4.Value = Convert.ToInt16(textBoxSerial4_val2.Text); |
} |
} |
private void btnSer4_val3_Click(object sender, EventArgs e) |
{ |
if(textBoxSerial4_val3.Text.Length > 0) |
{ |
trckbarSerial4.Value = Convert.ToInt16(textBoxSerial4_val3.Text); |
} |
} |
#endregion serial control channels |
|
} |
public class IniFile |
{ |