This commit is contained in:
backuppc
2026-01-14 15:29:38 +09:00
parent 5801137d63
commit d5516f9708
17 changed files with 605 additions and 402 deletions

View File

@@ -36,8 +36,9 @@
this.label2 = new System.Windows.Forms.Label();
this.logTextBox1 = new arCtl.LogTextBox();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.btSendCV = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.logTextBox2 = new arCtl.LogTextBox();
this.SuspendLayout();
//
// comboBox1
@@ -117,7 +118,7 @@
this.logTextBox1.MaxTextLength = ((uint)(4000u));
this.logTextBox1.MessageInterval = 50;
this.logTextBox1.Name = "logTextBox1";
this.logTextBox1.Size = new System.Drawing.Size(494, 351);
this.logTextBox1.Size = new System.Drawing.Size(368, 395);
this.logTextBox1.TabIndex = 4;
this.logTextBox1.Text = "";
//
@@ -127,19 +128,19 @@
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(140, 20);
this.button3.TabIndex = 5;
this.button3.Text = "send query";
this.button3.Text = "read status";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
// btSendCV
//
this.button4.Location = new System.Drawing.Point(447, 60);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(140, 20);
this.button4.TabIndex = 6;
this.button4.Text = "send query";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
this.btSendCV.Location = new System.Drawing.Point(447, 60);
this.btSendCV.Name = "btSendCV";
this.btSendCV.Size = new System.Drawing.Size(140, 20);
this.btSendCV.TabIndex = 6;
this.btSendCV.Text = "read cellvoltage";
this.btSendCV.UseVisualStyleBackColor = true;
this.btSendCV.Click += new System.EventHandler(this.button4_Click);
//
// button5
//
@@ -151,13 +152,33 @@
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// logTextBox2
//
this.logTextBox2.BackColor = System.Drawing.Color.WhiteSmoke;
this.logTextBox2.ColorList = new arCtl.sLogMessageColor[0];
this.logTextBox2.DateFormat = "yy-MM-dd HH:mm:ss";
this.logTextBox2.DefaultColor = System.Drawing.Color.LightGray;
this.logTextBox2.EnableDisplayTimer = true;
this.logTextBox2.EnableGubunColor = true;
this.logTextBox2.Font = new System.Drawing.Font("Consolas", 9F);
this.logTextBox2.ListFormat = "[{0}] {1}";
this.logTextBox2.Location = new System.Drawing.Point(401, 87);
this.logTextBox2.MaxListCount = ((ushort)(200));
this.logTextBox2.MaxTextLength = ((uint)(4000u));
this.logTextBox2.MessageInterval = 50;
this.logTextBox2.Name = "logTextBox2";
this.logTextBox2.Size = new System.Drawing.Size(368, 395);
this.logTextBox2.TabIndex = 8;
this.logTextBox2.Text = "";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(574, 450);
this.ClientSize = new System.Drawing.Size(779, 494);
this.Controls.Add(this.logTextBox2);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
this.Controls.Add(this.btSendCV);
this.Controls.Add(this.button3);
this.Controls.Add(this.logTextBox1);
this.Controls.Add(this.label2);
@@ -185,8 +206,9 @@
private System.Windows.Forms.Label label2;
private arCtl.LogTextBox logTextBox1;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button btSendCV;
private System.Windows.Forms.Button button5;
private arCtl.LogTextBox logTextBox2;
}
}

View File

@@ -25,19 +25,16 @@ namespace Test_BMS
private void Bms_BMSCellDataReceive(object sender, arDev.BMSCelvoltageEventArgs e)
{
var valuestr = string.Join(" ", e.voltage.Select(t => t.ToString()));
addmsg($"voltage:{valuestr}");
var valuestr = e.ToString();// string.Join(" ", e.voltage.Select(t => t.ToString()));
addmsg2($"{valuestr}");
}
private void Bms_BMSDataReceive(object sender, EventArgs e)
private void Bms_BMSDataReceive(object sender, arDev.BMSInformationEventArgs e)
{
//최종 데이터가 수신되는 경우
string msg = $"{bms.Current_Volt}v,{bms.Current_Level}%,{bms.Current_Amp}/{bms.Current_MaxAmp}";
addmsg("Recv:" + msg);
addmsg(e.Data.ToString());
}
private void Bms_Message(object sender, arDev.BMSSerialComm.MessageEventArgs e)
{
var sb = new System.Text.StringBuilder();
@@ -61,7 +58,6 @@ namespace Test_BMS
else
addmsg($"{e.MsgType}:{sb}");
}
void addmsg(string m)
{
if (logTextBox1.InvokeRequired)
@@ -76,6 +72,19 @@ namespace Test_BMS
}
}
void addmsg2(string m)
{
if (logTextBox2.InvokeRequired)
{
logTextBox2.BeginInvoke(new Action(() => {
logTextBox2.AddMsg(m);
}));
}
else
{
logTextBox2.AddMsg(m);
}
}
private void Form1_Load(object sender, EventArgs e)
{