Skip to content

Commit

Permalink
DevopsUI: better handle 0 content
Browse files Browse the repository at this point in the history
  • Loading branch information
meee1 committed Nov 18, 2024
1 parent e4998bd commit 6e9688a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Controls/DevopsUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ public DevopsUI()
private void but_doit_Click(object sender, EventArgs e)
{
var buffer = new byte[Convert.ToByte(num_count.Text)];
MainV2.comPort.device_op(Convert.ToByte(num_sysid.Text), Convert.ToByte(num_compid.Text), out buffer,
var result = MainV2.comPort.device_op(Convert.ToByte(num_sysid.Text), Convert.ToByte(num_compid.Text), out buffer,
dom_bustype.Text == "SPI" ? MAVLink.DEVICE_OP_BUSTYPE.SPI : MAVLink.DEVICE_OP_BUSTYPE.I2C,
txt_spiname.Text, Convert.ToByte(num_busno.Text), Convert.ToByte(num_address.Text),
Convert.ToByte(num_regstart.Text), Convert.ToByte(num_count.Text));

textBox1.AppendText(buffer.Select(a => a.ToString("X2")).Aggregate((a, b) => a + b) + "\r\n");
if (buffer.Length > 0)
textBox1.AppendText(buffer.Select(a => a.ToString("X2")).Aggregate((a, b) => a + b) + "\r\n");
else
textBox1.AppendText("No Responce - " + result + "\r\n");
}

private void dom_bustype_SelectedItemChanged(object sender, EventArgs e)
Expand Down

0 comments on commit 6e9688a

Please sign in to comment.