리셋 시 세팅저장
This commit is contained in:
48
index.h
48
index.h
@@ -971,6 +971,8 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
<span class="format-info">(Text - Excel Ready)</span>
|
||||
</label>
|
||||
</div>
|
||||
<button onclick="saveFileFormat()" style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 8px 16px;">💾 Save</button>
|
||||
<span id="format-save-status" style="color: #11998e; font-size: 0.85em; font-weight: 600;"></span>
|
||||
</div>
|
||||
<div class="control-row">
|
||||
<button onclick="startLogging()" style="background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);">Start Logging</button>
|
||||
@@ -1153,6 +1155,9 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
let commentingFile = '';
|
||||
// hasInitialSync 제거 - 매번 자동 동기화
|
||||
|
||||
// 🆕 File Format 동기화 플래그
|
||||
window.canFormatSynced = false;
|
||||
|
||||
// 🎯 Auto Trigger 전역 변수
|
||||
let startTriggers = [];
|
||||
let stopTriggers = [];
|
||||
@@ -1236,6 +1241,7 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
document.getElementById('sync-status').textContent = '연결 끊김';
|
||||
document.getElementById('sync-status').style.color = '#f45c43';
|
||||
mcpModeSynced = false; // 🆕 재연결 시 다시 동기화하도록 플래그 리셋
|
||||
window.canFormatSynced = false; // 🆕 File Format도 재동기화
|
||||
setTimeout(initWebSocket, 3000);
|
||||
};
|
||||
|
||||
@@ -1332,6 +1338,15 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
else if (data.type === 'stopTriggersSet') {
|
||||
console.log('✅ Stop triggers saved:', data.count);
|
||||
}
|
||||
// 🆕 File Format 저장 결과 처리
|
||||
else if (data.type === 'canFormatSaved') {
|
||||
console.log('✅ CAN Format saved:', data.format);
|
||||
const statusSpan = document.getElementById('format-save-status');
|
||||
if (statusSpan) {
|
||||
statusSpan.textContent = '✓ Saved: ' + data.format.toUpperCase();
|
||||
setTimeout(() => { statusSpan.textContent = ''; }, 3000);
|
||||
}
|
||||
}
|
||||
|
||||
// Auto Trigger 상태 업데이트 (update 메시지에서)
|
||||
if (data.autoTriggerEnabled !== undefined) {
|
||||
@@ -1430,6 +1445,19 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
}
|
||||
}
|
||||
|
||||
// 🆕 저장된 File Format 적용 (최초 접속 시 한 번만)
|
||||
if (data.savedCanFormat && !window.canFormatSynced) {
|
||||
const formatRadios = document.getElementsByName('can-format');
|
||||
for (const radio of formatRadios) {
|
||||
if (radio.value === data.savedCanFormat) {
|
||||
radio.checked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
window.canFormatSynced = true;
|
||||
console.log('✅ Loaded saved CAN format:', data.savedCanFormat);
|
||||
}
|
||||
|
||||
// 현재 파일
|
||||
currentLoggingFile = data.currentFile || '';
|
||||
if (data.currentFile) {
|
||||
@@ -1713,6 +1741,26 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
console.log('MCP2515 mode set to:', modeName);
|
||||
}
|
||||
|
||||
// 🆕 File Format 저장 함수
|
||||
function saveFileFormat() {
|
||||
if (ws && ws.readyState === WebSocket.OPEN) {
|
||||
let canFormat = 'bin';
|
||||
const formatRadios = document.getElementsByName('can-format');
|
||||
for (const radio of formatRadios) {
|
||||
if (radio.checked) {
|
||||
canFormat = radio.value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ws.send(JSON.stringify({
|
||||
cmd: 'saveCanFormat',
|
||||
format: canFormat
|
||||
}));
|
||||
|
||||
console.log('Save CAN format:', canFormat);
|
||||
}
|
||||
}
|
||||
|
||||
function startLogging() {
|
||||
if (ws && ws.readyState === WebSocket.OPEN) {
|
||||
|
||||
Reference in New Issue
Block a user