V0.36.0.250625_alpha:构型选择添加引擎运行状态指示

This commit is contained in:
jinchao 2025-06-25 10:17:25 +08:00
parent e390b04de6
commit cb0cd2474f
8 changed files with 181 additions and 2 deletions

View File

@ -0,0 +1,93 @@
! Add the labels you want to collect in the define below
define collect_list "-
l_04_i_gdcomac_frz_l1 -
l_04_i_gdcomac_brake_torq_f8(1_1) -
l_04_i_gdcomac_brake_torq_f8(1_2) -
l_04_i_gdcomac_brake_torq_f8(2_1) -
l_04_i_gdcomac_brake_torq_f8(2_2) -
l_04_i_gdcomac_brake_torq_f8(3_1) -
l_04_i_gdcomac_brake_torq_f8(3_2) -
l_04_i_gdcomac_gear_f8(1) -
l_04_i_gdcomac_gear_f8(2) -
l_04_i_gdcomac_gear_f8(3) -
l_04_i_gdcomac_gsteer_f8(1) -
l_04_i_gdcomac_gsteer_f8(2) -
l_04_i_gdcomac_gsteer_f8(3) -
l_04_i_gdcomac_rcon_ci_f8(1) -
l_04_i_gdcomac_rcon_ci_f8(2) -
l_04_i_gdcomac_rcon_ci_f8(3) -
l_04_i_gdcomac_rcon_ci_f8(4) -
l_04_i_gdcomac_rcon_ci_f8(5) -
l_04_i_gdcomac_rcon_ci_f8(6) -
l_04_i_gdcomac_rcon_ci_f8(7) -
l_04_i_gdcomac_onjax_l1 -
l_04_i_gdcomac_brake_temp_f8(1_1) -
l_04_i_gdcomac_brake_temp_f8(1_2) -
l_04_i_gdcomac_brake_temp_f8(2_1) -
l_04_i_gdcomac_brake_temp_f8(2_2) -
l_04_i_gdcomac_brake_temp_f8(3_1) -
l_04_i_gdcomac_brake_temp_f8(3_2) -
l_04_i_gdcomac_tire_tflat_l1(1_1) -
l_04_i_gdcomac_tire_tflat_l1(1_2) -
l_04_i_gdcomac_tire_tflat_l1(2_1) -
l_04_i_gdcomac_tire_tflat_l1(2_2) -
l_04_i_gdcomac_tire_tflat_l1(3_1) -
l_04_i_gdcomac_tire_tflat_l1(3_2) -
l_04_i_gdcomac_brk_reset_tpres_l1 -
l_04_i_gdcomac_rcon_ci_f8(1) -
l_04_i_gdcomac_rcon_ci_f8(2) -
l_04_i_gdcomac_rcon_ci_f8(3) -
l_04_i_gdcomac_rcon_ci_f8(4) -
l_04_i_gdcomac_rcon_ci_f8(5) -
l_04_i_gdcomac_rcon_ci_f8(6) -
l_04_i_gdcomac_rcon_ci_f8(7) -
l_04_i_gdcomac_gsteer_state_i4 -
l_04_i_gdcomac_resetint_l1 -
l_04_o_gdcomac_frz_l1 -
l_04_o_gdcomac_zcg_to_tire_f8 -
l_04_o_gdcomac_tire_burst_l1(1_1) -
l_04_o_gdcomac_tire_burst_l1(1_2) -
l_04_o_gdcomac_tire_burst_l1(2_1) -
l_04_o_gdcomac_tire_burst_l1(2_2) -
l_04_o_gdcomac_tire_burst_l1(3_1) -
l_04_o_gdcomac_tire_burst_l1(3_2) -
l_04_o_gdcomac_fxb_f8 -
l_04_o_gdcomac_fyb_f8 -
l_04_o_gdcomac_fzb_f8 -
l_04_o_gdcomac_mxb_f8 -
l_04_o_gdcomac_myb_f8 -
l_04_o_gdcomac_mzb_f8 -
l_04_o_gdcomac_sr_f8(1_1) -
l_04_o_gdcomac_sr_f8(1_2) -
l_04_o_gdcomac_sr_f8(2_1) -
l_04_o_gdcomac_sr_f8(2_2) -
l_04_o_gdcomac_sr_f8(3_1) -
l_04_o_gdcomac_sr_f8(3_2) -
l_04_o_gdcomac_sy_f8(1_1) -
l_04_o_gdcomac_sy_f8(1_2) -
l_04_o_gdcomac_sy_f8(2_1) -
l_04_o_gdcomac_sy_f8(2_2) -
l_04_o_gdcomac_sy_f8(3_1) -
l_04_o_gdcomac_sy_f8(3_2) -
"
!
! This will collect for 10 seconds at 60 Hz, you can modify the 10 by any other value you want to increase or decrease the collect time. Ideally, you should keep the 60 to collect every iterationé
!
collect/wait/freeze_flag=ci99_frz_fltchangerequest_l1 -
collect_list -
until (l_04_tctrl_stop_test_l1) -
for 10 at 60
!
! This will cretae a file called collect_result.bvx in the path that you used to open CTS. You can then open the .bvx file using QGR2.
!
put/extend/all result collect_result
!
! l_04_rcon_ci_f8(8) -
! l_04_rcon_ci_f8(9) -
! l_04_rcon_ci_f8(10) -
! l_04_rcon_ci_f8(11) -
! l_04_rcon_ci_f8(12) -
! l_04_rcon_ci_f8(13) -
! l_04_rcon_ci_f8(14) -

Binary file not shown.

View File

@ -1,4 +1,5 @@
#!/bin/bash
CURRENT_PATH=$(pwd)
gio set -t string $CURRENT_PATH/XNEngine "metadata::custom-icon" "file://$CURRENT_PATH/resource/XNEngine.png"
sudo setcap cap_sys_nice+ep $CURRENT_PATH/XNEngine

Binary file not shown.

View File

@ -2148,7 +2148,6 @@ class DataMonitor extends HTMLElement {
const baseInterfaceName = match[1];
const index1 = match[2] ? parseInt(match[2], 10) - 1 : null;
const index2 = match[3] ? parseInt(match[3], 10) - 1 : null;
console.log(index1, index2);
const interfaceInfo = this.interfaces.find(interfaceItem =>
interfaceItem.InterfaceName === baseInterfaceName
);

View File

@ -4,6 +4,7 @@ class HeaderTools extends HTMLElement {
this.attachShadow({ mode: 'open' });
this.render();
this.addEventListeners();
this.startEngineStatusCheck();
}
// 添加getter方法
@ -27,6 +28,48 @@ class HeaderTools extends HTMLElement {
return selectedOption ? selectedOption.textContent : '';
}
// 启动引擎状态检查定时器
startEngineStatusCheck() {
this.checkEngineStatus();
this.engineStatusInterval = setInterval(() => {
this.checkEngineStatus();
}, 1000);
}
// 检查引擎运行状态
async checkEngineStatus() {
try {
const response = await fetch('/api/engine-status');
if (response.ok) {
const data = await response.json();
this.updateEngineStatus(data.running);
}
} catch (error) {
console.error('检查引擎状态失败:', error);
this.updateEngineStatus(false);
}
}
// 更新引擎状态显示
updateEngineStatus(isRunning) {
const statusLight = this.shadowRoot.getElementById('engineStatusLight');
const planeSelect = this.shadowRoot.getElementById('planeSelect');
const configurationSelect = this.shadowRoot.getElementById('configurationSelect');
if (statusLight) {
statusLight.className = `status-light ${isRunning ? 'running' : 'stopped'}`;
statusLight.title = isRunning ? '引擎正在运行' : '引擎已停止';
}
// 根据引擎状态控制选择器的可用性
if (planeSelect) {
planeSelect.disabled = isRunning;
}
if (configurationSelect) {
configurationSelect.disabled = isRunning;
}
}
// 保存选择到localStorage
saveSelection() {
const selection = {
@ -114,6 +157,12 @@ class HeaderTools extends HTMLElement {
cursor: pointer;
}
.plane-select:disabled, .configuration-select:disabled {
background-color: #f5f5f5;
cursor: not-allowed;
opacity: 0.6;
}
.search-box {
display: flex;
align-items: center;
@ -137,6 +186,25 @@ class HeaderTools extends HTMLElement {
height: 16px;
opacity: 0.5;
}
.status-light {
width: 12px;
height: 12px;
border-radius: 50%;
border: 2px solid #ddd;
transition: all 0.3s ease;
}
.status-light.running {
background-color: #4CAF50;
border-color: #4CAF50;
box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
}
.status-light.stopped {
background-color: #f44336;
border-color: #f44336;
}
</style>
<div class="select-container">
<span class="select-label">机型</span>
@ -150,6 +218,7 @@ class HeaderTools extends HTMLElement {
<option value="">选择构型</option>
</select>
</div>
<div class="status-light" id="engineStatusLight" title="引擎状态"></div>
<div class="search-box">
<input type="text" placeholder="搜索...">
<img src="assets/icons/png/search_b.png" alt="搜索">
@ -212,6 +281,13 @@ class HeaderTools extends HTMLElement {
});
}
// 组件销毁时清理定时器
disconnectedCallback() {
if (this.engineStatusInterval) {
clearInterval(this.engineStatusInterval);
}
}
async loadPlanes() {
try {
const response = await fetch('/api/planes');

View File

@ -416,7 +416,6 @@ router.post('/read', async (req, res) => {
// 获取上传目录路径
const uploadPath = await getUploadPath();
const filePath = path.join(uploadPath, filename);
// 检查文件是否存在
try {
await fsPromises.access(filePath);

View File

@ -607,4 +607,15 @@ router.get('/check-process/:pid', async (req, res) => {
}
});
// 检查XNEngine引擎是否正在运行
router.get('/engine-status', async (req, res) => {
try {
const processInfo = await getLatestRunningXNEngineProcess();
res.json({ running: !!processInfo });
} catch (error) {
console.error('检查XNEngine引擎状态失败:', error);
res.status(500).json({ running: false });
}
});
module.exports = router;