모드변경 defauly sync
This commit is contained in:
15
index.h
15
index.h
@@ -912,7 +912,7 @@ const char index_html[] PROGMEM = R"rawliteral(
|
|||||||
</div>
|
</div>
|
||||||
<div class="status-card" id="mcp-mode-card">
|
<div class="status-card" id="mcp-mode-card">
|
||||||
<h3>MCP MODE</h3>
|
<h3>MCP MODE</h3>
|
||||||
<div class="value" id="mcp-mode-display">NORMAL</div>
|
<div class="value" id="mcp-mode-display">LISTEN-ONLY</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="status-card" id="file-status">
|
<div class="status-card" id="file-status">
|
||||||
<h3>CURRENT FILE</h3>
|
<h3>CURRENT FILE</h3>
|
||||||
@@ -948,8 +948,8 @@ const char index_html[] PROGMEM = R"rawliteral(
|
|||||||
<div class="control-row">
|
<div class="control-row">
|
||||||
<label for="mcp-mode">MCP2515 Mode:</label>
|
<label for="mcp-mode">MCP2515 Mode:</label>
|
||||||
<select id="mcp-mode">
|
<select id="mcp-mode">
|
||||||
<option value="0" selected>Normal (TX/RX + ACK)</option>
|
<option value="0">Normal (TX/RX + ACK)</option>
|
||||||
<option value="1">Listen-Only (RX only, no ACK)</option>
|
<option value="1" selected>Listen-Only (RX only, no ACK)</option>
|
||||||
<option value="2">Loopback (Self-test)</option>
|
<option value="2">Loopback (Self-test)</option>
|
||||||
<option value="3">Transmit Only (no ACK, auto mode switch)</option>
|
<option value="3">Transmit Only (no ACK, auto mode switch)</option>
|
||||||
</select>
|
</select>
|
||||||
@@ -1094,6 +1094,7 @@ const char index_html[] PROGMEM = R"rawliteral(
|
|||||||
let lastCanCounts = {}; // ★ 각 CAN ID별 마지막 count 저장
|
let lastCanCounts = {}; // ★ 각 CAN ID별 마지막 count 저장
|
||||||
const speedNames = {0: '125K', 1: '250K', 2: '500K', 3: '1M'};
|
const speedNames = {0: '125K', 1: '250K', 2: '500K', 3: '1M'};
|
||||||
const modeNames = {0: 'NORMAL (TX/RX+ACK)', 1: 'LISTEN-ONLY (RX)', 2: 'LOOPBACK', 3: 'TRANSMIT-ONLY (TX)'};
|
const modeNames = {0: 'NORMAL (TX/RX+ACK)', 1: 'LISTEN-ONLY (RX)', 2: 'LOOPBACK', 3: 'TRANSMIT-ONLY (TX)'};
|
||||||
|
let mcpModeSynced = false; // 🆕 MCP 모드 최초 동기화 플래그
|
||||||
let currentLoggingFile = '';
|
let currentLoggingFile = '';
|
||||||
let commentingFile = '';
|
let commentingFile = '';
|
||||||
// hasInitialSync 제거 - 매번 자동 동기화
|
// hasInitialSync 제거 - 매번 자동 동기화
|
||||||
@@ -1180,6 +1181,7 @@ const char index_html[] PROGMEM = R"rawliteral(
|
|||||||
console.log('WebSocket disconnected');
|
console.log('WebSocket disconnected');
|
||||||
document.getElementById('sync-status').textContent = '연결 끊김';
|
document.getElementById('sync-status').textContent = '연결 끊김';
|
||||||
document.getElementById('sync-status').style.color = '#f45c43';
|
document.getElementById('sync-status').style.color = '#f45c43';
|
||||||
|
mcpModeSynced = false; // 🆕 재연결 시 다시 동기화하도록 플래그 리셋
|
||||||
setTimeout(initWebSocket, 3000);
|
setTimeout(initWebSocket, 3000);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1354,9 +1356,14 @@ const char index_html[] PROGMEM = R"rawliteral(
|
|||||||
document.getElementById('sync-count').textContent = '0';
|
document.getElementById('sync-count').textContent = '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
// MCP 모드
|
// MCP 모드 - 상태창과 드롭다운 모두 동기화
|
||||||
if (data.mcpMode !== undefined) {
|
if (data.mcpMode !== undefined) {
|
||||||
document.getElementById('mcp-mode-display').textContent = modeNames[data.mcpMode];
|
document.getElementById('mcp-mode-display').textContent = modeNames[data.mcpMode];
|
||||||
|
// 🆕 드롭다운은 최초 접속 시 한 번만 동기화 (이후 사용자 선택 유지)
|
||||||
|
if (!mcpModeSynced) {
|
||||||
|
document.getElementById('mcp-mode').value = data.mcpMode;
|
||||||
|
mcpModeSynced = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 현재 파일
|
// 현재 파일
|
||||||
|
|||||||
Reference in New Issue
Block a user