정상 로깅 확인 soft reset 추가
This commit is contained in:
64
index.h
64
index.h
@@ -75,7 +75,7 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
/* 전력 경고 배너 */
|
||||
.power-warning {
|
||||
background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
|
||||
color: #666;
|
||||
color: white; /* ⭐ #666 → white */
|
||||
padding: 12px 20px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 15px;
|
||||
@@ -339,7 +339,7 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
cursor: pointer;
|
||||
transition: all 0.3s;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: #666;
|
||||
color: white; /* ⭐ #666 → white */
|
||||
}
|
||||
.control-row button:hover {
|
||||
transform: translateY(-2px);
|
||||
@@ -360,7 +360,7 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
}
|
||||
thead {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: #666;
|
||||
color: white; /* ⭐ #666 → white */
|
||||
}
|
||||
th {
|
||||
padding: 12px 8px;
|
||||
@@ -479,21 +479,21 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
}
|
||||
.download-btn {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: #666;
|
||||
color: white; /* ⭐ #666 → white */
|
||||
}
|
||||
.download-btn:hover {
|
||||
background: linear-gradient(135deg, #5568d3 0%, #66409e 100%);
|
||||
}
|
||||
.comment-btn {
|
||||
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
|
||||
color: #666;
|
||||
color: white; /* ⭐ #666 → white */
|
||||
}
|
||||
.comment-btn:hover {
|
||||
background: linear-gradient(135deg, #e77fe8 0%, #e44459 100%);
|
||||
}
|
||||
.delete-btn {
|
||||
background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
|
||||
color: #666;
|
||||
color: white; /* ⭐ #666 → white */
|
||||
}
|
||||
.delete-btn:hover {
|
||||
background: linear-gradient(135deg, #d32f3f 0%, #e53935 100%);
|
||||
@@ -823,6 +823,7 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
<div class="control-row">
|
||||
<button onclick="startLogging()" style="background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);">Start Logging</button>
|
||||
<button onclick="stopLogging()" style="background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);">Stop Logging</button>
|
||||
<button onclick="hardwareReset()" style="background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); color: white;">🔄 Hardware Reset</button>
|
||||
<button onclick="refreshFiles()">Refresh Files</button>
|
||||
<button onclick="clearMessages()">Clear Display</button>
|
||||
</div>
|
||||
@@ -943,19 +944,11 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
document.getElementById('sync-status').textContent = '연결됨';
|
||||
document.getElementById('sync-status').style.color = '#38ef7d';
|
||||
|
||||
// ⭐⭐⭐ 자동 시간 동기화 (1분에 1회로 제한)
|
||||
const now = Date.now();
|
||||
const lastSync = parseInt(localStorage.getItem('lastTimeSync') || '0');
|
||||
|
||||
if (now - lastSync > 60000) { // 1분 이상 경과
|
||||
setTimeout(function() {
|
||||
syncTimeFromPhone();
|
||||
localStorage.setItem('lastTimeSync', now.toString());
|
||||
console.log('Auto time sync on connect');
|
||||
}, 100);
|
||||
} else {
|
||||
console.log('Skipping time sync (last sync was recent)');
|
||||
}
|
||||
// ⭐⭐⭐ 자동 시간 동기화 (페이지 로드 시 항상 실행)
|
||||
setTimeout(function() {
|
||||
syncTimeFromPhone();
|
||||
console.log('✅ Auto time sync on page load');
|
||||
}, 500); // WebSocket 안정화 대기
|
||||
|
||||
// ⭐ WebSocket 연결되면 즉시 파일 목록 요청
|
||||
setTimeout(function() {
|
||||
@@ -1004,6 +997,9 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
if (data.success) {
|
||||
console.log('Comment saved successfully');
|
||||
}
|
||||
} else if (data.type === 'hwReset') {
|
||||
console.log('✅ 하드웨어 리셋 명령 전송됨 - ESP32 재부팅 중...');
|
||||
// ESP32가 재부팅되므로 WebSocket 연결 끊김
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Parse error:', e);
|
||||
@@ -1393,12 +1389,42 @@ const char index_html[] PROGMEM = R"rawliteral(
|
||||
if (ws && ws.readyState === WebSocket.OPEN) {
|
||||
ws.send(JSON.stringify({cmd: 'stopLogging'}));
|
||||
console.log('Stop logging command sent');
|
||||
|
||||
// ⭐⭐⭐ 로깅 종료 시 Messages 카운트 리셋
|
||||
document.getElementById('msg-count').textContent = '0';
|
||||
document.getElementById('msg-speed').textContent = '0/s';
|
||||
console.log('✅ Messages count reset to 0');
|
||||
|
||||
setTimeout(() => {
|
||||
refreshFiles();
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
function hardwareReset() {
|
||||
if (!confirm('ESP32를 재부팅하시겠습니까?\n\n⚠️ 모든 로깅이 중지되고 WebSocket 연결이 끊어집니다.\n재부팅 후 웹페이지를 새로고침하세요.')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ws && ws.readyState === WebSocket.OPEN) {
|
||||
console.log('🔄 하드웨어 리셋 요청...');
|
||||
ws.send(JSON.stringify({cmd: 'hwReset'}));
|
||||
|
||||
// 메시지 카운터 리셋
|
||||
document.getElementById('msg-count').textContent = '0';
|
||||
document.getElementById('msg-speed').textContent = '0/s';
|
||||
console.log('✅ 하드웨어 리셋 요청 전송됨');
|
||||
|
||||
// 3초 후 알림
|
||||
setTimeout(() => {
|
||||
alert('ESP32가 재부팅 중입니다...\n\n10초 후 웹페이지를 새로고침하세요!');
|
||||
}, 1000);
|
||||
} else {
|
||||
alert('WebSocket이 연결되지 않았습니다!');
|
||||
console.error('WebSocket not connected');
|
||||
}
|
||||
}
|
||||
|
||||
function refreshFiles() {
|
||||
console.log('Requesting file list...'); // ⭐ 디버그
|
||||
if (ws && ws.readyState === WebSocket.OPEN) {
|
||||
|
||||
Reference in New Issue
Block a user