[chronojump] Chronopic disconnect will ensure change debounce if needed, and show in GUI
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Chronopic disconnect will ensure change debounce if needed, and show in GUI
- Date: Fri, 16 Mar 2018 16:01:37 +0000 (UTC)
commit fc30c593400e59c3da6571e5a89370f6f8432da4
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Mar 16 17:00:30 2018 +0100
Chronopic disconnect will ensure change debounce if needed, and show in GUI
glade/app1.glade | 6 ++++++
src/chronopic2016.cs | 2 +-
src/gui/chronojump.cs | 2 +-
src/gui/chronopic.cs | 12 +++++++++++-
src/threshold.cs | 26 ++++++++++++++++++++------
5 files changed, 39 insertions(+), 9 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 4539091..837c195 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1628,6 +1628,9 @@
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkLabel"
id="label_start_selector_jumps">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -24760,6 +24763,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/chronopic2016.cs b/src/chronopic2016.cs
index fb7bd56..c16233c 100644
--- a/src/chronopic2016.cs
+++ b/src/chronopic2016.cs
@@ -353,7 +353,7 @@ public class Chronopic2016
string ms = "";
bool success = false;
- int tryNum = 10; //try to connect ten times
+ int tryNum = 30; //try to connect 30 times. Linux is ok with 1, but... Windows and
Mac users get what they bought
do {
//read if ok
ca = new ChronopicAutoCheckDebounce();
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 033e320..08842b2 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -4207,7 +4207,7 @@ public partial class ChronoJumpWindow
//createChronopicWindow(true, "");
//chronopicWin.Connected = false;
}
-
+
private void on_test_finished_can_touch_gtk (object o, EventArgs args)
{
currentEventExecute.FakeButtonThreadDyed.Clicked -= new
EventHandler(on_test_finished_can_touch_gtk);
diff --git a/src/gui/chronopic.cs b/src/gui/chronopic.cs
index ae71293..b55504b 100644
--- a/src/gui/chronopic.cs
+++ b/src/gui/chronopic.cs
@@ -126,6 +126,12 @@ public partial class ChronoJumpWindow
message = Catalog.GetString("Please, cut photocell barrier or click Chronopic TEST
button.");
cp2016.ConnectContactsReal(app1, crp, numCP, message);
+
+ //manage show threshold stuff
+ threshold.ChronopicFirmwareReconnected(numCP); //t_stored_on_chronopic will be 50, and later
firmware will be changed
+ label_threshold.Text = Catalog.GetString("Threshold") + " " + threshold.GetLabel() + " ms";
+ if(threshold.GetT == 50)
+ label_threshold.Text += " (" + Catalog.GetString("Applied") + ")";
}
private void on_connection_contacts_real_done (object o, EventArgs args)
@@ -150,10 +156,14 @@ public partial class ChronoJumpWindow
if(threshold.ShouldUpdateChronopicFirmware(cpCount))
{
bool ok = cp2016.ChangeMultitestFirmwarePre(threshold.GetT, cpCount);
- if(ok)
+ if(ok) {
threshold.ChronopicFirmwareUpdated(cpCount);
+ label_threshold.Text += " (" + Catalog.GetString("Applied") + ")";
+ } else
+ label_threshold.Text += " (" + Catalog.GetString("Failed") + ")";
}
+
connectingSequence = connectingSequenceEnum.END;
chronopicConnectionSequenceDo();
}
diff --git a/src/threshold.cs b/src/threshold.cs
index 55e9a18..bf810bf 100644
--- a/src/threshold.cs
+++ b/src/threshold.cs
@@ -80,23 +80,37 @@ public class Threshold
}
}
- //cpCount 1: first chronopic; 2: second (on multichronopic)
- public bool ShouldUpdateChronopicFirmware(int cpCount)
+ //numCP 1: first chronopic; 2: second (on multichronopic)
+ public bool ShouldUpdateChronopicFirmware(int numCP)
{
- if(cpCount == 1)
+ if(numCP == 1)
return t != t_stored_on_chronopic;
else //2
return t != t_stored_on_chronopic2;
}
- //cpCount 1: first chronopic; 2: second (on multichronopic)
- public void ChronopicFirmwareUpdated(int cpCount)
+ //numCP 1: first chronopic; 2: second (on multichronopic)
+ public void ChronopicFirmwareUpdated(int numCP)
{
- if(cpCount == 1)
+ if(numCP == 1)
t_stored_on_chronopic = t;
else //2
t_stored_on_chronopic2 = t;
}
+ public void ChronopicFirmwareReconnected(int numCP)
+ {
+ /*
+ * if Chronopic has been disconnected or is connected for the first time,
+ * make t_stored_on_chronopic = 50 (default value)
+ * and if we are on runs or with a different threshold,
+ * chronpic threshold will be updated
+ */
+ if(numCP == 1)
+ t_stored_on_chronopic = 50;
+ else //2
+ t_stored_on_chronopic2 = 50;
+ }
+
public string GetLabel()
{
return t.ToString();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]