Compare commits
4 Commits
86f4edaa55
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
391cd0939d
|
|||
|
9d72035abd
|
|||
|
f77501b559
|
|||
|
407c3a1731
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -3,4 +3,5 @@ obj/
|
||||
/packages/
|
||||
riderModule.iml
|
||||
/_ReSharper.Caches/
|
||||
/.idea/
|
||||
/.idea/
|
||||
*.user
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup />
|
||||
</Project>
|
||||
38
src/App.Designer.cs
generated
38
src/App.Designer.cs
generated
@@ -69,7 +69,6 @@ partial class App
|
||||
statusPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||
stateLabel = new System.Windows.Forms.Label();
|
||||
brakeLabel = new System.Windows.Forms.Label();
|
||||
menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
leftPanel.SuspendLayout();
|
||||
leftFillPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)speedGaugeCanvas).BeginInit();
|
||||
@@ -89,7 +88,7 @@ partial class App
|
||||
leftPanel.Controls.Add(leftFillPanel);
|
||||
leftPanel.Controls.Add(leftBottomPanel);
|
||||
leftPanel.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
leftPanel.Location = new System.Drawing.Point(0, 24);
|
||||
leftPanel.Location = new System.Drawing.Point(0, 0);
|
||||
leftPanel.Name = "leftPanel";
|
||||
leftPanel.Size = new System.Drawing.Size(300, 480);
|
||||
leftPanel.TabIndex = 1;
|
||||
@@ -288,7 +287,7 @@ partial class App
|
||||
rightPanel.Controls.Add(graphPanel);
|
||||
rightPanel.Controls.Add(valuesPanel);
|
||||
rightPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
rightPanel.Location = new System.Drawing.Point(300, 24);
|
||||
rightPanel.Location = new System.Drawing.Point(300, 0);
|
||||
rightPanel.Name = "rightPanel";
|
||||
rightPanel.Size = new System.Drawing.Size(1300, 480);
|
||||
rightPanel.TabIndex = 2;
|
||||
@@ -330,7 +329,8 @@ partial class App
|
||||
// servoToggle
|
||||
//
|
||||
servoToggle.AutoSize = true;
|
||||
servoToggle.Location = new System.Drawing.Point(452, 10);
|
||||
servoToggle.ForeColor = System.Drawing.Color.FromArgb(((int)((byte)255)), ((int)((byte)127)), ((int)((byte)255)));
|
||||
servoToggle.Location = new System.Drawing.Point(492, 10);
|
||||
servoToggle.Name = "servoToggle";
|
||||
servoToggle.Size = new System.Drawing.Size(65, 24);
|
||||
servoToggle.TabIndex = 5;
|
||||
@@ -340,7 +340,8 @@ partial class App
|
||||
// accelerationToggle
|
||||
//
|
||||
accelerationToggle.AutoSize = true;
|
||||
accelerationToggle.Location = new System.Drawing.Point(335, 10);
|
||||
accelerationToggle.ForeColor = System.Drawing.Color.FromArgb(((int)((byte)127)), ((int)((byte)255)), ((int)((byte)127)));
|
||||
accelerationToggle.Location = new System.Drawing.Point(367, 10);
|
||||
accelerationToggle.Name = "accelerationToggle";
|
||||
accelerationToggle.Size = new System.Drawing.Size(111, 24);
|
||||
accelerationToggle.TabIndex = 4;
|
||||
@@ -350,7 +351,8 @@ partial class App
|
||||
// speedToggle
|
||||
//
|
||||
speedToggle.AutoSize = true;
|
||||
speedToggle.Location = new System.Drawing.Point(255, 10);
|
||||
speedToggle.ForeColor = System.Drawing.Color.FromArgb(((int)((byte)127)), ((int)((byte)255)), ((int)((byte)255)));
|
||||
speedToggle.Location = new System.Drawing.Point(279, 10);
|
||||
speedToggle.Name = "speedToggle";
|
||||
speedToggle.Size = new System.Drawing.Size(74, 24);
|
||||
speedToggle.TabIndex = 3;
|
||||
@@ -360,7 +362,8 @@ partial class App
|
||||
// derivativeToggle
|
||||
//
|
||||
derivativeToggle.AutoSize = true;
|
||||
derivativeToggle.Location = new System.Drawing.Point(164, 10);
|
||||
derivativeToggle.ForeColor = System.Drawing.Color.FromArgb(((int)((byte)255)), ((int)((byte)63)), ((int)((byte)63)));
|
||||
derivativeToggle.Location = new System.Drawing.Point(180, 10);
|
||||
derivativeToggle.Name = "derivativeToggle";
|
||||
derivativeToggle.Size = new System.Drawing.Size(85, 24);
|
||||
derivativeToggle.TabIndex = 2;
|
||||
@@ -370,7 +373,8 @@ partial class App
|
||||
// integralToggle
|
||||
//
|
||||
integralToggle.AutoSize = true;
|
||||
integralToggle.Location = new System.Drawing.Point(79, 10);
|
||||
integralToggle.ForeColor = System.Drawing.Color.Yellow;
|
||||
integralToggle.Location = new System.Drawing.Point(87, 10);
|
||||
integralToggle.Name = "integralToggle";
|
||||
integralToggle.Size = new System.Drawing.Size(79, 24);
|
||||
integralToggle.TabIndex = 1;
|
||||
@@ -380,6 +384,7 @@ partial class App
|
||||
// errorToggle
|
||||
//
|
||||
errorToggle.AutoSize = true;
|
||||
errorToggle.ForeColor = System.Drawing.Color.FromArgb(((int)((byte)127)), ((int)((byte)127)), ((int)((byte)255)));
|
||||
errorToggle.Location = new System.Drawing.Point(6, 10);
|
||||
errorToggle.Name = "errorToggle";
|
||||
errorToggle.Size = new System.Drawing.Size(67, 24);
|
||||
@@ -671,7 +676,7 @@ partial class App
|
||||
statusPanel.Controls.Add(stateLabel, 0, 0);
|
||||
statusPanel.Controls.Add(brakeLabel, 1, 0);
|
||||
statusPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
statusPanel.Location = new System.Drawing.Point(0, 504);
|
||||
statusPanel.Location = new System.Drawing.Point(0, 480);
|
||||
statusPanel.Name = "statusPanel";
|
||||
statusPanel.RowCount = 1;
|
||||
statusPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
@@ -707,28 +712,18 @@ partial class App
|
||||
brakeLabel.Text = "Frein";
|
||||
brakeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new System.Drawing.Size(1600, 24);
|
||||
menuStrip1.TabIndex = 4;
|
||||
menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// App
|
||||
//
|
||||
AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
BackColor = System.Drawing.Color.FromArgb(((int)((byte)30)), ((int)((byte)30)), ((int)((byte)30)));
|
||||
ClientSize = new System.Drawing.Size(1600, 536);
|
||||
ClientSize = new System.Drawing.Size(1600, 512);
|
||||
Controls.Add(rightPanel);
|
||||
Controls.Add(leftPanel);
|
||||
Controls.Add(statusPanel);
|
||||
Controls.Add(menuStrip1);
|
||||
Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)0));
|
||||
ForeColor = System.Drawing.Color.White;
|
||||
Location = new System.Drawing.Point(15, 15);
|
||||
MainMenuStrip = menuStrip1;
|
||||
MinimumSize = new System.Drawing.Size(1616, 551);
|
||||
Text = "Cruise Controller MX5";
|
||||
Load += App_Load;
|
||||
@@ -750,11 +745,8 @@ partial class App
|
||||
tableLayoutPanel1.PerformLayout();
|
||||
statusPanel.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
|
||||
private System.Windows.Forms.CheckBox speedToggle;
|
||||
private System.Windows.Forms.CheckBox accelerationToggle;
|
||||
private System.Windows.Forms.CheckBox servoToggle;
|
||||
|
||||
126
src/App.cs
126
src/App.cs
@@ -11,7 +11,7 @@ public partial class App : Form
|
||||
private const int MinSampleSize = 50, MaxSampleSize = 600;
|
||||
private const float MinTimeSpan = 5F, MaxTimeSpan = 60F;
|
||||
|
||||
private const double RefreshRateMs = 1000.0 / 60.0;
|
||||
private const int FramesPerSecond = 30;
|
||||
|
||||
private static readonly Color StatusGrayColor = Color.FromArgb(70, 70, 70), GreenColor = Color.FromArgb(0, 255, 0);
|
||||
|
||||
@@ -60,7 +60,7 @@ public partial class App : Form
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
var timer = new System.Timers.Timer(RefreshRateMs);
|
||||
var timer = new System.Timers.Timer(1000.0 / FramesPerSecond);
|
||||
timer.SynchronizingObject = this;
|
||||
timer.Elapsed += delegate { OnDrawTimer(); };
|
||||
_timer = timer;
|
||||
@@ -71,7 +71,7 @@ public partial class App : Form
|
||||
if (disposing)
|
||||
{
|
||||
components?.Dispose();
|
||||
_timer.Stop();
|
||||
_timer.Close();
|
||||
_arduinoCom?.Dispose();
|
||||
_font12.Dispose();
|
||||
_font14.Dispose();
|
||||
@@ -123,25 +123,32 @@ public partial class App : Form
|
||||
arduinoCom.AddSerialObserver(Listener.Create<Sample>(sample => _sampleQueue.Enqueue(sample)));
|
||||
}
|
||||
|
||||
|
||||
private PointF CalculateGraphPosition(Rectangle graphRect, float graphMargin, int i, int sampleSize, float value,
|
||||
float minValue, float maxValue, long timestamp, long minTimestamp, long maxTimestamp) =>
|
||||
CalculateGraphPosition(new RectangleF(graphRect.X, graphRect.Y, graphRect.Width, graphRect.Height), graphMargin,
|
||||
i, sampleSize, value, minValue, maxValue, timestamp, minTimestamp, maxTimestamp);
|
||||
|
||||
private PointF CalculateGraphPosition(RectangleF graphRect, float graphMargin, int i, int sampleSize, float value,
|
||||
private PointF CalculateGraphPosition(Rectangle curveRect, int sampleIndex, int sampleSize, float value,
|
||||
float minValue, float maxValue, long timestamp, long minTimestamp, long maxTimestamp)
|
||||
{
|
||||
var x = _sampleOrTimeGraph
|
||||
? Utils.Map<float, float, float>(i, 0, sampleSize - 1, graphRect.Width, 0F)
|
||||
: Utils.Map<float, float, float>(timestamp, minTimestamp, maxTimestamp, 0F, graphRect.Width);
|
||||
var y = minValue == maxValue
|
||||
? graphRect.Height / 2F
|
||||
: Utils.Map<float, float, float>(value, minValue, maxValue, graphRect.Height - graphMargin, graphMargin);
|
||||
var x = CalculateGraphPositionX(curveRect, sampleIndex, sampleSize, timestamp, minTimestamp, maxTimestamp);
|
||||
var y = CalculateGraphPositionY(curveRect, value, minValue, maxValue);
|
||||
|
||||
return new PointF(x, y);
|
||||
}
|
||||
|
||||
private float CalculateGraphPositionX(Rectangle curveRect, int sampleIndex, int sampleSize, long timestamp,
|
||||
long minTimestamp, long maxTimestamp) => _sampleOrTimeGraph
|
||||
? CalculateGraphPositionX(curveRect, sampleIndex, sampleSize)
|
||||
: CalculateGraphPositionX(curveRect, timestamp, minTimestamp, maxTimestamp);
|
||||
|
||||
private static float CalculateGraphPositionX(Rectangle curveRect, int sampleIndex, int sampleSize) =>
|
||||
Utils.Map<int, float, float>(sampleIndex, 1, sampleSize, curveRect.Right, curveRect.Left);
|
||||
|
||||
private static float CalculateGraphPositionX(Rectangle curveRect, long timestamp, long minTimestamp,
|
||||
long maxTimestamp) =>
|
||||
Utils.Map<long, float, float>(timestamp, minTimestamp, maxTimestamp, curveRect.Left, curveRect.Right);
|
||||
|
||||
private static float CalculateGraphPositionY(Rectangle curveRect, float value, float minValue, float maxValue) =>
|
||||
minValue == maxValue
|
||||
? (curveRect.Top + curveRect.Bottom - 1) / 2F
|
||||
: Utils.Map<float, float, float>(value, minValue, maxValue, curveRect.Bottom - 1, curveRect.Top);
|
||||
|
||||
private void OnDrawTimer()
|
||||
{
|
||||
while (_sampleQueue.Count > 0)
|
||||
@@ -488,15 +495,19 @@ public partial class App : Form
|
||||
g.TranslateTransform(graphRect.Left, graphRect.Top);
|
||||
|
||||
const int graphMargin = 24;
|
||||
var curveRect = Rectangle.FromLTRB(0, graphMargin, graphRect.Width, graphRect.Height - graphMargin + 1);
|
||||
|
||||
ctx.Stroke(100);
|
||||
ctx.StrokeWeight(1);
|
||||
ctx.SetDashes(5, 5);
|
||||
g.DrawLine(ctx.DrawPen, 0, graphMargin - 1, graphRect.Width, graphMargin - 1);
|
||||
g.DrawLine(ctx.DrawPen, 0, graphRect.Height - graphMargin + 1, graphRect.Width,
|
||||
graphRect.Height - graphMargin + 1);
|
||||
g.DrawLine(ctx.DrawPen, 0, curveRect.Top - 1, graphRect.Width, curveRect.Top - 1);
|
||||
g.DrawLine(ctx.DrawPen, 0, curveRect.Bottom, graphRect.Width,
|
||||
curveRect.Bottom);
|
||||
|
||||
// MARQUEURS DES SECONDES
|
||||
|
||||
ctx.SetDashes(3, 7);
|
||||
g.SetClip(curveRect);
|
||||
|
||||
if (_sampleOrTimeGraph)
|
||||
{
|
||||
@@ -508,9 +519,9 @@ public partial class App : Form
|
||||
|
||||
if (sample.DrawTimeTick)
|
||||
{
|
||||
var tickX = Utils.Map<float, float, float>(i, 0, sampleSize, graphRect.Width, 0);
|
||||
var tickX = CalculateGraphPositionX(curveRect, i, sampleSize);
|
||||
|
||||
g.DrawLine(ctx.DrawPen, tickX, graphMargin, tickX, graphRect.Height - graphMargin);
|
||||
g.DrawLine(ctx.DrawPen, tickX, curveRect.Top, tickX, curveRect.Bottom - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -533,8 +544,11 @@ public partial class App : Form
|
||||
}
|
||||
}
|
||||
|
||||
g.ResetClip();
|
||||
ctx.ResetDashes();
|
||||
|
||||
// GRAPHES DES VALEURS
|
||||
|
||||
var points = new List<PointF>();
|
||||
|
||||
// ERREUR
|
||||
@@ -573,14 +587,11 @@ public partial class App : Form
|
||||
|
||||
if (sampleCount > 0)
|
||||
{
|
||||
g.SetClip(new RectangleF(0, graphMargin, graphRect.Width, graphRect.Height - 2 * graphMargin + 1));
|
||||
g.SetClip(curveRect);
|
||||
|
||||
if (minValue <= 0 && maxValue >= 0)
|
||||
{
|
||||
var zero = minValue == maxValue
|
||||
? graphRect.Height / 2F
|
||||
: Utils.Map<float, float, float>(0, minValue, maxValue, graphRect.Height - graphMargin,
|
||||
graphMargin);
|
||||
var zero = CalculateGraphPositionY(curveRect, 0, minValue, maxValue);
|
||||
|
||||
ctx.Stroke(63, 63, 127);
|
||||
ctx.StrokeWeight(1);
|
||||
@@ -620,7 +631,7 @@ public partial class App : Form
|
||||
continue;
|
||||
}
|
||||
|
||||
var p = CalculateGraphPosition(graphRect, graphMargin, i, sampleSize, sample.Error, minValue,
|
||||
var p = CalculateGraphPosition(curveRect, i, sampleSize, sample.Error, minValue,
|
||||
maxValue, sample.Timestamp, minTimestamp, maxTimestamp);
|
||||
|
||||
points.Add(p);
|
||||
@@ -648,9 +659,9 @@ public partial class App : Form
|
||||
ctx.SetTextAlign(DrawContext.TextHorizontalAlignment.Left, DrawContext.TextVerticalAlignment.Center);
|
||||
ctx.Fill(127, 127, 255);
|
||||
g.DrawString(maxValue.ToString("N3", CultureInfo.InvariantCulture), _font12, ctx.FillBrush, 4,
|
||||
graphMargin / 2f, ctx.TextAlignment);
|
||||
graphMargin / 2F, ctx.TextAlignment);
|
||||
g.DrawString(minValue.ToString("N3", CultureInfo.InvariantCulture), _font12, ctx.FillBrush, 4,
|
||||
graphRect.Height - graphMargin / 2f, ctx.TextAlignment);
|
||||
graphRect.Height - graphMargin / 2F + 1, ctx.TextAlignment);
|
||||
ctx.ResetTextAlign();
|
||||
}
|
||||
}
|
||||
@@ -691,7 +702,7 @@ public partial class App : Form
|
||||
|
||||
if (sampleCount > 0)
|
||||
{
|
||||
g.SetClip(new RectangleF(0, graphMargin, graphRect.Width, graphRect.Height - 2 * graphMargin + 1));
|
||||
g.SetClip(curveRect);
|
||||
|
||||
ctx.Stroke(255, 255, 0);
|
||||
ctx.StrokeWeight(1);
|
||||
@@ -724,7 +735,7 @@ public partial class App : Form
|
||||
continue;
|
||||
}
|
||||
|
||||
var p = CalculateGraphPosition(graphRect, graphMargin, i, sampleSize, sample.Integral, minValue,
|
||||
var p = CalculateGraphPosition(curveRect, i, sampleSize, sample.Integral, minValue,
|
||||
maxValue,
|
||||
sample.Timestamp, minTimestamp, maxTimestamp);
|
||||
|
||||
@@ -753,9 +764,9 @@ public partial class App : Form
|
||||
ctx.SetTextAlign(DrawContext.TextHorizontalAlignment.Left, DrawContext.TextVerticalAlignment.Center);
|
||||
ctx.Fill(255, 255, 0);
|
||||
g.DrawString(maxValue.ToString("N3", CultureInfo.InvariantCulture), _font12, ctx.FillBrush, 90,
|
||||
graphMargin / 2f, ctx.TextAlignment);
|
||||
graphMargin / 2F, ctx.TextAlignment);
|
||||
g.DrawString(minValue.ToString("N3", CultureInfo.InvariantCulture), _font12, ctx.FillBrush, 90,
|
||||
graphRect.Height - graphMargin / 2f, ctx.TextAlignment);
|
||||
graphRect.Height - graphMargin / 2F + 1, ctx.TextAlignment);
|
||||
ctx.ResetTextAlign();
|
||||
}
|
||||
}
|
||||
@@ -796,7 +807,7 @@ public partial class App : Form
|
||||
|
||||
if (sampleCount > 0)
|
||||
{
|
||||
g.SetClip(new RectangleF(0, graphMargin, graphRect.Width, graphRect.Height - 2 * graphMargin + 1));
|
||||
g.SetClip(curveRect);
|
||||
|
||||
ctx.Stroke(255, 63, 63);
|
||||
ctx.StrokeWeight(1);
|
||||
@@ -829,7 +840,7 @@ public partial class App : Form
|
||||
continue;
|
||||
}
|
||||
|
||||
var p = CalculateGraphPosition(graphRect, graphMargin, i, sampleSize, sample.Derivative, minValue,
|
||||
var p = CalculateGraphPosition(curveRect, i, sampleSize, sample.Derivative, minValue,
|
||||
maxValue,
|
||||
sample.Timestamp, minTimestamp, maxTimestamp);
|
||||
|
||||
@@ -858,9 +869,9 @@ public partial class App : Form
|
||||
ctx.SetTextAlign(DrawContext.TextHorizontalAlignment.Left, DrawContext.TextVerticalAlignment.Center);
|
||||
ctx.Fill(255, 63, 63);
|
||||
g.DrawString(maxValue.ToString("N3", CultureInfo.InvariantCulture), _font12, ctx.FillBrush, 176,
|
||||
graphMargin / 2f, ctx.TextAlignment);
|
||||
graphMargin / 2F, ctx.TextAlignment);
|
||||
g.DrawString(minValue.ToString("N3", CultureInfo.InvariantCulture), _font12, ctx.FillBrush, 176,
|
||||
graphRect.Height - graphMargin / 2f, ctx.TextAlignment);
|
||||
graphRect.Height - graphMargin / 2F + 1, ctx.TextAlignment);
|
||||
ctx.ResetTextAlign();
|
||||
}
|
||||
}
|
||||
@@ -896,7 +907,7 @@ public partial class App : Form
|
||||
|
||||
if (sampleCount > 0)
|
||||
{
|
||||
g.SetClip(new RectangleF(0, graphMargin, graphRect.Width, graphRect.Height - 2 * graphMargin + 1));
|
||||
g.SetClip(curveRect);
|
||||
|
||||
// CONSIGNE
|
||||
|
||||
@@ -910,22 +921,7 @@ public partial class App : Form
|
||||
{
|
||||
i++;
|
||||
|
||||
// if (!sample.Active)
|
||||
// {
|
||||
// if (points.Count > 0)
|
||||
// {
|
||||
// if (points.Count > 1)
|
||||
// {
|
||||
// g.DrawLines(ctx.DrawPen, CollectionsMarshal.AsSpan(points));
|
||||
// }
|
||||
//
|
||||
// points.Clear();
|
||||
// }
|
||||
//
|
||||
// continue;
|
||||
// }
|
||||
|
||||
var p = CalculateGraphPosition(graphRect, graphMargin, i, sampleSize, sample.Consigne, minValue,
|
||||
var p = CalculateGraphPosition(curveRect, i, sampleSize, sample.Consigne, minValue,
|
||||
maxValue,
|
||||
sample.Timestamp, minTimestamp, maxTimestamp);
|
||||
|
||||
@@ -955,7 +951,7 @@ public partial class App : Form
|
||||
{
|
||||
i++;
|
||||
|
||||
var p = CalculateGraphPosition(graphRect, graphMargin, i, sampleSize, sample.Speed, minValue,
|
||||
var p = CalculateGraphPosition(curveRect, i, sampleSize, sample.Speed, minValue,
|
||||
maxValue,
|
||||
sample.Timestamp, minTimestamp, maxTimestamp);
|
||||
|
||||
@@ -984,9 +980,9 @@ public partial class App : Form
|
||||
ctx.SetTextAlign(DrawContext.TextHorizontalAlignment.Left, DrawContext.TextVerticalAlignment.Center);
|
||||
ctx.Fill(127, 255, 255);
|
||||
g.DrawString(maxValue.ToString("N3", CultureInfo.InvariantCulture), _font12, ctx.FillBrush, 262,
|
||||
graphMargin / 2f, ctx.TextAlignment);
|
||||
graphMargin / 2F, ctx.TextAlignment);
|
||||
g.DrawString(minValue.ToString("N3", CultureInfo.InvariantCulture), _font12, ctx.FillBrush, 262,
|
||||
graphRect.Height - graphMargin / 2f, ctx.TextAlignment);
|
||||
graphRect.Height - graphMargin / 2F + 1, ctx.TextAlignment);
|
||||
ctx.ResetTextAlign();
|
||||
}
|
||||
}
|
||||
@@ -1027,7 +1023,7 @@ public partial class App : Form
|
||||
|
||||
if (sampleCount > 0)
|
||||
{
|
||||
g.SetClip(new RectangleF(0, graphMargin, graphRect.Width, graphRect.Height - 2 * graphMargin + 1));
|
||||
g.SetClip(curveRect);
|
||||
|
||||
ctx.Stroke(127, 255, 127);
|
||||
ctx.StrokeWeight(1);
|
||||
@@ -1060,7 +1056,7 @@ public partial class App : Form
|
||||
continue;
|
||||
}
|
||||
|
||||
var p = CalculateGraphPosition(graphRect, graphMargin, i, sampleSize, sample.Acceleration, minValue,
|
||||
var p = CalculateGraphPosition(curveRect, i, sampleSize, sample.Acceleration, minValue,
|
||||
maxValue,
|
||||
sample.Timestamp, minTimestamp, maxTimestamp);
|
||||
|
||||
@@ -1089,9 +1085,9 @@ public partial class App : Form
|
||||
ctx.SetTextAlign(DrawContext.TextHorizontalAlignment.Left, DrawContext.TextVerticalAlignment.Center);
|
||||
ctx.Fill(127, 255, 127);
|
||||
g.DrawString(maxValue.ToString("N3", CultureInfo.InvariantCulture), _font12, ctx.FillBrush, 348,
|
||||
graphMargin / 2f, ctx.TextAlignment);
|
||||
graphMargin / 2F, ctx.TextAlignment);
|
||||
g.DrawString(minValue.ToString("N3", CultureInfo.InvariantCulture), _font12, ctx.FillBrush, 348,
|
||||
graphRect.Height - graphMargin / 2f, ctx.TextAlignment);
|
||||
graphRect.Height - graphMargin / 2F + 1, ctx.TextAlignment);
|
||||
ctx.ResetTextAlign();
|
||||
}
|
||||
}
|
||||
@@ -1132,7 +1128,7 @@ public partial class App : Form
|
||||
|
||||
if (sampleCount > 0)
|
||||
{
|
||||
g.SetClip(new RectangleF(0, graphMargin, graphRect.Width, graphRect.Height - 2 * graphMargin + 1));
|
||||
g.SetClip(curveRect);
|
||||
|
||||
ctx.Stroke(255, 127, 255);
|
||||
ctx.StrokeWeight(1);
|
||||
@@ -1158,7 +1154,7 @@ public partial class App : Form
|
||||
continue;
|
||||
}
|
||||
|
||||
var p = CalculateGraphPosition(graphRect, graphMargin, i, sampleSize, sample.Servo, minValue,
|
||||
var p = CalculateGraphPosition(curveRect, i, sampleSize, sample.Servo, minValue,
|
||||
maxValue,
|
||||
sample.Timestamp, minTimestamp, maxTimestamp);
|
||||
|
||||
@@ -1180,9 +1176,9 @@ public partial class App : Form
|
||||
ctx.SetTextAlign(DrawContext.TextHorizontalAlignment.Left, DrawContext.TextVerticalAlignment.Center);
|
||||
ctx.Fill(255, 127, 255);
|
||||
g.DrawString(maxValue.ToString(CultureInfo.InvariantCulture), _font12, ctx.FillBrush, 434,
|
||||
graphMargin / 2f, ctx.TextAlignment);
|
||||
graphMargin / 2F, ctx.TextAlignment);
|
||||
g.DrawString(minValue.ToString(CultureInfo.InvariantCulture), _font12, ctx.FillBrush, 434,
|
||||
graphRect.Height - graphMargin / 2f, ctx.TextAlignment);
|
||||
graphRect.Height - graphMargin / 2F + 1, ctx.TextAlignment);
|
||||
ctx.ResetTextAlign();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user