Commit 57e2f7a2 authored by reza's avatar reza

v2.00

parent 4e9d8471
......@@ -124,8 +124,8 @@ namespace I8Devices
private const int _chanels_count = 24;
public bool[] channels_on = new bool[_chanels_count];
private const int _Exchanels_count = 3;
public bool[] Exchannels_on = new bool[_Exchanels_count];
private const int _exchanels_count = 3;
public bool[] exchannels_on = new bool[_exchanels_count];
public Settings()
{
......@@ -134,7 +134,7 @@ namespace I8Devices
sampling_rate = 2000;
gain = 24;
for (int J = 0; J < _chanels_count; J++) channels_on[J] = true;
for (int J = 0; J < _Exchanels_count; J++) Exchannels_on[J] = false;
for (int J = 0; J < _exchanels_count; J++) exchannels_on[J] = false;
}
}
......@@ -244,9 +244,15 @@ namespace I8Devices
Console.WriteLine("DLL: Test Mode= " + mysetting.test_signal);
Console.WriteLine("DLL: Lead off= " + mysetting.leadoff_mode);
Console.WriteLine("DLL: Gain= " + mysetting.gain);
Console.WriteLine("DLL: Extera Gain= " + mysetting.exgain);
Console.Write("DLL: Channels on/of (1 to 24): ");
foreach (var channels in mysetting.channels_on)
Console.Write(" " + channels);
Console.Write(" " + Convert.ToInt32(channels));
Console.Write("\nDLL: Extra Channels on/of (1 to 3):");
foreach (var channels in mysetting.exchannels_on)
Console.Write(" " + Convert.ToInt32(channels));
Console.WriteLine("");
}
settingMode_flag = true;
......@@ -272,12 +278,7 @@ namespace I8Devices
sendBuffer[16] = ch_data[1]; // channels 9 to 16 on/off status
sendBuffer[17] = ch_data[2]; // channels 17 to 24 on/off status
if (debug_mode) Console.WriteLine("DLL: sendBuffer[10] " + sendBuffer[10]);
if (debug_mode) Console.WriteLine("DLL: sendBuffer[11] " + sendBuffer[11]);
if (debug_mode) Console.WriteLine("DLL: sendBuffer[12] " + sendBuffer[12]);
BitArray Exch_arr = new BitArray(mysetting.Exchannels_on);
BitArray Exch_arr = new BitArray(mysetting.exchannels_on);
byte[] Exch_data = new byte[80];
Exch_arr.CopyTo(Exch_data, 0);
......@@ -358,7 +359,7 @@ namespace I8Devices
_serialPort.Write(Encoding.UTF8.GetString(sendBuffer, 0, sendBuffer.Length));
try { _serialPort.Close(); }
catch (Exception) { };
Thread.Sleep(1000);
while (ATR_flag != true) //wating for device to reinitializing...
{
try
......@@ -369,7 +370,7 @@ namespace I8Devices
catch (Exception )
{
Thread.Sleep(1000);
if (debug_mode) Console.WriteLine("DLL: Waiting 1s for device with "+ item + " to restart...");
if (debug_mode) Console.WriteLine("DLL: Waiting for device with "+ item + " to restart...");
//if (debug_mode) Console.WriteLine(e);
ATR_flag = false;
}
......@@ -530,10 +531,12 @@ namespace I8Devices
if (debug_mode)
{
int c = 0;
Console.WriteLine("DLL: Chip Registers (see datasheet):");
foreach (var b in rec_data)
{
//sb.Append(b + ", ");
Console.WriteLine(c.ToString("X") + "- " + ((byte)b).ToString("X"));
Console.WriteLine(" " + c.ToString("X") + "- " + ((byte)b).ToString("X"));
c++; if (c > 23) break;
}
}
......@@ -545,12 +548,13 @@ namespace I8Devices
{
// var sb = new StringBuilder("new byte[] { ");
int c = 0;
foreach (var b in rec_data)
{
Console.WriteLine("Chip Settings:");
foreach (var b in rec_data)
{
//sb.Append(b + ", ");
Console.WriteLine(c.ToString("X") + "- " + ((byte)b).ToString("X"));
c++; if (c > 23) break;
}
}
// sb.Append("}");
// Console.WriteLine(sb.ToString());
}
......@@ -609,7 +613,7 @@ namespace I8Devices
data_converted[k] = data_converted[k] * 0.536;
}
receiveBuffer.Add(data_converted);
sample_count++;
sample_count++;
newData_count++;
}
else if (device_name == "Ultim8" && _serialPort.IsOpen && _serialPort.BytesToRead > 25)
......
......@@ -18,7 +18,7 @@ def read_data():
if __name__ == "__main__":
myAwsomeHolyShitImDyingForThisDevice = Device()
# myAwsomeHolyShitImDyingForThisDevice.debug_mode = True
myAwsomeHolyShitImDyingForThisDevice.debug_mode = True
if myAwsomeHolyShitImDyingForThisDevice.connect():
print('connected success')
......@@ -29,7 +29,7 @@ if __name__ == "__main__":
mysetting.sampling_rate = 250
mysetting.leadoff_mode = False
mysetting.channels_on[1] = False
mysetting.Exchannels_on[1] = True
mysetting.exchannels_on[1] = True
mysetting.gain = 24
mysetting.exgain = 24
......@@ -41,8 +41,8 @@ if __name__ == "__main__":
# #
# print(myAwsomeHolyShitImDyingForThisDevice.writeSetting(mysetting))
myAwsomeHolyShitImDyingForThisDevice.start()
all_data = read_data()
# myAwsomeHolyShitImDyingForThisDevice.start()
# all_data = read_data()
# time.sleep(0.5)
......
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