|
@@ -30,6 +30,7 @@ namespace Bird_tool
|
|
{
|
|
{
|
|
none,
|
|
none,
|
|
hw_test,
|
|
hw_test,
|
|
|
|
+ sd_test,
|
|
config
|
|
config
|
|
}
|
|
}
|
|
|
|
|
|
@@ -59,6 +60,7 @@ namespace Bird_tool
|
|
|
|
|
|
private bool result_success = false;
|
|
private bool result_success = false;
|
|
private string result_msg = "";
|
|
private string result_msg = "";
|
|
|
|
+ private TestMode m_test_mode = TestMode.none;
|
|
|
|
|
|
private bool SetWifi = false;
|
|
private bool SetWifi = false;
|
|
private string wifi_ssid = "";
|
|
private string wifi_ssid = "";
|
|
@@ -458,6 +460,18 @@ namespace Bird_tool
|
|
checkWifi();
|
|
checkWifi();
|
|
hw_test();
|
|
hw_test();
|
|
}
|
|
}
|
|
|
|
+ private void Evt_sd_click(object sender, EventArgs e)
|
|
|
|
+ {
|
|
|
|
+ if (!_serialManager.IsOpen())
|
|
|
|
+ {
|
|
|
|
+ MessageBox.Show("请先打开串口");
|
|
|
|
+ _serialManager.Disconnect();
|
|
|
|
+ System.Threading.Thread.Sleep(100);
|
|
|
|
+ _uart_ui_change(false);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ sd_test();
|
|
|
|
+ }
|
|
|
|
|
|
private void Evt_set_wifi(object sender, EventArgs e)
|
|
private void Evt_set_wifi(object sender, EventArgs e)
|
|
{
|
|
{
|
|
@@ -490,6 +504,7 @@ namespace Bird_tool
|
|
private void _SetTestButtonsEnabled(bool enabled)
|
|
private void _SetTestButtonsEnabled(bool enabled)
|
|
{
|
|
{
|
|
el_btn_hw_test.Enabled = enabled;
|
|
el_btn_hw_test.Enabled = enabled;
|
|
|
|
+ el_btn_sd_test.Enabled = enabled;
|
|
el_btn_config.Enabled = enabled;
|
|
el_btn_config.Enabled = enabled;
|
|
|
|
|
|
// 可选:添加视觉反馈
|
|
// 可选:添加视觉反馈
|
|
@@ -505,6 +520,11 @@ namespace Bird_tool
|
|
el_btn_config.FlatStyle = FlatStyle.Standard;
|
|
el_btn_config.FlatStyle = FlatStyle.Standard;
|
|
el_btn_config.Cursor = Cursors.Default;
|
|
el_btn_config.Cursor = Cursors.Default;
|
|
|
|
|
|
|
|
+ el_btn_sd_test.BackColor = SystemColors.Control; // 标准按钮背景色
|
|
|
|
+ el_btn_sd_test.ForeColor = SystemColors.ControlText; // 标准文本色
|
|
|
|
+ el_btn_sd_test.FlatStyle = FlatStyle.Standard; // 恢复原始样式
|
|
|
|
+ el_btn_sd_test.Cursor = Cursors.Default;
|
|
|
|
+
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -518,6 +538,11 @@ namespace Bird_tool
|
|
el_btn_config.ForeColor = SystemColors.GrayText;
|
|
el_btn_config.ForeColor = SystemColors.GrayText;
|
|
el_btn_config.FlatStyle = FlatStyle.Flat;
|
|
el_btn_config.FlatStyle = FlatStyle.Flat;
|
|
el_btn_config.Cursor = Cursors.No;
|
|
el_btn_config.Cursor = Cursors.No;
|
|
|
|
+
|
|
|
|
+ el_btn_sd_test.BackColor = SystemColors.Control; // 保持背景色
|
|
|
|
+ el_btn_sd_test.ForeColor = SystemColors.GrayText; // 标准禁用文本色
|
|
|
|
+ el_btn_sd_test.FlatStyle = FlatStyle.Flat; // 扁平化样式增强禁用感
|
|
|
|
+ el_btn_sd_test.Cursor = Cursors.No;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -798,7 +823,9 @@ namespace Bird_tool
|
|
|
|
|
|
private void config_test()
|
|
private void config_test()
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+ Log_show("无法创建测试表");
|
|
|
|
+ StopTest(false);
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
|
|
// device mac
|
|
// device mac
|
|
@@ -812,6 +839,7 @@ namespace Bird_tool
|
|
StopTest(false);
|
|
StopTest(false);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ m_test_mode = TestMode.hw_test;
|
|
ui_show_test_panpel();
|
|
ui_show_test_panpel();
|
|
progressPanel.ResetPanel();
|
|
progressPanel.ResetPanel();
|
|
|
|
|
|
@@ -829,6 +857,33 @@ namespace Bird_tool
|
|
Log($"[{DateTime.Now}] 开始硬件测试");
|
|
Log($"[{DateTime.Now}] 开始硬件测试");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void sd_test()
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ var steps = CreateSDSteps();
|
|
|
|
+ if (!_testExecutor.InitTest(steps))
|
|
|
|
+ {
|
|
|
|
+ Log_show("无法创建测试表");
|
|
|
|
+ StopTest(false);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ m_test_mode = TestMode.sd_test;
|
|
|
|
+ ui_show_test_panpel();
|
|
|
|
+ progressPanel.ResetPanel();
|
|
|
|
+
|
|
|
|
+ var groups = _testExecutor.GetGroupInfos();
|
|
|
|
+ foreach (var group in groups)
|
|
|
|
+ {
|
|
|
|
+ if (group.ShowStep)
|
|
|
|
+ {
|
|
|
|
+ progressPanel.AddTestStep(group.RowKey, group.GroupName);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ progressPanel.Message = "点击开始测试按钮进行测试";
|
|
|
|
+
|
|
|
|
+ Log($"[{DateTime.Now}] 格式化sd卡");
|
|
|
|
+ }
|
|
|
|
+
|
|
private void StartTest(TestType testType, string groupId = null)
|
|
private void StartTest(TestType testType, string groupId = null)
|
|
{
|
|
{
|
|
if (!_testExecutor.isInit)
|
|
if (!_testExecutor.isInit)
|
|
@@ -853,9 +908,14 @@ namespace Bird_tool
|
|
progressPanel.Message = "准备开始硬件测试...";
|
|
progressPanel.Message = "准备开始硬件测试...";
|
|
progressPanel.startTest();
|
|
progressPanel.startTest();
|
|
bool start_flag = false;
|
|
bool start_flag = false;
|
|
|
|
+ bool makeResult = false;
|
|
|
|
+ if (m_test_mode == TestMode.hw_test)
|
|
|
|
+ {
|
|
|
|
+ makeResult = true;
|
|
|
|
+ }
|
|
if (string.IsNullOrEmpty(groupId))
|
|
if (string.IsNullOrEmpty(groupId))
|
|
{
|
|
{
|
|
- start_flag = _testExecutor.StartTest();
|
|
|
|
|
|
+ start_flag = _testExecutor.StartTest(makeResult);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -869,7 +929,7 @@ namespace Bird_tool
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- start_flag = _testExecutor.StartTest();
|
|
|
|
|
|
+ start_flag = _testExecutor.StartTest(makeResult);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1170,6 +1230,17 @@ namespace Bird_tool
|
|
},
|
|
},
|
|
// sd卡测试
|
|
// sd卡测试
|
|
new TestStepConfig
|
|
new TestStepConfig
|
|
|
|
+ {
|
|
|
|
+ GroupId = "sdLoad",
|
|
|
|
+ ShowStep = false,
|
|
|
|
+ Name = "配置sd卡密码",
|
|
|
|
+ Tips = "自动配置sd卡",
|
|
|
|
+ PrivateCammand = true,
|
|
|
|
+ Action = ActionMode.SetVal,
|
|
|
|
+ VariableNames = { "sdpasswd" },
|
|
|
|
+ VariableValues = { sd_act },
|
|
|
|
+ },
|
|
|
|
+ new TestStepConfig
|
|
{
|
|
{
|
|
GroupId = "sdLoad",
|
|
GroupId = "sdLoad",
|
|
Key = "sdLoad",
|
|
Key = "sdLoad",
|
|
@@ -1194,6 +1265,7 @@ namespace Bird_tool
|
|
DelayBefore = 1000,
|
|
DelayBefore = 1000,
|
|
MaxJump = 5,
|
|
MaxJump = 5,
|
|
},
|
|
},
|
|
|
|
+
|
|
|
|
|
|
// 音频测试
|
|
// 音频测试
|
|
///**
|
|
///**
|
|
@@ -1363,11 +1435,51 @@ namespace Bird_tool
|
|
|
|
|
|
// 上传测试
|
|
// 上传测试
|
|
|
|
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ private List<TestStepConfig> CreateSDSteps()
|
|
|
|
+ {
|
|
|
|
+ return new List<TestStepConfig>
|
|
|
|
+ {
|
|
|
|
|
|
|
|
+ new TestStepConfig
|
|
|
|
+ {
|
|
|
|
+ Name = "测试模式",
|
|
|
|
+ Command = "AT+OSLP=1,0\r\n",
|
|
|
|
+ Tips = "启用测试模式中",
|
|
|
|
+ SuccessPattern = "Wakeup, unsleep:1 debug:0",
|
|
|
|
+ FailurePattern = "ERROR|FAIL",
|
|
|
|
+ Timeout = 4000,
|
|
|
|
+ DelayBefore = 300,
|
|
|
|
+ },
|
|
|
|
+ new TestStepConfig
|
|
|
|
+ {
|
|
|
|
+ GroupId = "sdLoad",
|
|
|
|
+ ShowStep = false,
|
|
|
|
+ Name = "配置sd卡密码",
|
|
|
|
+ Tips = "自动配置sd卡",
|
|
|
|
+ PrivateCammand = true,
|
|
|
|
+ Action = ActionMode.SetVal,
|
|
|
|
+ VariableNames = { "sdpasswd" },
|
|
|
|
+ VariableValues = { sd_act },
|
|
|
|
+ },
|
|
|
|
+ new TestStepConfig
|
|
|
|
+ {
|
|
|
|
+ GroupId = "sdLoad",
|
|
|
|
+ GroupName = "SD卡格式化",
|
|
|
|
+ Name = "SD卡格式化",
|
|
|
|
+ Command = "AT+SEND=1,AT_SDHCI=2\\,\"{{sdpasswd}}\"?\r\n",
|
|
|
|
+ Tips = "尝试格式化SD卡中",
|
|
|
|
+ PrivateCammand = true,
|
|
|
|
+ SuccessPattern = "Verify err:0",
|
|
|
|
+ RetryFromKey = "sdLoad",
|
|
|
|
+ Timeout = 60000,
|
|
|
|
+ DelayBefore = 1000,
|
|
|
|
+ MaxJump = 5,
|
|
|
|
+ },
|
|
};
|
|
};
|
|
}
|
|
}
|
|
-
|
|
|
|
private bool IsValidMac(string mac)
|
|
private bool IsValidMac(string mac)
|
|
{
|
|
{
|
|
// 实现MAC地址验证逻辑
|
|
// 实现MAC地址验证逻辑
|