Disable configuration menu not yet working. Queue sound signals (Currently grace period is same as on period
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3a2e6d305d
commit
d0e29cda57
33
Tidstagning/MainUI.Designer.cs
generated
33
Tidstagning/MainUI.Designer.cs
generated
@ -41,9 +41,7 @@
|
|||||||
this.txtHeader = new System.Windows.Forms.TextBox();
|
this.txtHeader = new System.Windows.Forms.TextBox();
|
||||||
this.grid = new System.Windows.Forms.DataGridView();
|
this.grid = new System.Windows.Forms.DataGridView();
|
||||||
this.Complete = new System.Windows.Forms.DataGridViewButtonColumn();
|
this.Complete = new System.Windows.Forms.DataGridViewButtonColumn();
|
||||||
this.nameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.DNF = new System.Windows.Forms.DataGridViewButtonColumn();
|
this.DNF = new System.Windows.Forms.DataGridViewButtonColumn();
|
||||||
this.entryBindingSource = new System.Windows.Forms.BindingSource(this.components);
|
|
||||||
this.txtLog = new System.Windows.Forms.TableLayoutPanel();
|
this.txtLog = new System.Windows.Forms.TableLayoutPanel();
|
||||||
this.lblClock = new System.Windows.Forms.Label();
|
this.lblClock = new System.Windows.Forms.Label();
|
||||||
this.flowLayoutPanelConfiguration = new System.Windows.Forms.FlowLayoutPanel();
|
this.flowLayoutPanelConfiguration = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
@ -53,12 +51,14 @@
|
|||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
this.buttonConfig = new System.Windows.Forms.Button();
|
this.buttonConfig = new System.Windows.Forms.Button();
|
||||||
this.Clock = new System.Windows.Forms.Timer(this.components);
|
this.Clock = new System.Windows.Forms.Timer(this.components);
|
||||||
|
this.nameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.entryBindingSource = new System.Windows.Forms.BindingSource(this.components);
|
||||||
this.panel1.SuspendLayout();
|
this.panel1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.grid)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.grid)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.entryBindingSource)).BeginInit();
|
|
||||||
this.txtLog.SuspendLayout();
|
this.txtLog.SuspendLayout();
|
||||||
this.flowLayoutPanelConfiguration.SuspendLayout();
|
this.flowLayoutPanelConfiguration.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericSignalLength)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.numericSignalLength)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.entryBindingSource)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// btnTest
|
// btnTest
|
||||||
@ -118,7 +118,7 @@
|
|||||||
this.textStartProcedure.Name = "textStartProcedure";
|
this.textStartProcedure.Name = "textStartProcedure";
|
||||||
this.textStartProcedure.ReadOnly = true;
|
this.textStartProcedure.ReadOnly = true;
|
||||||
this.textStartProcedure.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
this.textStartProcedure.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||||
this.textStartProcedure.Size = new System.Drawing.Size(258, 311);
|
this.textStartProcedure.Size = new System.Drawing.Size(258, 321);
|
||||||
this.textStartProcedure.TabIndex = 10;
|
this.textStartProcedure.TabIndex = 10;
|
||||||
this.textStartProcedure.WordWrap = false;
|
this.textStartProcedure.WordWrap = false;
|
||||||
//
|
//
|
||||||
@ -208,13 +208,6 @@
|
|||||||
this.Complete.ReadOnly = true;
|
this.Complete.ReadOnly = true;
|
||||||
this.Complete.Text = "Mål";
|
this.Complete.Text = "Mål";
|
||||||
//
|
//
|
||||||
// nameDataGridViewTextBoxColumn
|
|
||||||
//
|
|
||||||
this.nameDataGridViewTextBoxColumn.DataPropertyName = "SailNumber";
|
|
||||||
this.nameDataGridViewTextBoxColumn.HeaderText = "Sejlnummer";
|
|
||||||
this.nameDataGridViewTextBoxColumn.Name = "nameDataGridViewTextBoxColumn";
|
|
||||||
this.nameDataGridViewTextBoxColumn.ReadOnly = true;
|
|
||||||
//
|
|
||||||
// DNF
|
// DNF
|
||||||
//
|
//
|
||||||
this.DNF.HeaderText = "DNF";
|
this.DNF.HeaderText = "DNF";
|
||||||
@ -223,10 +216,6 @@
|
|||||||
this.DNF.Text = "Udgået";
|
this.DNF.Text = "Udgået";
|
||||||
this.DNF.UseColumnTextForButtonValue = true;
|
this.DNF.UseColumnTextForButtonValue = true;
|
||||||
//
|
//
|
||||||
// entryBindingSource
|
|
||||||
//
|
|
||||||
this.entryBindingSource.DataSource = typeof(Tidstagning.Entry);
|
|
||||||
//
|
|
||||||
// txtLog
|
// txtLog
|
||||||
//
|
//
|
||||||
this.txtLog.ColumnCount = 3;
|
this.txtLog.ColumnCount = 3;
|
||||||
@ -344,6 +333,7 @@
|
|||||||
this.buttonConfig.TabIndex = 29;
|
this.buttonConfig.TabIndex = 29;
|
||||||
this.buttonConfig.Text = "Konfiguration";
|
this.buttonConfig.Text = "Konfiguration";
|
||||||
this.buttonConfig.UseVisualStyleBackColor = true;
|
this.buttonConfig.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonConfig.Visible = false;
|
||||||
this.buttonConfig.Click += new System.EventHandler(this.buttonConfig_Click);
|
this.buttonConfig.Click += new System.EventHandler(this.buttonConfig_Click);
|
||||||
//
|
//
|
||||||
// Clock
|
// Clock
|
||||||
@ -351,6 +341,17 @@
|
|||||||
this.Clock.Enabled = true;
|
this.Clock.Enabled = true;
|
||||||
this.Clock.Tick += new System.EventHandler(this.Clock_Tick);
|
this.Clock.Tick += new System.EventHandler(this.Clock_Tick);
|
||||||
//
|
//
|
||||||
|
// nameDataGridViewTextBoxColumn
|
||||||
|
//
|
||||||
|
this.nameDataGridViewTextBoxColumn.DataPropertyName = "SailNumber";
|
||||||
|
this.nameDataGridViewTextBoxColumn.HeaderText = "Sejlnummer";
|
||||||
|
this.nameDataGridViewTextBoxColumn.Name = "nameDataGridViewTextBoxColumn";
|
||||||
|
this.nameDataGridViewTextBoxColumn.ReadOnly = true;
|
||||||
|
//
|
||||||
|
// entryBindingSource
|
||||||
|
//
|
||||||
|
this.entryBindingSource.DataSource = typeof(Tidstagning.Entry);
|
||||||
|
//
|
||||||
// MainUI
|
// MainUI
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@ -368,12 +369,12 @@
|
|||||||
this.panel1.ResumeLayout(false);
|
this.panel1.ResumeLayout(false);
|
||||||
this.panel1.PerformLayout();
|
this.panel1.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.grid)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.grid)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.entryBindingSource)).EndInit();
|
|
||||||
this.txtLog.ResumeLayout(false);
|
this.txtLog.ResumeLayout(false);
|
||||||
this.txtLog.PerformLayout();
|
this.txtLog.PerformLayout();
|
||||||
this.flowLayoutPanelConfiguration.ResumeLayout(false);
|
this.flowLayoutPanelConfiguration.ResumeLayout(false);
|
||||||
this.flowLayoutPanelConfiguration.PerformLayout();
|
this.flowLayoutPanelConfiguration.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericSignalLength)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.numericSignalLength)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.entryBindingSource)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,14 @@ namespace Tidstagning
|
|||||||
{
|
{
|
||||||
SerialPort com;
|
SerialPort com;
|
||||||
Timer cooldownTimer;
|
Timer cooldownTimer;
|
||||||
Queue<uint> signals = new Queue<uint>();
|
|
||||||
|
struct SignalSpec
|
||||||
|
{
|
||||||
|
public uint duration;
|
||||||
|
public bool output_on;
|
||||||
|
};
|
||||||
|
Queue<SignalSpec> signals = new Queue<SignalSpec>();
|
||||||
|
bool processing_queue = false;
|
||||||
public Relay(string ComPort = null)
|
public Relay(string ComPort = null)
|
||||||
{
|
{
|
||||||
com = new SerialPort();
|
com = new SerialPort();
|
||||||
@ -45,19 +52,47 @@ namespace Tidstagning
|
|||||||
public void Sound(uint time)
|
public void Sound(uint time)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Requesting horn for: " + time.ToString() + "ms");
|
Debug.WriteLine("Requesting horn for: " + time.ToString() + "ms");
|
||||||
signals.Enqueue(time);
|
SignalSpec on_signal;
|
||||||
On();
|
on_signal.duration = time;
|
||||||
if (signals.Count == 1)
|
on_signal.output_on = true;
|
||||||
|
|
||||||
|
signals.Enqueue(on_signal);
|
||||||
|
|
||||||
|
SignalSpec gracePeriod;
|
||||||
|
gracePeriod.duration = time;
|
||||||
|
gracePeriod.output_on = false;
|
||||||
|
signals.Enqueue(gracePeriod);
|
||||||
|
if (processing_queue == false)
|
||||||
{
|
{
|
||||||
cooldownTimer = new System.Threading.Timer(x =>
|
Run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Run()
|
||||||
{
|
{
|
||||||
Off();
|
if (signals.Count == 0)
|
||||||
signals.Dequeue();
|
{
|
||||||
}, null, signals.Peek(), Timeout.Infinite);
|
processing_queue = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cooldownTimer.Change(signals.Peek(), Timeout.Infinite);
|
processing_queue = true;
|
||||||
|
SignalSpec signal = signals.Peek();
|
||||||
|
|
||||||
|
if(signal.output_on)
|
||||||
|
{
|
||||||
|
On();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Off();
|
||||||
|
}
|
||||||
|
|
||||||
|
cooldownTimer = new System.Threading.Timer(x =>
|
||||||
|
{
|
||||||
|
signals.Dequeue();
|
||||||
|
Run();
|
||||||
|
}, null, signal.duration, Timeout.Infinite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user