[chronojump] MicroDiscover stores on chronopicRegister (forceSensor capture works after discover)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] MicroDiscover stores on chronopicRegister (forceSensor capture works after discover)
- Date: Wed, 18 May 2022 14:39:25 +0000 (UTC)
commit 5429fe094e7130b909ac76345d21ca85e6df66f4
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed May 18 16:39:00 2022 +0200
MicroDiscover stores on chronopicRegister (forceSensor capture works after discover)
src/chronopicRegister.cs | 9 ++++++++-
src/execute/arduinoCapture.cs | 22 ++++++++++++----------
src/gui/app1/chronojump.cs | 18 +++++++++---------
3 files changed, 29 insertions(+), 20 deletions(-)
---
diff --git a/src/chronopicRegister.cs b/src/chronopicRegister.cs
index e6514b887..dcd81c28a 100644
--- a/src/chronopicRegister.cs
+++ b/src/chronopicRegister.cs
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2017 Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2016-2022 Xavier de Blas <xaviblas gmail com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -276,6 +276,13 @@ public abstract class ChronopicRegister
return count;
}
+ public void SetType (string serialNumber, ChronopicRegisterPort.Types type)
+ {
+ for (int i = 0; i < crpl.L.Count; i ++)
+ if (crpl.L[i].SerialNumber == serialNumber)
+ crpl.L[i].Type = type;
+ }
+
//returns first found (should be only one if called NumConnectedOfType and returned value was 1
public ChronopicRegisterPort ConnectedOfType(ChronopicRegisterPort.Types type)
{
diff --git a/src/execute/arduinoCapture.cs b/src/execute/arduinoCapture.cs
index 2b303b745..ceec13adf 100644
--- a/src/execute/arduinoCapture.cs
+++ b/src/execute/arduinoCapture.cs
@@ -551,7 +551,7 @@ public class MicroDiscover : MicroComms
public enum Status { NotStarted, Connecting, Detecting, Done };
private List<Status> progressBar_l; //progressBars status
- private List<string> portName_l;
+ private List<ChronopicRegisterPort> toDiscover_l;
//devices discovered compatible with current mode
private static List<ChronopicRegisterPort.Types> discovered_l;
@@ -561,9 +561,9 @@ public class MicroDiscover : MicroComms
//Chronopic multitest will send a J (9600)
//1st trying a list of just one port
- public MicroDiscover (List<string> portName_l)
+ public MicroDiscover (List<ChronopicRegisterPort> toDiscover_l)
{
- this.portName_l = portName_l;
+ this.toDiscover_l = toDiscover_l;
micro_l = new List<Micro> ();
microDiscoverManage_l = new List<MicroDiscoverManage> ();
@@ -571,11 +571,11 @@ public class MicroDiscover : MicroComms
cancel = false;
- foreach (string portName in portName_l)
+ foreach (ChronopicRegisterPort crp in toDiscover_l)
{
- micro_l.Add(new Micro (portName, 115200));
- microDiscoverManage_l.Add(new MicroDiscoverManage (portName));
- progressBar_l.Add(Status.NotStarted);
+ micro_l.Add (new Micro (crp.Port, 115200));
+ microDiscoverManage_l.Add (new MicroDiscoverManage (crp.Port));
+ progressBar_l.Add (Status.NotStarted);
}
}
@@ -901,12 +901,14 @@ public class MicroDiscover : MicroComms
}
*/
- public List<string> PortName_l {
- get { return portName_l; }
- }
public List<Status> ProgressBar_l {
get { return progressBar_l; }
}
+
+ public List<ChronopicRegisterPort> ToDiscover_l {
+ get { return toDiscover_l; }
+ }
+
public List<ChronopicRegisterPort.Types> Discovered_l {
get { return discovered_l; }
}
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index b84f4da95..d83228634 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -4641,19 +4641,14 @@ public partial class ChronoJumpWindow
List<ChronopicRegisterPort> alreadyDiscovered_l = new List<ChronopicRegisterPort> ();
List<ChronopicRegisterPort> notDiscovered_l = new List<ChronopicRegisterPort> ();
- List<string> portName_l = new List<string> ();
- bool found = false;
foreach (ChronopicRegisterPort crp in chronopicRegister.Crpl.L)
if (crp.Port != "")
{
if (crp.Type != ChronopicRegisterPort.Types.UNKNOWN &&
crp.SerialNumber != ChronopicRegister.SerialNumberNotUnique)
alreadyDiscovered_l.Add (crp);
- else {
+ else
notDiscovered_l.Add (crp);
- portName_l.Add (crp.Port);
- }
- found = true;
}
label_micro_discover_ports.Text = string.Format(Catalog.GetPluralString(
@@ -4670,11 +4665,11 @@ public partial class ChronoJumpWindow
new Pixbuf (null, Util.GetImagePath(false) + "image_cancel.png");
label_button_micro_discover_cancel_close.Text = Catalog.GetString("Cancel");
- if (found)
+ if (alreadyDiscovered_l.Count > 0 || notDiscovered_l.Count > 0)
{
label_micro_discover_ports_detecting.Visible = true;
- microDiscover = new MicroDiscover (portName_l); //not discovered
+ microDiscover = new MicroDiscover (notDiscovered_l);
setup_table_micro_discover_l (alreadyDiscovered_l, notDiscovered_l);
@@ -4783,9 +4778,14 @@ public partial class ChronoJumpWindow
for (int i = 0 ; i < button_microNotDiscovered_l.Count; i ++)
if(button_microNotDiscovered_l[i] == bPress)
{
- forceSensorPortName = microDiscover.PortName_l[i];
+ forceSensorPortName = microDiscover.ToDiscover_l[i].Port;
LogB.Information(forceSensorPortName);
+ //SqliteChronopicRegister.Update(false,
+ // microDiscover.NotDiscovered_l[i],
microDiscover.Discovered_l[i]);
+ chronopicRegister.SetType (microDiscover.ToDiscover_l[i].SerialNumber,
+ microDiscover.Discovered_l[i]);
+
button_contacts_detect.Visible = false;
vbox_contacts_detect_and_execute.Visible = true;
on_button_micro_discover_cancel_close_clicked (new object (), new EventArgs
());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]