Commit fd11ed25 authored by reza's avatar reza

v3.0

parent e9bd2f4f
......@@ -359,13 +359,23 @@ namespace I8Devices
{
foreach (string item in com_names)
{
Console.WriteLine(item);
_serialPort = new SerialPort(item);
_serialPort.ReadTimeout = 2000;
_serialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);
if (debug_mode) Console.WriteLine("DLL: Send a reset command to device");
sendBuffer[3] = Convert.ToByte('R'); //reset the device
_serialPort.Open();
try
{
_serialPort.Open();
}
catch(Exception e)
{
Console.WriteLine(e.Message);
Console.WriteLine("cant connect ot this Comport");
return false;
}
_serialPort.Write(Encoding.UTF8.GetString(sendBuffer, 0, sendBuffer.Length));
try { _serialPort.Close(); }
catch (Exception) { };
......@@ -515,15 +525,15 @@ namespace I8Devices
{
device_name = "Fascin8";
firmware_version = Convert.ToByte(rec_data[24]).ToString();
unic_ID = rec_data[25].ToString() + rec_data[26].ToString();
unic_ID = (256 * rec_data[25] + rec_data[26]).ToString();
flash_data = rec_data[28].ToString() + rec_data[29].ToString() + rec_data[30].ToString();
}
else if (Convert.ToByte(rec_data[27]) == 47) // Indicate Ultim8 device
{
device_name = "Ultim8";
firmware_version = Convert.ToByte(rec_data[24]).ToString();
unic_ID = rec_data[25].ToString() + rec_data[26].ToString();
flash_data = rec_data[28].ToString() + rec_data[29].ToString() + rec_data[30].ToString();
unic_ID = (256 * rec_data[25] + rec_data[26]).ToString();
flash_data = (65536 * rec_data[28] + 256 * rec_data[29] + rec_data[30]).ToString();
}
answerToInit_flag = true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment