[chronojump] Experimental code for opening 3 new lights on Chronopic for reaction time
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Experimental code for opening 3 new lights on Chronopic for reaction time
- Date: Thu, 19 Feb 2015 20:15:37 +0000 (UTC)
commit 5d80f7cf18c5ff6e9e70760a0ab65e497586f521
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Feb 19 21:13:34 2015 +0100
Experimental code for opening 3 new lights on Chronopic for reaction time
.../chronopic-firmware-multitest.c | 23 +++
glade/chronojump.glade | 151 +++++++++++++++++++-
src/chronopic.cs | 15 ++-
src/gui/chronojump.cs | 31 ++++
4 files changed, 218 insertions(+), 2 deletions(-)
---
diff --git a/chronopic-firmware/chronopic-firmware-c/chronopic-firmware-multitest.c
b/chronopic-firmware/chronopic-firmware-c/chronopic-firmware-multitest.c
index 0bed4f2..df2de5a 100644
--- a/chronopic-firmware/chronopic-firmware-c/chronopic-firmware-multitest.c
+++ b/chronopic-firmware/chronopic-firmware-c/chronopic-firmware-multitest.c
@@ -25,6 +25,10 @@ History:
if PC send command 'bx' for setting debounce time, x is from byte value 0~255(\x0 ~ \xFF)
if PC send command 'c' for starting contiuned to send encoder value
if PC send command 'd' for stopping contiuned to send encoder value
+ 2015-02-19
+ if PC send command 'R','r' for reaction time protocol on pin RB3 (R/r open/close this light)
+ if PC send command 'S','s' for reaction time protocol on pin RB6 (S/s open/close this light)
+ if PC send command 'T','t' for reaction time protocol on pin RB7 (T/t open/close this light)
*/
//-- this PIC is going to be used:
@@ -110,6 +114,13 @@ unsigned char command_get_debounce_time = 'a'; // for setting debounce time, pc
unsigned char command_set_debounce_time = 'b'; // for getting debounce time, it will return x:0~255(HEX)
//unsigned char command_start_send_encoder_value = 'c'; // starting continued send encoder's value
//unsigned char command_stop_send_encoder_value = 'd'; // stopping continued send encoder's value
+unsigned char command_reaction_time_rb3_on = 'R';
+unsigned char command_reaction_time_rb6_on = 'S';
+unsigned char command_reaction_time_rb7_on = 'T';
+unsigned char command_reaction_time_rb3_off = 'r';
+unsigned char command_reaction_time_rb6_off = 's';
+unsigned char command_reaction_time_rb7_off = 't';
+
char version_major = '1';
char version_minor = '1';
@@ -545,6 +556,18 @@ void main(void)
sci_sendline(DEBOUNCE_TIME + '0'); //if DEBOUNCE is 50ms (0x05), returns a 5 (5
* 10ms = 50ms)
else if (my_char == command_set_debounce_time) // 'b'
DEBOUNCE_TIME = sci_readchar();
+ else if (my_char == command_reaction_time_rb3_on) // 'R'
+ RB3 = 1;
+ else if (my_char == command_reaction_time_rb6_on) // 'S'
+ RB6 = 1;
+ else if (my_char == command_reaction_time_rb7_on) // 'T'
+ RB7 = 1;
+ else if (my_char == command_reaction_time_rb3_off) // 'r'
+ RB3 = 0;
+ else if (my_char == command_reaction_time_rb6_off) // 's'
+ RB6 = 0;
+ else if (my_char == command_reaction_time_rb7_off) // 't'
+ RB7 = 0;
else
send_error();
}
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index dc83269..aba7a37 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -3187,7 +3187,6 @@
<widget class="GtkNotebook"
id="notebook_options">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="show_tabs">False</property>
<property name="show_border">False</property>
<child>
<widget class="GtkScrolledWindow"
id="scrolledwindow3">
@@ -5195,6 +5194,99 @@ It starts before and arrives there with some speed.</property>
<property name="position">0</property>
</packing>
</child>
+ <child>
+ <widget class="GtkTable" id="table11">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">3</property>
+ <property name="column_spacing">20</property>
+ <property name="row_spacing">20</property>
+ <child>
+ <widget class="GtkButton" id="button_rt_3_on">
+ <property name="label">3 on</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_rt_3_on_clicked" swapped="no"/>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_rt_3_off">
+ <property name="label">3 off</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_rt_3_off_clicked" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_rt_6_on">
+ <property name="label">6 on</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_rt_6_on_clicked" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_rt_7_on">
+ <property name="label">7 on</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_rt_7_on_clicked" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_rt_6_off">
+ <property name="label">6 off</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_rt_6_off_clicked" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_rt_7_off">
+ <property name="label">7 off</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_rt_7_off_clicked" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="position">4</property>
@@ -6449,6 +6541,9 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -7263,6 +7358,9 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
<child>
@@ -8329,6 +8427,9 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">2</property>
@@ -9036,6 +9137,9 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">4</property>
@@ -19373,6 +19477,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -19988,6 +20095,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -21095,6 +21205,9 @@ by you</property>
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkButton" id="button_video_url">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -21259,6 +21372,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -30846,6 +30962,24 @@ options</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -32841,6 +32975,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -33494,6 +33631,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -36113,6 +36253,9 @@ show elevation as:</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="left_attach">2</property>
@@ -36392,6 +36535,9 @@ show elevation as:</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -36686,6 +36832,9 @@ show elevation as:</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
diff --git a/src/chronopic.cs b/src/chronopic.cs
index 67f1d42..7f3f68c 100644
--- a/src/chronopic.cs
+++ b/src/chronopic.cs
@@ -406,6 +406,7 @@ public abstract class ChronopicAuto
public bool IsChronopicAuto;
protected internal abstract string Communicate();
private string str;
+ public string CharToSend = "";
private bool make(SerialPort sp)
{
@@ -502,4 +503,16 @@ public class ChronopicAutoChangeDebounce : ChronopicAuto
}
}
-
+public class ChronopicStartReactionTime : ChronopicAuto
+{
+ protected internal override string Communicate()
+ {
+ try {
+ sp.Write(CharToSend);
+ LogB.Information("sending",CharToSend);
+ } catch {
+ return "ERROR";
+ }
+ return "SUCCESS";
+ }
+}
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 9e849b7..9e31f55 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -4300,7 +4300,38 @@ public partial class ChronoJumpWindow
}
}
+ private void on_button_rt_3_on_clicked (object o, EventArgs args) {
+ ChronopicAuto cs = new ChronopicStartReactionTime();
+ cs.CharToSend = "r";
+ cs.Write(chronopicWin.SP,0);
+ }
+ private void on_button_rt_3_off_clicked (object o, EventArgs args) {
+ ChronopicAuto cs = new ChronopicStartReactionTime();
+ cs.CharToSend = "R";
+ cs.Write(chronopicWin.SP,0);
+ }
+ private void on_button_rt_6_on_clicked (object o, EventArgs args) {
+ ChronopicAuto cs = new ChronopicStartReactionTime();
+ cs.CharToSend = "s";
+ cs.Write(chronopicWin.SP,0);
+ }
+ private void on_button_rt_6_off_clicked (object o, EventArgs args) {
+ ChronopicAuto cs = new ChronopicStartReactionTime();
+ cs.CharToSend = "S";
+ cs.Write(chronopicWin.SP,0);
+ }
+
+ private void on_button_rt_7_on_clicked (object o, EventArgs args) {
+ ChronopicAuto cs = new ChronopicStartReactionTime();
+ cs.CharToSend = "t";
+ cs.Write(chronopicWin.SP,0);
+ }
+ private void on_button_rt_7_off_clicked (object o, EventArgs args) {
+ ChronopicAuto cs = new ChronopicStartReactionTime();
+ cs.CharToSend = "T";
+ cs.Write(chronopicWin.SP,0);
+ }
/* ---------------------------------------------------------
* ---------------- PULSES EXECUTION ----------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]