디자인 다크 모드 수정

This commit is contained in:
2026-03-12 21:14:40 +00:00
parent 70e3ca0ecb
commit e7beaa5b41
7 changed files with 1885 additions and 3067 deletions

484
graph.h
View File

@@ -9,309 +9,257 @@ const char graph_html[] PROGMEM = R"rawliteral(
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>CAN Signal Graph</title> <title>CAN Signal Graph</title>
<style> <style>
* { margin: 0; padding: 0; box-sizing: border-box; } :root {
--bg: #0e1117;
--panel: #161b24;
--card: #1c2230;
--border: #2d3748;
--accent: #43cea2;
--green: #3fb950;
--blue: #58a6ff;
--red: #f85149;
--yellow: #e3b341;
--purple: #bc8cff;
--text: #e6edf3;
--muted: #8b949e;
--r: 8px;
}
* { margin:0; padding:0; box-sizing:border-box; }
html, body { min-height:100%; }
body { body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: linear-gradient(135deg, #43cea2 0%, #185a9d 100%); background: var(--bg); color: var(--text);
min-height: 100vh; overflow-x: hidden; font-size: 14px;
padding: 10px;
}
.container {
max-width: 1600px;
margin: 0 auto;
background: white;
border-radius: 15px;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
overflow: hidden;
} }
/* Header */
.header { .header {
background: linear-gradient(135deg, #43cea2 0%, #185a9d 100%); background: linear-gradient(135deg,#1a2744 0%,#1e1a3a 100%);
color: white; padding: 11px 16px; border-bottom: 1px solid var(--border);
padding: 20px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
text-align: center;
} }
.header h1 { font-size: 1.8em; margin-bottom: 5px; } .header h1 {
/* ========== 통일된 네비게이션 ========== */ font-size: 1.0em; font-weight: 700; color: var(--accent);
.nav { display: flex; align-items: center; gap: 8px;
background: #f8f9fa;
padding: 0;
border-bottom: 2px solid #e0e0e0;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
} }
.header p { font-size: 0.78em; color: var(--muted); margin:0; }
.nav a { .badge {
display: inline-flex; background: rgba(67,206,162,.15); color: var(--accent);
align-items: center; padding: 2px 8px; border-radius: 12px; font-size: 0.65em;
justify-content: center; font-weight: 600; border: 1px solid rgba(67,206,162,.3);
padding: 15px 20px;
text-decoration: none;
color: #666;
font-weight: 500;
font-size: 0.95em;
border-bottom: 3px solid transparent;
transition: all 0.3s;
white-space: nowrap; white-space: nowrap;
min-width: 120px; }
.header-spacer { flex:1; }
/* Nav */
.nav {
background: var(--panel); border-bottom: 1px solid var(--border);
display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch;
scrollbar-width: none;
}
.nav::-webkit-scrollbar { display:none; }
.nav a {
display: inline-flex; align-items: center;
padding: 10px 13px; text-decoration: none; color: var(--muted);
font-size: 0.78em; font-weight: 500;
border-bottom: 2px solid transparent; white-space: nowrap;
transition: color .2s, border-color .2s;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--accent); border-bottom-color: var(--accent); }
/* Content */
.content { padding: 12px; }
/* Headings */
h2 {
color: var(--accent); margin: 14px 0 10px;
font-size: 0.82em; font-weight: 700; text-transform: uppercase;
letter-spacing: .5px; padding-bottom: 6px;
border-bottom: 1px solid var(--border);
}
h3 {
color: var(--text); font-size: 0.85em; font-weight: 600;
margin-bottom: 10px; padding-bottom: 6px;
border-bottom: 1px solid var(--border);
} }
.nav a:hover { /* Buttons */
background: #e9ecef; .btn, button {
color: #667eea; padding: 6px 13px; border: 1px solid var(--border);
transform: translateY(-2px); border-radius: var(--r); background: var(--bg); color: var(--muted);
font-size: 0.8em; font-weight: 600; cursor: pointer;
font-family: inherit; transition: all .15s; white-space: nowrap;
-webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:hover, button:hover { border-color: var(--accent); color: var(--accent); }
.btn:active, button:active { transform: scale(.97); }
.btn-primary { border-color:var(--blue); color:var(--blue); }
.btn-success { border-color:var(--accent); color:var(--accent); }
.btn-danger { border-color:var(--red); color:var(--red); }
.btn-warning { border-color:var(--yellow); color:var(--yellow); }
.btn-secondary{ border-color:var(--muted); color:var(--muted); }
.btn-primary:hover { background:rgba(88,166,255,.10); }
.btn-success:hover { background:rgba(67,206,162,.10); }
.btn-danger:hover { background:rgba(248,81,73,.10); }
.btn-warning:hover { background:rgba(227,179,65,.10); }
.btn-secondary:hover{ background:rgba(139,148,158,.10); }
.btn-small { padding:4px 9px; font-size:.75em; }
.button-group, .btn-group { display:flex; gap:6px; flex-wrap:wrap; margin-top:10px; }
/* Forms */
label {
display:block; font-weight:600; color:var(--muted);
margin-bottom:4px; font-size:.78em;
text-transform:uppercase; letter-spacing:.3px;
}
input[type="text"], input[type="password"], input[type="number"],
select, textarea {
width:100%; padding:7px 10px;
border:1px solid var(--border); border-radius:var(--r);
font-size:.85em; font-family:inherit;
background:var(--bg); color:var(--text);
transition:border-color .2s;
}
input:focus, select:focus, textarea:focus {
outline:none; border-color:var(--accent);
box-shadow:0 0 0 2px rgba(67,206,162,.10);
}
input[type="checkbox"], input[type="radio"] {
width:15px; height:15px; cursor:pointer; accent-color:var(--accent);
}
select option { background:var(--panel); color:var(--text); }
/* Panels */
.section, .settings-section, .send-panel, .stats,
.control-panel, .auto-trigger-section {
background:var(--panel); border:1px solid var(--border);
border-radius:var(--r); padding:13px; margin-bottom:10px;
}
.form-group { margin-bottom:12px; }
.form-group:last-child { margin-bottom:0; }
.help-text { font-size:.76em; color:var(--muted); margin-top:4px; line-height:1.4; }
.form-row {
display:grid;
grid-template-columns:repeat(auto-fit,minmax(min(100%,190px),1fr));
gap:10px; margin-bottom:10px;
}
.form-row label { text-transform:none; font-size:.78em; }
.checkbox-group, .checkbox-row {
display:flex; align-items:center; gap:8px;
margin-bottom:8px; padding:7px 10px;
background:var(--card); border-radius:6px; border:1px solid var(--border);
}
.checkbox-group label, .checkbox-row label {
text-transform:none; cursor:pointer; margin-bottom:0;
color:var(--text); font-size:.85em; letter-spacing:0;
} }
.nav a.active { /* Alerts */
color: #764ba2; .alert {
border-bottom-color: #764ba2; padding:9px 13px; border-radius:var(--r);
background: white; margin-bottom:10px; display:none;
font-weight: 600; align-items:center; gap:9px;
font-size:.83em; font-weight:600;
border:1px solid var(--border); background:var(--panel); color:var(--text);
} }
.content { padding: 15px; } .alert.show { display:flex; }
.alert-success { border-color:rgba(67,206,162,.4); color:var(--accent); background:rgba(67,206,162,.07); }
.alert-info { border-color:rgba(88,166,255,.4); color:var(--blue); background:rgba(88,166,255,.07); }
.alert-warning { border-color:rgba(227,179,65,.4); color:var(--yellow); background:rgba(227,179,65,.07); }
.alert-icon { font-size:1.15em; }
.alert-text { flex:1; }
@keyframes slideDown { from{opacity:0;transform:translateY(-6px);}to{opacity:1;transform:translateY(0);} }
/* Connection status */
.connection-status {
position:fixed; top:10px; right:10px;
padding:4px 11px; border-radius:20px;
font-size:.75em; font-weight:600; z-index:1000;
border:1px solid var(--border); background:var(--panel); color:var(--muted);
}
.connection-status.connected { border-color:rgba(67,206,162,.5); color:var(--accent); background:rgba(67,206,162,.08); }
.connection-status.disconnected { border-color:rgba(248,81,73,.5); color:var(--red); background:rgba(248,81,73,.08); }
@media (max-width:480px) { .content{padding:8px;} h2{font-size:.78em;} }
/* graph.h specific */
.dbc-upload { .dbc-upload {
background: #f8f9fa; background:var(--panel); border:1px solid var(--border);
padding: 20px; border-radius:var(--r); padding:13px; margin-bottom:10px;
border-radius: 10px;
margin-bottom: 15px;
} }
.upload-area { .upload-area {
border: 3px dashed #43cea2; border:2px dashed var(--border); border-radius:var(--r);
border-radius: 10px; padding:26px 18px; text-align:center; cursor:pointer;
padding: 30px 20px; transition:all .2s; color:var(--muted); font-size:.85em;
text-align: center;
cursor: pointer;
transition: all 0.3s;
} }
.upload-area:hover { background: #f0f9ff; border-color: #185a9d; } .upload-area:hover { border-color:var(--accent); color:var(--accent); background:rgba(67,206,162,.04); }
.upload-area input { display: none; } .upload-area input { display:none; }
.upload-area p { margin-top:8px; }
.signal-selector { .signal-selector {
background: #f8f9fa; background:var(--panel); border:1px solid var(--border);
padding: 15px; border-radius:var(--r); padding:13px; margin-bottom:10px;
border-radius: 10px;
margin-bottom: 15px;
}
.search-container {
margin-bottom: 15px;
position: relative;
} }
.search-container { margin-bottom:10px; position:relative; }
.search-box { .search-box {
width: 100%; width:100%; padding:8px 10px 8px 34px;
padding: 12px 12px 12px 40px; border:1px solid var(--border); border-radius:var(--r);
border: 2px solid #43cea2; font-size:.85em; background:var(--bg); color:var(--text);
border-radius: 8px;
font-size: 0.95em;
transition: all 0.3s;
}
.search-box:focus {
outline: none;
border-color: #185a9d;
box-shadow: 0 0 0 3px rgba(67, 206, 162, 0.1);
}
.search-icon {
position: absolute;
left: 12px;
top: 50%;
transform: translateY(-50%);
color: #43cea2;
font-size: 1.2em;
} }
.search-box:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 2px rgba(67,206,162,.10); }
.search-icon { position:absolute; left:10px; top:50%; transform:translateY(-50%); color:var(--accent); font-size:1.05em; }
.search-info { .search-info {
margin-top: 8px; margin-top:5px; padding:5px 10px;
padding: 8px 12px; background:rgba(88,166,255,.08); border-radius:5px;
background: #e3f2fd; font-size:.78em; color:var(--blue); font-weight:600;
border-radius: 5px; border:1px solid rgba(88,166,255,.2);
font-size: 0.85em;
color: #185a9d;
font-weight: 600;
}
.no-results {
text-align: center;
padding: 40px 20px;
color: white;
font-size: 0.95em;
}
.no-results-icon {
font-size: 3em;
margin-bottom: 10px;
opacity: 0.5;
}
.sort-controls {
display: flex;
gap: 10px;
margin-bottom: 15px;
align-items: center;
flex-wrap: wrap;
}
.sort-label {
font-weight: 600;
color: #333;
font-size: 0.9em;
} }
.no-results { text-align:center; padding:28px 18px; color:var(--muted); font-size:.85em; }
.no-results-icon { font-size:2.2em; margin-bottom:8px; opacity:.4; }
.sort-controls { display:flex; gap:5px; margin-bottom:10px; align-items:center; flex-wrap:wrap; }
.sort-label { font-weight:600; color:var(--muted); font-size:.77em; }
.sort-btn { .sort-btn {
padding: 8px 15px; padding:4px 10px; border:1px solid var(--border);
border: 2px solid #43cea2; background:var(--bg); border-radius:6px; font-size:.76em;
background: white; cursor:pointer; font-weight:600; color:var(--muted); font-family:inherit;
border-radius: 5px; transition:all .15s;
font-size: 0.85em;
cursor: pointer;
transition: all 0.3s;
font-weight: 600;
}
.sort-btn:hover {
background: #f0f9ff;
transform: translateY(-2px);
}
.sort-btn.active {
background: #43cea2;
color: white;
} }
.sort-btn:hover { border-color:var(--accent); color:var(--accent); }
.sort-btn.active { border-color:var(--accent); color:var(--accent); background:rgba(67,206,162,.10); }
.signal-grid { .signal-grid {
display: grid; display:grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); grid-template-columns:repeat(auto-fill,minmax(min(100%,170px),1fr));
gap: 10px; gap:7px; margin-top:10px;
margin-top: 15px;
} }
.signal-item { .signal-item {
background: white; background:var(--card); padding:9px;
padding: 12px; border-radius:var(--r); border:1px solid var(--border); cursor:pointer; transition:all .15s;
border-radius: 8px;
border: 2px solid #ddd;
cursor: pointer;
transition: all 0.3s;
} }
.signal-item:hover { border-color: #43cea2; transform: translateY(-2px); } .signal-item:hover { border-color:var(--accent); background:rgba(67,206,162,.04); }
.signal-item.selected { border-color: #185a9d; background: #e3f2fd; } .signal-item.selected { border-color:var(--accent); background:rgba(67,206,162,.10); }
.signal-name { font-weight: 600; color: #333; margin-bottom: 5px; font-size: 0.9em; } .signal-name { font-weight:600; color:var(--text); margin-bottom:3px; font-size:.83em; }
.signal-info { font-size: 0.8em; color: #555; line-height: 1.4; } .signal-info { font-size:.74em; color:var(--muted); line-height:1.4; }
.highlight { .highlight { background:rgba(227,179,65,.22); color:var(--yellow); padding:1px 0; font-weight:600; }
background-color: #ffeb3b; .controls { display:flex; gap:5px; margin-bottom:10px; flex-wrap:wrap; }
padding: 2px 0;
font-weight: 600;
}
.controls {
display: flex;
gap: 8px;
margin-bottom: 15px;
flex-wrap: wrap;
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 5px;
font-size: 0.9em;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
}
.btn-primary { background: linear-gradient(135deg, #43cea2 0%, #185a9d 100%); color: white; }
.btn-success { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); color: white; }
.btn-danger { background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%); color: white; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
h2 {
color: #333;
margin: 20px 0 15px 0;
padding-bottom: 8px;
border-bottom: 3px solid #43cea2;
font-size: 1.3em;
}
.status { padding: 12px; background: #fff3cd; border-radius: 5px; margin-bottom: 15px; font-size: 0.9em; }
.status.success { background: #d4edda; color: #155724; }
.status.error { background: #f8d7da; color: #721c24; }
.selection-info { .selection-info {
background: #e3f2fd; background:rgba(88,166,255,.07); padding:9px 12px;
padding: 12px 15px; border-radius:var(--r); margin-bottom:10px;
border-radius: 8px; border:1px solid rgba(88,166,255,.2); border-left:3px solid var(--blue);
margin-bottom: 15px; font-size:.83em; color:var(--text);
border-left: 4px solid #185a9d;
font-size: 0.9em;
color: #333;
}
.selection-info strong {
color: #185a9d;
}
/* ========== 반응형 디자인 ========== */
@media (max-width: 768px) {
body {
padding: 5px;
}
.container {
border-radius: 10px;
}
.header {
padding: 15px;
flex-direction: column;
text-align: center;
gap: 10px;
}
.header h1 {
font-size: 1.4em;
}
.nav {
padding: 5px;
}
.nav a {
padding: 12px 15px;
font-size: 0.85em;
}
.content {
padding: 15px;
}
.btn {
padding: 10px 20px;
font-size: 13px;
}
}
@media (min-width: 769px) and (max-width: 1024px) {
.header h1 {
font-size: 1.6em;
}
.nav a {
padding: 13px 18px;
font-size: 0.9em;
}
.content {
padding: 25px;
}
}
@media (min-width: 1025px) {
.content {
padding: 30px;
}
} }
.selection-info strong { color:var(--blue); }
.status { padding:9px 12px; background:rgba(227,179,65,.07); border-radius:var(--r); margin-bottom:10px; font-size:.83em; border:1px solid rgba(227,179,65,.2); color:var(--yellow); }
.status.success { background:rgba(67,206,162,.07); border-color:rgba(67,206,162,.2); color:var(--accent); }
.status.error { background:rgba(248,81,73,.07); border-color:rgba(248,81,73,.2); color:var(--red); }
</style> </style>
</head> </head>
<body> <body>
<div class="container"> <div class="header">
<div class="header">
<h1>CAN Signal Graph</h1> <h1>CAN Signal Graph</h1>
<p>Real-time Signal Visualization (Offline Mode)</p> <p>Real-time Signal Visualization (Offline Mode)</p>
</div> </div>
<div class="nav"> <div class="nav">
<a href="/">📊 Monitor</a> <a href="/">📊 Monitor</a>
<a href="/transmit">📤 Transmit</a> <a href="/transmit">📤 Transmit</a>
<a href="/graph" class="active">📈 Graph</a> <a href="/graph" class="active">📈 Graph</a>
@@ -321,7 +269,7 @@ const char graph_html[] PROGMEM = R"rawliteral(
<a href="/serial2">📟 Serial2</a> <a href="/serial2">📟 Serial2</a>
</div> </div>
<div class="content"> <div class="content">
<div id="status" class="status" style="display:none;"></div> <div id="status" class="status" style="display:none;"></div>
<h2>Upload DBC File</h2> <h2>Upload DBC File</h2>
@@ -367,7 +315,7 @@ const char graph_html[] PROGMEM = R"rawliteral(
<div id="signal-list" class="signal-grid"></div> <div id="signal-list" class="signal-grid"></div>
</div> </div>
<div style="background: #e3f2fd; padding: 15px; border-radius: 8px; margin-top: 15px; border-left: 4px solid #185a9d;"> <div style="background:rgba(88,166,255,.07);padding:10px 13px;border-radius:8px;margin-top:10px;border:1px solid rgba(88,166,255,.2);border-left:3px solid var(--blue);font-size:.83em;">
<p style="color: #333; font-size: 0.9em; margin: 0;"> <p style="color: #333; font-size: 0.9em; margin: 0;">
<strong> Info:</strong> Click "Start" to open a new window with real-time graphs. <strong> Info:</strong> Click "Start" to open a new window with real-time graphs.
Your selected signals will be saved automatically. Your selected signals will be saved automatically.

View File

@@ -9,219 +9,241 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CAN Signal Graph Viewer</title> <title>CAN Signal Graph Viewer</title>
<style> <style>
* { margin: 0; padding: 0; box-sizing: border-box; } :root {
--bg: #0e1117;
--panel: #161b24;
--card: #1c2230;
--border: #2d3748;
--accent: #43cea2;
--accent2: #38ef7d;
--blue: #58a6ff;
--red: #f85149;
--yellow: #e3b341;
--text: #e6edf3;
--muted: #8b949e;
--radius: 10px;
}
* { margin:0; padding:0; box-sizing:border-box; }
html, body { height:100%; }
body { body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 10px; background: var(--bg);
color: white; color: var(--text);
overflow-x: hidden; overflow-x: hidden;
font-size: 14px;
} }
/* ── Header ── */
.header { .header {
background: linear-gradient(135deg, #667eea, #764ba2); background: linear-gradient(135deg, #1a2744 0%, #1e1a3a 100%);
padding: 15px; padding: 12px 16px;
text-align: center; border-bottom: 1px solid var(--border);
box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.header h1 { font-size: 1.5em; }
.header p { font-size: 0.9em; opacity: 0.9; margin-top: 5px; }
/* ========== 통일된 네비게이션 ========== */
.nav {
background: #f8f9fa;
padding: 0;
border-bottom: 2px solid #e0e0e0;
display: flex; display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center; align-items: center;
gap: 10px;
} }
.header h1 {
font-size: 1.05em;
font-weight: 700;
color: var(--accent);
white-space: nowrap;
}
.header p {
font-size: 0.8em;
color: var(--muted);
margin: 0;
}
.header-spacer { flex: 1; }
/* ── Nav ── */
.nav {
background: var(--panel);
border-bottom: 1px solid var(--border);
display: flex;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a { .nav a {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; padding: 10px 14px;
padding: 15px 20px;
text-decoration: none; text-decoration: none;
color: #666; color: var(--muted);
font-size: 0.8em;
font-weight: 500; font-weight: 500;
font-size: 0.95em; border-bottom: 2px solid transparent;
border-bottom: 3px solid transparent;
transition: all 0.3s;
white-space: nowrap; white-space: nowrap;
min-width: 120px; transition: color 0.2s, border-color 0.2s;
min-width: unset;
} }
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--accent); border-bottom-color: var(--accent); }
.nav a:hover { /* ── Controls ── */
background: #e9ecef;
color: #667eea;
transform: translateY(-2px);
}
.nav a.active {
color: #764ba2;
border-bottom-color: #764ba2;
background: white;
font-weight: 600;
}
.controls { .controls {
background: #2a2a2a; background: var(--panel);
padding: 10px 15px; border-bottom: 1px solid var(--border);
padding: 8px 12px;
display: flex; display: flex;
gap: 10px;
justify-content: center;
flex-wrap: wrap; flex-wrap: wrap;
box-shadow: 0 2px 5px rgba(0,0,0,0.2); gap: 6px;
align-items: center;
} }
.control-group { .control-group {
display: flex; display: flex;
gap: 10px;
align-items: center; align-items: center;
gap: 4px;
flex-wrap: wrap;
} }
.control-label { .control-label {
font-size: 0.85em; font-size: 0.72em;
color: #aaa; color: var(--muted);
white-space: nowrap;
padding-right: 2px;
}
.ctrl-sep {
width: 1px;
height: 20px;
background: var(--border);
margin: 0 4px;
} }
.btn { .btn {
padding: 8px 20px; padding: 5px 11px;
border: none; border: 1px solid var(--border);
border-radius: 5px; border-radius: 6px;
font-size: 0.9em; background: var(--bg);
color: var(--muted);
font-size: 0.78em;
font-weight: 600; font-weight: 600;
cursor: pointer; cursor: pointer;
transition: all 0.3s; transition: all 0.15s;
white-space: nowrap;
font-family: inherit;
-webkit-tap-highlight-color: transparent;
touch-action: manipulation;
} }
.btn-success { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); color: white; } .btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%); color: white; } .btn:active { transform: scale(0.96); }
.btn-info { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.btn-warning { background: linear-gradient(135deg, #f2994a 0%, #f2c94c 100%); color: white; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.btn.active { .btn.active {
box-shadow: inset 0 3px 5px rgba(0,0,0,0.3); background: rgba(67,206,162,0.15);
transform: translateY(0); border-color: var(--accent);
color: var(--accent);
}
.btn-success { border-color: #3fb950; color: #3fb950; }
.btn-success.active, .btn-success:hover { background: rgba(63,185,80,0.15); }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: rgba(248,81,73,0.12); }
.btn-info { border-color: var(--blue); color: var(--blue); }
.btn-info.active, .btn-info:hover { background: rgba(88,166,255,0.15); }
.btn-warning { border-color: var(--yellow); color: var(--yellow); }
.btn-warning.active, .btn-warning:hover { background: rgba(227,179,65,0.15); }
/* ── Stats bar ── */
.stats-bar {
display: flex;
flex-wrap: wrap;
gap: 14px;
padding: 5px 14px;
background: var(--bg);
border-bottom: 1px solid var(--border);
font-size: 0.75em;
color: var(--muted);
}
.stats-bar strong { color: var(--accent); margin-left: 3px; }
/* ── Status pill ── */
.status {
padding: 4px 10px;
border-radius: 20px;
font-size: 0.72em;
font-weight: 600;
background: rgba(67,206,162,0.12);
color: var(--accent);
border: 1px solid rgba(67,206,162,0.3);
transition: all 0.3s;
white-space: nowrap;
}
.status.disconnected {
background: rgba(248,81,73,0.12);
color: var(--red);
border-color: rgba(248,81,73,0.3);
} }
/* ── Graph grid ── */
.graphs { .graphs {
padding: 15px; padding: 10px;
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(450px, 1fr)); /* ★ 모바일 핵심: min(100%, 440px) 로 가로 스크롤 방지 */
gap: 15px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
gap: 10px;
} }
.graph-container { .graph-container {
background: #2a2a2a; background: var(--card);
padding: 15px; border-radius: var(--radius);
border-radius: 10px; border: 1px solid var(--border);
border: 2px solid #3a3a3a; overflow: hidden;
} }
.graph-header { .graph-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 10px; padding: 8px 12px;
padding-bottom: 8px; border-bottom: 1px solid var(--border);
border-bottom: 2px solid #43cea2; background: rgba(67,206,162,0.05);
gap: 8px;
} }
.graph-title { .graph-title {
font-size: 1em; font-size: 0.82em;
font-weight: 600; font-weight: 700;
color: #43cea2; color: var(--accent);
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
.graph-value { .graph-value {
font-size: 1.2em; font-size: 1em;
font-weight: 700; font-weight: 700;
color: #38ef7d; color: var(--accent2);
font-family: 'Courier New', monospace; font-family: 'Courier New', 'SF Mono', monospace;
white-space: nowrap;
flex-shrink: 0;
} }
/* ★ canvas: CSS padding/background 제거, height만 설정 */
canvas { canvas {
display: block;
width: 100%; width: 100%;
height: 250px; height: 200px;
border: 1px solid #3a3a3a; border: none;
border-radius: 5px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 10px;
}
.status {
position: fixed;
top: 10px;
right: 10px;
padding: 10px 15px;
border-radius: 5px;
background: #2a2a2a;
border: 2px solid #43cea2;
font-size: 0.9em;
z-index: 1000;
}
.status.disconnected {
border-color: #eb3349;
background: #3a2a2a;
} }
/* ── Responsive ── */
@media (max-width: 480px) {
/* ========== 반응형 디자인 ========== */ .controls { padding: 6px 8px; gap: 5px; }
@media (max-width: 768px) { .ctrl-sep { display: none; }
body { .btn { padding: 6px 9px; font-size: 0.8em; }
padding: 5px; .header h1 { font-size: 0.95em; }
} canvas { height: 175px; }
.stats-bar { gap: 8px; font-size: 0.7em; }
.container {
border-radius: 10px;
}
.header {
padding: 15px;
flex-direction: column;
text-align: center;
gap: 10px;
}
.header h1 {
font-size: 1.4em;
}
.nav {
padding: 5px;
}
.nav a {
padding: 12px 15px;
font-size: 0.85em;
}
.content {
padding: 15px;
}
.btn {
padding: 10px 20px;
font-size: 13px;
}
} }
@media (min-width: 768px) {
@media (min-width: 769px) and (max-width: 1024px) { canvas { height: 230px; }
.header h1 {
font-size: 1.6em;
}
.nav a {
padding: 13px 18px;
font-size: 0.9em;
}
.content {
padding: 25px;
}
} }
@media (min-width: 1200px) {
@media (min-width: 1025px) { canvas { height: 260px; }
.content {
padding: 30px;
}
} }
</style> </style>
</head> </head>
<body> <body>
<div class="header"> <div class="header">
<h1>Real-time CAN Signal Graphs (Scatter Mode)</h1> <div>
<p>Viewing <span id="graph-count">0</span> signals</p> <h1>📈 CAN Signal Graph</h1>
<p>Viewing <span id="graph-count">0</span> signals</p>
</div>
<div class="header-spacer"></div>
<div class="status" id="status-pill">Connecting...</div>
</div> </div>
<div class="nav"> <div class="nav">
@@ -236,42 +258,46 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
<div class="controls"> <div class="controls">
<div class="control-group"> <div class="control-group">
<button class="btn btn-success" onclick="startGraphing()">Start</button> <button class="btn btn-success active" id="btn-start" onclick="startGraphing()"> Start</button>
<button class="btn btn-danger" onclick="stopGraphing()">Stop</button> <button class="btn btn-danger" id="btn-stop" onclick="stopGraphing()"> Stop</button>
<button class="btn btn-danger" onclick="window.close()">Close</button>
</div> </div>
<div class="ctrl-sep"></div>
<div class="control-group"> <div class="control-group">
<span class="control-label">X-Axis Scale:</span> <span class="control-label">Scale:</span>
<button class="btn btn-info active" id="btn-index-mode" onclick="setScaleMode('index')">Index</button> <button class="btn btn-info active" id="btn-index-mode" onclick="setScaleMode('index')">Index</button>
<button class="btn btn-info" id="btn-time-mode" onclick="setScaleMode('time')">Time-Based</button> <button class="btn btn-info" id="btn-time-mode" onclick="setScaleMode('time')">Time</button>
</div> </div>
<div class="ctrl-sep"></div>
<div class="control-group"> <div class="control-group">
<span class="control-label">X-Axis Range:</span> <span class="control-label">Range:</span>
<button class="btn btn-warning active" id="btn-range-10s" onclick="setRangeMode('10s')">10s Window</button> <button class="btn btn-warning active" id="btn-range-10s" onclick="setRangeMode('10s')">10s</button>
<button class="btn btn-warning" id="btn-range-all" onclick="setRangeMode('all')">All Time</button> <button class="btn btn-warning" id="btn-range-30s" onclick="setRangeMode('30s')">30s</button>
<button class="btn btn-warning" id="btn-range-all" onclick="setRangeMode('all')">All</button>
</div> </div>
<div class="ctrl-sep"></div>
<div class="control-group"> <div class="control-group">
<span class="control-label">Sort by:</span> <span class="control-label">Plot:</span>
<button class="btn btn-info active" id="btn-sort-selection" onclick="setSortMode('selection')">Selection Order</button> <button class="btn btn-info active" id="btn-plot-line" onclick="setPlotMode('line')">Line</button>
<button class="btn btn-info" id="btn-sort-name-asc" onclick="setSortMode('name-asc')">Name (AZ)</button> <button class="btn btn-info" id="btn-plot-scatter" onclick="setPlotMode('scatter')">Dot</button>
<button class="btn btn-info" id="btn-sort-name-desc" onclick="setSortMode('name-desc')">Name (ZA)</button>
</div> </div>
<div class="ctrl-sep"></div>
<div class="control-group"> <div class="control-group">
<button class="btn btn-success" onclick="downloadCSV()" style="background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);"> <span class="control-label">Sort:</span>
📥 Download CSV <button class="btn btn-info active" id="btn-sort-selection" onclick="setSortMode('selection')">Order</button>
</button> <button class="btn btn-info" id="btn-sort-name-asc" onclick="setSortMode('name-asc')">AZ</button>
<button class="btn btn-danger" onclick="clearData()" style="background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);"> <button class="btn btn-info" id="btn-sort-name-desc" onclick="setSortMode('name-desc')">ZA</button>
🗑 Clear Data </div>
</button> <div class="ctrl-sep"></div>
<div class="control-group">
<button class="btn btn-success" onclick="downloadCSV()"> CSV</button>
<button class="btn btn-danger" onclick="clearData()">🗑 Clear</button>
</div> </div>
</div> </div>
<div class="status" id="status">Connecting...</div> <div class="stats-bar">
<span>Points:<strong id="data-point-count">0</strong></span>
<div style="padding: 10px 15px; background: #2a2a2a; color: #aaa; font-size: 0.85em; display: flex; justify-content: space-between; align-items: center;"> <span>Time:<strong id="recording-time">0s</strong></span>
<span>Data Points: <strong id="data-point-count" style="color: #43cea2;">0</strong></span> <span>Msgs:<strong id="msg-received">0</strong></span>
<span>Recording Time: <strong id="recording-time" style="color: #43cea2;">0s</strong></span>
<span>Messages Received: <strong id="msg-received" style="color: #43cea2;">0</strong></span>
</div> </div>
<div class="graphs" id="graphs"></div> <div class="graphs" id="graphs"></div>
@@ -285,12 +311,13 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
let dbcData = {}; let dbcData = {};
let lastTimestamps = {}; let lastTimestamps = {};
let sortMode = 'selection'; let sortMode = 'selection';
const MAX_DATA_POINTS = 60; const MAX_DATA_POINTS = 300;
let scaleMode = 'index'; let scaleMode = 'index';
let rangeMode = '10s'; let rangeMode = '10s';
let totalMsgReceived = 0; let totalMsgReceived = 0;
let lastCanCounts = {}; // ★ 각 CAN ID별 마지막 count 저장 let lastCanCounts = {};
let lastSignalTimes = {}; // ⭐ 각 신호별 마지막 시간 저장 (time-base 모드용) let lastSignalTimes = {};
let plotMode = 'line'; // ★ 'line' | 'scatter'
const COLORS = [ const COLORS = [
{line: '#FF6384', fill: 'rgba(255, 99, 132, 0.2)'}, {line: '#FF6384', fill: 'rgba(255, 99, 132, 0.2)'},
@@ -334,10 +361,13 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
resizeCanvas() { resizeCanvas() {
const rect = this.canvas.getBoundingClientRect(); const rect = this.canvas.getBoundingClientRect();
this.canvas.width = rect.width * window.devicePixelRatio; if (rect.width === 0) return;
this.canvas.height = rect.height * window.devicePixelRatio; const dpr = window.devicePixelRatio || 1;
this.ctx.scale(window.devicePixelRatio, window.devicePixelRatio); this.canvas.width = rect.width * dpr;
this.width = rect.width; this.canvas.height = rect.height * dpr;
// ★ 버그수정: scale() 누적 → setTransform() 으로 항상 초기화
this.ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
this.width = rect.width;
this.height = rect.height; this.height = rect.height;
this.draw(); this.draw();
} }
@@ -380,127 +410,170 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
} }
draw() { draw() {
if (this.data.length === 0) return;
const ctx = this.ctx; const ctx = this.ctx;
const padding = 40; const W = this.width, H = this.height;
const graphWidth = this.width - padding * 2; if (!W || !H) return;
const graphHeight = this.height - padding * 2;
ctx.fillStyle = '#1a1a1a'; const PAD_L = 52, PAD_R = 8, PAD_T = 12, PAD_B = 28;
ctx.fillRect(0, 0, this.width, this.height); const gW = W - PAD_L - PAD_R;
const gH = H - PAD_T - PAD_B;
let displayData = []; // 배경
let displayTimes = []; ctx.fillStyle = '#111827';
let displayLabels = []; ctx.fillRect(0, 0, W, H);
if (rangeMode === '10s') { // ★ 빈 데이터 상태 표시
const currentTime = parseFloat(this.times[this.times.length - 1]); if (this.data.length === 0) {
ctx.fillStyle = '#374151';
ctx.font = '12px monospace';
ctx.textAlign = 'center';
ctx.fillText('Waiting for data...', W / 2, H / 2);
return;
}
// ── 표시할 데이터 슬라이스 계산 ──
let displayData = [], displayTimes = [], displayLabels = [];
const windowSec = rangeMode === '30s' ? 30 : 10;
if (rangeMode === 'all') {
displayData = [...this.data];
displayTimes = [...this.times];
displayLabels = [...this.labels];
} else if (scaleMode === 'time') {
// time 모드: 시간 기준으로 window 필터
const latest = this.times[this.times.length - 1];
const cutoff = latest - windowSec;
for (let i = 0; i < this.times.length; i++) { for (let i = 0; i < this.times.length; i++) {
if (currentTime - parseFloat(this.times[i]) <= 10) { if (this.times[i] >= cutoff) {
displayData.push(this.data[i]); displayData.push(this.data[i]);
displayTimes.push(this.times[i]); displayTimes.push(this.times[i]);
displayLabels.push(this.labels[i]); displayLabels.push(this.labels[i]);
} }
} }
} else { } else {
displayData = [...this.data]; // ★ index 모드: 최근 N개만 표시
displayTimes = [...this.times]; const N = rangeMode === '30s' ? 150 : 60;
displayLabels = [...this.labels]; const start = Math.max(0, this.data.length - N);
displayData = this.data.slice(start);
displayTimes = this.times.slice(start);
displayLabels = this.labels.slice(start);
} }
if (displayData.length === 0) return; if (displayData.length === 0) return;
const minValue = Math.min(...displayData); const minValue = Math.min(...displayData);
const maxValue = Math.max(...displayData); const maxValue = Math.max(...displayData);
const range = maxValue - minValue || 1; const range = maxValue - minValue || 1;
let minTime, maxTime, timeRange; // ── Y 그리드 ──
if (scaleMode === 'time') { const GRID_Y = 4;
minTime = parseFloat(displayTimes[0]); ctx.lineWidth = 0.5;
maxTime = parseFloat(displayTimes[displayTimes.length - 1]); for (let i = 0; i <= GRID_Y; i++) {
timeRange = maxTime - minTime || 1; const y = PAD_T + (gH / GRID_Y) * i;
ctx.strokeStyle = (i === GRID_Y) ? '#2d3748' : '#1a2035';
ctx.beginPath(); ctx.moveTo(PAD_L, y); ctx.lineTo(PAD_L + gW, y); ctx.stroke();
// Y 라벨
const v = maxValue - (range / GRID_Y) * i;
let label = '';
if (this.signal.valueTable) {
const rv = Math.round(v);
label = (this.signal.valueTable[rv] !== undefined)
? String(this.signal.valueTable[rv]).substring(0, 7)
: v.toFixed(1);
} else {
label = Math.abs(v) < 100 ? v.toFixed(2) : v.toFixed(0);
}
ctx.fillStyle = '#6b7280';
ctx.font = '9px monospace';
ctx.textAlign = 'right';
ctx.fillText(label, PAD_L - 3, y + 3);
} }
ctx.strokeStyle = '#888'; // ── X 그리드 ──
ctx.lineWidth = 2; for (let i = 0; i <= 4; i++) {
const x = PAD_L + (gW / 4) * i;
ctx.strokeStyle = '#1a2035';
ctx.lineWidth = 0.5;
ctx.beginPath(); ctx.moveTo(x, PAD_T); ctx.lineTo(x, PAD_T + gH); ctx.stroke();
}
// ── 축선 ──
ctx.strokeStyle = '#2d3748';
ctx.lineWidth = 1;
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(padding, padding); ctx.moveTo(PAD_L, PAD_T);
ctx.lineTo(padding, this.height - padding); ctx.lineTo(PAD_L, PAD_T + gH);
ctx.lineTo(this.width - padding, this.height - padding); ctx.lineTo(PAD_L + gW, PAD_T + gH);
ctx.stroke(); ctx.stroke();
ctx.fillStyle = '#ccc'; // ── 좌표 변환 함수 ──
ctx.font = '11px Arial'; let minTime, timeRange;
ctx.textAlign = 'right'; if (scaleMode === 'time' && displayTimes.length > 1) {
minTime = displayTimes[0];
if (this.signal.valueTable) { timeRange = displayTimes[displayTimes.length - 1] - minTime || 1;
const uniqueValues = [...new Set(displayData)].sort((a, b) => a - b);
if (uniqueValues.length <= 5) {
uniqueValues.forEach((val, idx) => {
const y = this.height - padding - ((val - minValue) / range) * graphHeight;
const text = this.getValueText(val);
ctx.fillText(text, padding - 5, y + 5);
});
} else {
ctx.fillText(this.getValueText(maxValue), padding - 5, padding + 5);
ctx.fillText(this.getValueText(minValue), padding - 5, this.height - padding);
}
} else {
ctx.fillText(maxValue.toFixed(2), padding - 5, padding + 5);
ctx.fillText(minValue.toFixed(2), padding - 5, this.height - padding);
} }
const xOf = (i) => {
ctx.textAlign = 'center'; if (scaleMode === 'time' && displayTimes.length > 1) {
ctx.fillStyle = '#ccc'; return PAD_L + ((displayTimes[i] - minTime) / timeRange) * gW;
ctx.font = '10px Arial';
if (displayLabels.length > 0) {
ctx.fillText(displayLabels[0] + 's', padding, this.height - padding + 15);
if (displayLabels.length > 1) {
const lastIdx = displayLabels.length - 1;
let xPos;
if (scaleMode === 'time') {
xPos = this.width - padding;
} else {
xPos = padding + (graphWidth / (MAX_DATA_POINTS - 1)) * Math.min(lastIdx, MAX_DATA_POINTS - 1);
}
ctx.fillText(displayLabels[lastIdx] + 's', xPos, this.height - padding + 15);
} }
} // ★ 버그수정: MAX_DATA_POINTS 고정값 대신 실제 표시 데이터 개수 사용
ctx.fillText('Time (sec)', this.width / 2, this.height - 5); return PAD_L + (displayData.length > 1 ? (i / (displayData.length - 1)) * gW : 0);
};
const yOf = (v) => PAD_T + gH - ((v - minValue) / range) * gH;
ctx.strokeStyle = '#444'; const lineColor = this.colors.line;
ctx.lineWidth = 1;
for (let i = 1; i < 5; i++) { // ── Fill 영역 ──
const y = padding + (graphHeight / 5) * i; ctx.beginPath();
ctx.moveTo(xOf(0), PAD_T + gH);
for (let i = 0; i < displayData.length; i++) ctx.lineTo(xOf(i), yOf(displayData[i]));
ctx.lineTo(xOf(displayData.length - 1), PAD_T + gH);
ctx.closePath();
// fill 색상: line 색에 알파 추가
ctx.fillStyle = this.colors.fill;
ctx.fill();
// ── Line 또는 Scatter ──
if (plotMode === 'line' && displayData.length > 1) {
// ★ 라인 그리기
ctx.strokeStyle = lineColor;
ctx.lineWidth = 1.8;
ctx.lineJoin = 'round';
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(padding, y); ctx.moveTo(xOf(0), yOf(displayData[0]));
ctx.lineTo(this.width - padding, y); for (let i = 1; i < displayData.length; i++) {
ctx.lineTo(xOf(i), yOf(displayData[i]));
}
ctx.stroke(); ctx.stroke();
} }
if (displayData.length < 1) return; // 점 그리기
ctx.fillStyle = this.colors.line;
for (let i = 0; i < displayData.length; i++) { for (let i = 0; i < displayData.length; i++) {
let x; const isLast = (i === displayData.length - 1);
if (plotMode === 'scatter' || isLast) {
if (scaleMode === 'time') { const r = isLast ? 4.5 : 2.5;
const timePos = (parseFloat(displayTimes[i]) - minTime) / timeRange; ctx.fillStyle = isLast ? '#ffffff' : lineColor;
x = padding + graphWidth * timePos; ctx.strokeStyle = lineColor;
} else { ctx.lineWidth = isLast ? 1.5 : 0;
x = padding + (graphWidth / (MAX_DATA_POINTS - 1)) * i; ctx.beginPath();
ctx.arc(xOf(i), yOf(displayData[i]), r, 0, Math.PI * 2);
ctx.fill();
if (isLast) ctx.stroke();
} }
}
const y = this.height - padding - ((displayData[i] - minValue) / range) * graphHeight; // ── X 라벨 ──
ctx.fillStyle = '#6b7280';
ctx.beginPath(); ctx.font = '9px monospace';
ctx.arc(x, y, 5, 0, Math.PI * 2); ctx.textAlign = 'center';
ctx.fill(); if (displayLabels.length > 0) {
ctx.fillText(displayLabels[0] + 's', PAD_L, PAD_T + gH + 16);
ctx.strokeStyle = '#fff'; ctx.fillText(displayLabels[displayLabels.length-1] + 's', PAD_L + gW, PAD_T + gH + 16);
ctx.lineWidth = 1; if (displayLabels.length > 4) {
ctx.stroke(); const mid = Math.floor(displayLabels.length / 2);
ctx.fillText(displayLabels[mid] + 's', PAD_L + gW * 0.5, PAD_T + gH + 16);
}
} }
} }
} }
@@ -542,9 +615,10 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
} }
function updateStatus(text, isError) { function updateStatus(text, isError) {
const status = document.getElementById('status'); const el = document.getElementById('status-pill');
status.textContent = text; if (!el) return;
status.className = 'status' + (isError ? ' disconnected' : ''); el.textContent = text;
el.className = 'status' + (isError ? ' disconnected' : '');
} }
function loadData() { function loadData() {
@@ -605,13 +679,61 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
function setSortMode(mode) { function setSortMode(mode) {
sortMode = mode; sortMode = mode;
document.querySelectorAll('[id^="btn-sort-"]').forEach(btn => btn.classList.remove('active')); document.querySelectorAll('[id^="btn-sort-"]').forEach(btn => btn.classList.remove('active'));
document.getElementById('btn-sort-' + mode).classList.add('active'); document.getElementById('btn-sort-' + mode).classList.add('active');
createGraphs(); // ★ 버그수정: createGraphs() 호출 시 데이터 초기화 문제
// → 기존 차트 데이터를 보존한 채로 DOM 순서만 재배열
const graphsDiv = document.getElementById('graphs');
const oldCharts = Object.assign({}, charts);
const origSignals = [...selectedSignals];
const sorted = sortSignalsForDisplay();
console.log('Sort mode changed to:', mode); graphsDiv.innerHTML = '';
charts = {};
sorted.forEach((signal, newIdx) => {
const origIdx = origSignals.findIndex(s =>
s.name === signal.name && s.messageId === signal.messageId);
const container = document.createElement('div');
container.className = 'graph-container';
const canvas = document.createElement('canvas');
canvas.id = 'chart-' + newIdx;
container.innerHTML =
'<div class="graph-header">' +
'<div class="graph-title">' + signal.name +
' <span style="color:#6b7280;font-size:0.85em;">(0x' + signal.messageId.toString(16).toUpperCase() + ')</span>' +
(signal.unit ? ' <span style="color:#6b7280;font-size:0.85em;">[' + signal.unit + ']</span>' : '') + '</div>' +
'<div class="graph-value" id="value-' + newIdx + '">-</div>' +
'</div>';
container.appendChild(canvas);
graphsDiv.appendChild(container);
const chart = new SimpleChart(canvas, signal, newIdx);
// 기존 데이터 복사
if (origIdx !== -1 && oldCharts[origIdx]) {
chart.data = [...oldCharts[origIdx].data];
chart.times = [...oldCharts[origIdx].times];
chart.labels = [...oldCharts[origIdx].labels];
chart.rawValues = [...(oldCharts[origIdx].rawValues || [])];
chart.currentValue = oldCharts[origIdx].currentValue;
chart.currentText = oldCharts[origIdx].currentText;
}
charts[newIdx] = chart;
chart.draw();
// 현재 값 표시 복원
const vEl = document.getElementById('value-' + newIdx);
if (vEl && chart.currentValue !== undefined && chart.currentValue !== null) {
if (chart.currentText) {
vEl.textContent = chart.currentText;
} else {
vEl.textContent = chart.currentValue.toFixed(2) + (signal.unit ? ' ' + signal.unit : '');
}
}
});
console.log('Sort mode changed to:', mode, '(data preserved)');
} }
function createGraphs() { function createGraphs() {
@@ -630,8 +752,9 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
container.innerHTML = container.innerHTML =
'<div class="graph-header">' + '<div class="graph-header">' +
'<div class="graph-title">' + signal.name + ' (0x' + signal.messageId.toString(16).toUpperCase() + ')' + '<div class="graph-title">' + signal.name +
(signal.unit ? ' [' + signal.unit + ']' : '') + '</div>' + ' <span style="color:#6b7280;font-size:0.85em;">(0x' + signal.messageId.toString(16).toUpperCase() + ')</span>' +
(signal.unit ? ' <span style="color:#6b7280;font-size:0.85em;">[' + signal.unit + ']</span>' : '') + '</div>' +
'<div class="graph-value" id="value-' + index + '">-</div>' + '<div class="graph-value" id="value-' + index + '">-</div>' +
'</div>'; '</div>';
@@ -646,40 +769,44 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
function startGraphing() { function startGraphing() {
if (!graphing) { if (!graphing) {
graphing = true; graphing = true;
startTime = Date.now(); startTime = Date.now();
lastTimestamps = {}; lastTimestamps = {};
updateStatus('Graphing...', false); document.getElementById('btn-start').classList.add('active');
console.log('Started graphing at', new Date().toISOString()); document.getElementById('btn-stop').classList.remove('active');
updateStatus('Recording', false);
} }
} }
function stopGraphing() { function stopGraphing() {
graphing = false; graphing = false;
updateStatus('Stopped', false); document.getElementById('btn-start').classList.remove('active');
console.log('Stopped graphing'); document.getElementById('btn-stop').classList.add('active');
updateStatus('Paused', false);
} }
function setScaleMode(mode) { function setScaleMode(mode) {
scaleMode = mode; scaleMode = mode;
document.getElementById('btn-index-mode').classList.toggle('active', mode === 'index'); document.getElementById('btn-index-mode').classList.toggle('active', mode === 'index');
document.getElementById('btn-time-mode').classList.toggle('active', mode === 'time'); document.getElementById('btn-time-mode').classList.toggle('active', mode === 'time');
Object.values(charts).forEach(chart => chart.draw()); Object.values(charts).forEach(chart => chart.draw());
console.log('Scale mode changed to:', mode);
} }
function setRangeMode(mode) { function setRangeMode(mode) {
rangeMode = mode; rangeMode = mode;
['10s','30s','all'].forEach(m => {
document.getElementById('btn-range-10s').classList.toggle('active', mode === '10s'); const el = document.getElementById('btn-range-' + m);
document.getElementById('btn-range-all').classList.toggle('active', mode === 'all'); if (el) el.classList.toggle('active', m === mode);
});
Object.values(charts).forEach(chart => chart.draw()); Object.values(charts).forEach(chart => chart.draw());
}
console.log('Range mode changed to:', mode); // ★ 신규: Plot 모드 전환 (line / scatter)
function setPlotMode(mode) {
plotMode = mode;
document.getElementById('btn-plot-line').classList.toggle('active', mode === 'line');
document.getElementById('btn-plot-scatter').classList.toggle('active', mode === 'scatter');
Object.values(charts).forEach(chart => chart.draw());
} }
// ★★★ 새로운 함수: update 타입 메시지 처리 // ★★★ 새로운 함수: update 타입 메시지 처리
@@ -1010,9 +1137,10 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
chart.draw(); chart.draw();
}); });
lastTimestamps = {}; lastTimestamps = {};
lastCanCounts = {}; // ★ count 기록도 초기화 lastCanCounts = {};
startTime = Date.now(); lastSignalTimes = {}; // ★ 버그수정: 시간 계산 리셋
startTime = Date.now();
totalMsgReceived = 0; totalMsgReceived = 0;
updateStatistics(); updateStatistics();

1219
index.h

File diff suppressed because it is too large Load Diff

View File

@@ -8,533 +8,279 @@ const char serial2_terminal_html[] PROGMEM = R"rawliteral(
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Serial2 Terminal - CAN Logger</title> <title>Serial2 Terminal - CAN Logger</title>
<style> <style>
* { :root {
margin: 0; --bg: #0e1117;
padding: 0; --panel: #161b24;
box-sizing: border-box; --card: #1c2230;
--border: #2d3748;
--accent: #43cea2;
--green: #3fb950;
--blue: #58a6ff;
--red: #f85149;
--yellow: #e3b341;
--purple: #bc8cff;
--text: #e6edf3;
--muted: #8b949e;
--r: 8px;
} }
* { margin:0; padding:0; box-sizing:border-box; }
html, body { min-height:100%; }
body { body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); background: var(--bg); color: var(--text);
min-height: 100vh; overflow-x: hidden; font-size: 14px;
padding: 20px;
}
.container {
max-width: 1200px;
margin: 0 auto;
background: rgba(255, 255, 255, 0.95);
border-radius: 15px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
overflow: hidden;
} }
/* Header */
.header { .header {
background: linear-gradient(135deg, #667eea, #764ba2); background: linear-gradient(135deg,#1a2744 0%,#1e1a3a 100%);
color: white; padding: 11px 16px; border-bottom: 1px solid var(--border);
padding: 20px 30px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 2px 10px rgba(0,0,0,0.2);
} }
.header h1 { .header h1 {
font-size: 1.8em; font-size: 1.0em; font-weight: 700; color: var(--accent);
display: flex; display: flex; align-items: center; gap: 8px;
align-items: center;
gap: 10px;
} }
.header p { font-size: 0.78em; color: var(--muted); margin:0; }
.badge { .badge {
background: rgba(255, 255, 255, 0.2); background: rgba(67,206,162,.15); color: var(--accent);
padding: 5px 12px; padding: 2px 8px; border-radius: 12px; font-size: 0.65em;
border-radius: 20px; font-weight: 600; border: 1px solid rgba(67,206,162,.3);
font-size: 0.5em;
font-weight: normal;
}
/* ========== 통일된 네비게이션 ========== */
.nav {
background: #f8f9fa;
padding: 0;
border-bottom: 2px solid #e0e0e0;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
.nav a {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 15px 20px;
text-decoration: none;
color: #666;
font-weight: 500;
font-size: 0.95em;
border-bottom: 3px solid transparent;
transition: all 0.3s;
white-space: nowrap; white-space: nowrap;
min-width: 120px; }
.header-spacer { flex:1; }
/* Nav */
.nav {
background: var(--panel); border-bottom: 1px solid var(--border);
display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch;
scrollbar-width: none;
}
.nav::-webkit-scrollbar { display:none; }
.nav a {
display: inline-flex; align-items: center;
padding: 10px 13px; text-decoration: none; color: var(--muted);
font-size: 0.78em; font-weight: 500;
border-bottom: 2px solid transparent; white-space: nowrap;
transition: color .2s, border-color .2s;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--accent); border-bottom-color: var(--accent); }
/* Content */
.content { padding: 12px; }
/* Headings */
h2 {
color: var(--accent); margin: 14px 0 10px;
font-size: 0.82em; font-weight: 700; text-transform: uppercase;
letter-spacing: .5px; padding-bottom: 6px;
border-bottom: 1px solid var(--border);
}
h3 {
color: var(--text); font-size: 0.85em; font-weight: 600;
margin-bottom: 10px; padding-bottom: 6px;
border-bottom: 1px solid var(--border);
} }
.nav a:hover { /* Buttons */
background: #e9ecef; .btn, button {
color: #667eea; padding: 6px 13px; border: 1px solid var(--border);
transform: translateY(-2px); border-radius: var(--r); background: var(--bg); color: var(--muted);
font-size: 0.8em; font-weight: 600; cursor: pointer;
font-family: inherit; transition: all .15s; white-space: nowrap;
-webkit-tap-highlight-color: transparent; touch-action: manipulation;
} }
.btn:hover, button:hover { border-color: var(--accent); color: var(--accent); }
.btn:active, button:active { transform: scale(.97); }
.btn-primary { border-color:var(--blue); color:var(--blue); }
.btn-success { border-color:var(--accent); color:var(--accent); }
.btn-danger { border-color:var(--red); color:var(--red); }
.btn-warning { border-color:var(--yellow); color:var(--yellow); }
.btn-secondary{ border-color:var(--muted); color:var(--muted); }
.btn-primary:hover { background:rgba(88,166,255,.10); }
.btn-success:hover { background:rgba(67,206,162,.10); }
.btn-danger:hover { background:rgba(248,81,73,.10); }
.btn-warning:hover { background:rgba(227,179,65,.10); }
.btn-secondary:hover{ background:rgba(139,148,158,.10); }
.btn-small { padding:4px 9px; font-size:.75em; }
.button-group, .btn-group { display:flex; gap:6px; flex-wrap:wrap; margin-top:10px; }
.nav a.active { /* Forms */
color: #764ba2; label {
border-bottom-color: #764ba2; display:block; font-weight:600; color:var(--muted);
background: white; margin-bottom:4px; font-size:.78em;
font-weight: 600; text-transform:uppercase; letter-spacing:.3px;
} }
input[type="text"], input[type="password"], input[type="number"],
.content { select, textarea {
padding: 30px; width:100%; padding:7px 10px;
border:1px solid var(--border); border-radius:var(--r);
font-size:.85em; font-family:inherit;
background:var(--bg); color:var(--text);
transition:border-color .2s;
} }
input:focus, select:focus, textarea:focus {
.control-panel { outline:none; border-color:var(--accent);
background: #f8f9fa; box-shadow:0 0 0 2px rgba(67,206,162,.10);
padding: 20px;
border-radius: 10px;
margin-bottom: 20px;
display: grid;
grid-template-columns: 1fr;
gap: 20px;
} }
input[type="checkbox"], input[type="radio"] {
.control-group { width:15px; height:15px; cursor:pointer; accent-color:var(--accent);
background: white;
padding: 15px;
border-radius: 8px;
border: 1px solid #e0e0e0;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
} }
select option { background:var(--panel); color:var(--text); }
.control-group.full-width { /* Panels */
grid-template-columns: 1fr; .section, .settings-section, .send-panel, .stats,
.control-panel, .auto-trigger-section {
background:var(--panel); border:1px solid var(--border);
border-radius:var(--r); padding:13px; margin-bottom:10px;
} }
.form-group { margin-bottom:12px; }
.control-section { .form-group:last-child { margin-bottom:0; }
display: flex; .help-text { font-size:.76em; color:var(--muted); margin-top:4px; line-height:1.4; }
flex-direction: column;
}
.control-group h3 {
color: #333;
margin-bottom: 15px;
font-size: 1.1em;
border-bottom: 2px solid #667eea;
padding-bottom: 8px;
}
.form-row { .form-row {
display: grid; display:grid;
grid-template-columns: 120px 1fr; grid-template-columns:repeat(auto-fit,minmax(min(100%,190px),1fr));
gap: 10px; gap:10px; margin-bottom:10px;
margin-bottom: 12px; }
align-items: center; .form-row label { text-transform:none; font-size:.78em; }
.checkbox-group, .checkbox-row {
display:flex; align-items:center; gap:8px;
margin-bottom:8px; padding:7px 10px;
background:var(--card); border-radius:6px; border:1px solid var(--border);
}
.checkbox-group label, .checkbox-row label {
text-transform:none; cursor:pointer; margin-bottom:0;
color:var(--text); font-size:.85em; letter-spacing:0;
} }
.form-row label { /* Alerts */
color: #555; .alert {
font-weight: 500; padding:9px 13px; border-radius:var(--r);
margin-bottom:10px; display:none;
align-items:center; gap:9px;
font-size:.83em; font-weight:600;
border:1px solid var(--border); background:var(--panel); color:var(--text);
} }
.alert.show { display:flex; }
.alert-success { border-color:rgba(67,206,162,.4); color:var(--accent); background:rgba(67,206,162,.07); }
.alert-info { border-color:rgba(88,166,255,.4); color:var(--blue); background:rgba(88,166,255,.07); }
.alert-warning { border-color:rgba(227,179,65,.4); color:var(--yellow); background:rgba(227,179,65,.07); }
.alert-icon { font-size:1.15em; }
.alert-text { flex:1; }
@keyframes slideDown { from{opacity:0;transform:translateY(-6px);}to{opacity:1;transform:translateY(0);} }
.checkbox-row { /* Connection status */
display: flex; .connection-status {
align-items: center; position:fixed; top:10px; right:10px;
gap: 10px; padding:4px 11px; border-radius:20px;
margin-top: 12px; font-size:.75em; font-weight:600; z-index:1000;
padding: 10px; border:1px solid var(--border); background:var(--panel); color:var(--muted);
background: #f8f9fa;
border-radius: 5px;
} }
.connection-status.connected { border-color:rgba(67,206,162,.5); color:var(--accent); background:rgba(67,206,162,.08); }
.connection-status.disconnected { border-color:rgba(248,81,73,.5); color:var(--red); background:rgba(248,81,73,.08); }
.checkbox-row input[type="checkbox"] { @media (max-width:480px) { .content{padding:8px;} h2{font-size:.78em;} }
width: 18px;
height: 18px; /* serial terminal specific */
cursor: pointer; .control-panel {
background:var(--panel); border:1px solid var(--border);
border-radius:var(--r); padding:13px; margin-bottom:10px;
} }
.control-group {
.checkbox-row label { background:var(--card); border:1px solid var(--border);
color: #555; border-radius:var(--r); padding:12px;
font-weight: 500; display:grid; grid-template-columns:1fr 1fr; gap:16px;
cursor: pointer;
} }
@media(max-width:600px){ .control-group{ grid-template-columns:1fr; } }
select, input[type="text"], input[type="number"] { .control-group.full-width { grid-template-columns:1fr; }
padding: 8px 12px; .control-group h3 { grid-column:1/-1; color:var(--accent); font-size:.85em; border-color:var(--border); }
border: 1px solid #ddd; .control-section { display:flex; flex-direction:column; }
border-radius: 5px; .form-row { grid-template-columns:110px 1fr; align-items:center; gap:8px; }
font-size: 14px; .form-row label { text-transform:none; color:var(--muted); font-size:.80em; margin-bottom:0; }
width: 100%; /* Terminal */
}
select:focus, input:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.btn-group {
display: flex;
gap: 10px;
margin-top: 15px;
}
.btn {
flex: 1;
padding: 12px;
border: none;
border-radius: 8px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.btn:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.btn-primary {
background: linear-gradient(135deg, #667eea, #764ba2);
color: white;
}
.btn-success {
background: linear-gradient(135deg, #11998e, #38ef7d);
color: white;
}
.btn-danger {
background: linear-gradient(135deg, #eb3349, #f45c43);
color: white;
}
.btn-secondary {
background: #6c757d;
color: white;
}
.terminal-container { .terminal-container {
background: #1e1e1e; background:#090d13; border:1px solid var(--border); border-radius:var(--r); overflow:hidden;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 5px 20px rgba(0,0,0,0.3);
} }
.terminal-header { .terminal-header {
background: #2d2d2d; background:var(--panel); padding:8px 12px;
padding: 10px 15px; display:flex; justify-content:space-between; align-items:center;
display: flex; border-bottom:1px solid var(--border);
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #444;
} }
.terminal-title { color:var(--muted); font-size:.78em; font-weight:500; }
.terminal-title { .terminal-controls { display:flex; gap:6px; }
color: #ccc;
font-size: 13px;
font-weight: 500;
}
.terminal-controls {
display: flex;
gap: 8px;
}
.terminal-btn { .terminal-btn {
padding: 4px 12px; padding:3px 10px; border:1px solid var(--border); border-radius:4px;
border: none; font-size:.75em; cursor:pointer; background:var(--bg); color:var(--muted);
border-radius: 4px; transition:all .15s; font-family:inherit;
font-size: 12px;
cursor: pointer;
background: #444;
color: #ccc;
transition: all 0.2s;
} }
.terminal-btn:hover { border-color:var(--accent); color:var(--accent); }
.terminal-btn:hover {
background: #555;
}
.terminal { .terminal {
height: 400px; height:380px; overflow-y:auto; padding:12px;
overflow-y: auto; font-family:'SF Mono','Fira Code','Courier New',monospace;
padding: 15px; font-size:12px; line-height:1.55; color:#c9d1d9; background:#090d13;
font-family: 'Courier New', monospace;
font-size: 13px;
line-height: 1.5;
color: #f0f0f0;
} }
.terminal.teraterm-mode { height:330px; }
.terminal.teraterm-mode { .terminal::-webkit-scrollbar { width:5px; }
height: 350px; .terminal::-webkit-scrollbar-track { background:#0d1117; }
padding-bottom: 5px; .terminal::-webkit-scrollbar-thumb { background:#30363d; border-radius:3px; }
} .terminal::-webkit-scrollbar-thumb:hover { background:#484f58; }
.terminal-input-area { .terminal-input-area {
display: none; display:none; background:var(--panel); padding:8px 12px;
background: #2d2d2d; border-top:1px solid var(--border);
padding: 10px 15px;
border-top: 1px solid #444;
} }
.terminal-input-area.active { display:flex; align-items:center; gap:8px; }
.terminal-input-area.active { .terminal-input-area .prompt { color:var(--accent); font-family:monospace; font-size:.82em; }
display: flex;
align-items: center;
gap: 10px;
}
.terminal-input-area .prompt {
color: #4fc3f7;
font-family: 'Courier New', monospace;
font-size: 13px;
}
.terminal-input-area input { .terminal-input-area input {
flex: 1; flex:1; background:var(--bg); border:1px solid var(--border);
background: #1e1e1e; color:var(--text); padding:5px 8px;
border: 1px solid #444; font-family:monospace; font-size:.82em; border-radius:4px;
color: #f0f0f0;
padding: 6px 10px;
font-family: 'Courier New', monospace;
font-size: 13px;
border-radius: 3px;
} }
.terminal-input-area input:focus { outline:none; border-color:var(--accent); }
.terminal-input-area input:focus { /* Log line colors */
outline: none; .line { margin-bottom:3px; font-family:monospace; }
border-color: #667eea; .timestamp { color:#484f58; margin-right:8px; }
box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2); .rx { color:#79c0ff; }
} .tx { color:#7ee787; }
/* Modbus */
.terminal::-webkit-scrollbar {
width: 10px;
}
.terminal::-webkit-scrollbar-track {
background: #2d2d2d;
}
.terminal::-webkit-scrollbar-thumb {
background: #555;
border-radius: 5px;
}
.terminal::-webkit-scrollbar-thumb:hover {
background: #666;
}
.line {
margin-bottom: 5px;
font-family: 'Courier New', monospace;
}
.timestamp {
color: #888;
margin-right: 10px;
}
.rx {
color: #4fc3f7;
}
.tx {
color: #81c784;
}
/* Modbus 파싱 스타일 */
.modbus-frame { .modbus-frame {
display: inline-block; display:inline-block; padding:4px 8px; margin:3px 0;
padding: 5px 10px; background:var(--card); border-radius:4px; border-left:2px solid var(--blue);
margin: 5px 0;
background: #2a2a2a;
border-radius: 5px;
border-left: 3px solid #667eea;
} }
.modbus-addr { color:var(--yellow); font-weight:bold; }
.modbus-addr { .modbus-func { color:var(--accent); font-weight:bold; }
color: #ffd54f; .modbus-data { color:#79c0ff; }
font-weight: bold; .modbus-crc { color:#ffa657; }
} .modbus-label { color:var(--muted); font-size:.85em; margin-left:4px; }
.modbus-error { color:var(--red); }
.modbus-func { /* Send / Stats */
color: #81c784; .send-panel { margin-top:10px; }
font-weight: bold; .send-panel h3, .stats h3 { color:var(--accent); border-color:var(--border); }
} .send-controls { display:flex; gap:8px; align-items:center; }
.send-controls input { flex:1; }
.modbus-data { .stats { margin-top:10px; }
color: #4fc3f7;
}
.modbus-crc {
color: #ff8a65;
}
.modbus-label {
color: #aaa;
font-size: 11px;
margin-left: 5px;
}
.modbus-error {
color: #f44336;
}
.send-panel {
background: white;
padding: 15px;
border-radius: 8px;
margin-top: 20px;
border: 1px solid #e0e0e0;
}
.send-panel h3 {
color: #333;
margin-bottom: 15px;
font-size: 1.1em;
border-bottom: 2px solid #667eea;
padding-bottom: 8px;
}
.send-controls {
display: flex;
gap: 10px;
align-items: center;
}
.send-controls input {
flex: 1;
}
.stats {
background: white;
padding: 15px;
border-radius: 8px;
margin-top: 20px;
border: 1px solid #e0e0e0;
}
.stats h3 {
color: #333;
margin-bottom: 15px;
font-size: 1.1em;
border-bottom: 2px solid #667eea;
padding-bottom: 8px;
}
.stat-grid { .stat-grid {
display: grid; display:grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); grid-template-columns:repeat(auto-fit,minmax(min(100%,120px),1fr));
gap: 15px; gap:8px;
} }
.stat-item { .stat-item {
text-align: center; text-align:center; padding:11px; background:var(--card);
padding: 15px; border-radius:var(--r); border:1px solid var(--border);
background: #f8f9fa;
border-radius: 8px;
}
.stat-value {
font-size: 24px;
font-weight: bold;
color: #667eea;
margin-bottom: 5px;
}
.stat-label {
font-size: 12px;
color: #666;
text-transform: uppercase;
}
/* ========== 반응형 디자인 ========== */
@media (max-width: 768px) {
body {
padding: 5px;
}
.container {
border-radius: 10px;
}
.header {
padding: 15px;
flex-direction: column;
text-align: center;
gap: 10px;
}
.header h1 {
font-size: 1.4em;
}
.nav {
padding: 5px;
}
.nav a {
padding: 12px 15px;
font-size: 0.85em;
}
.content {
padding: 15px;
}
.btn {
padding: 10px 20px;
font-size: 13px;
}
}
@media (min-width: 769px) and (max-width: 1024px) {
.header h1 {
font-size: 1.6em;
}
.nav a {
padding: 13px 18px;
font-size: 0.9em;
}
.content {
padding: 25px;
}
}
@media (min-width: 1025px) {
.content {
padding: 30px;
}
} }
.stat-value { font-size:1.4em; font-weight:bold; color:var(--accent); margin-bottom:3px; font-family:monospace; }
.stat-label { font-size:.70em; color:var(--muted); text-transform:uppercase; letter-spacing:.5px; }
</style> </style>
</head> </head>
<body> <body>
<div class="container"> <div class="header">
<div class="header">
<h1> <h1>
📟 Serial2 Terminal 📟 Serial2 Terminal
<span class="badge">GPIO 6/7</span> <span class="badge">GPIO 6/7</span>
</h1> </h1>
</div> </div>
<div class="nav"> <div class="nav">
<a href="/">📊 Monitor</a> <a href="/">📊 Monitor</a>
<a href="/transmit">📤 Transmit</a> <a href="/transmit">📤 Transmit</a>
<a href="/graph">📈 Graph</a> <a href="/graph">📈 Graph</a>
@@ -544,7 +290,7 @@ const char serial2_terminal_html[] PROGMEM = R"rawliteral(
<a href="/serial2" class="active">📟 Serial2</a> <a href="/serial2" class="active">📟 Serial2</a>
</div> </div>
<div class="content"> <div class="content">
<div class="control-panel"> <div class="control-panel">
<div class="control-group"> <div class="control-group">
<div class="control-section"> <div class="control-section">

View File

@@ -8,533 +8,279 @@ const char serial_terminal_html[] PROGMEM = R"rawliteral(
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Serial1 Terminal - CAN Logger</title> <title>Serial1 Terminal - CAN Logger</title>
<style> <style>
* { :root {
margin: 0; --bg: #0e1117;
padding: 0; --panel: #161b24;
box-sizing: border-box; --card: #1c2230;
--border: #2d3748;
--accent: #43cea2;
--green: #3fb950;
--blue: #58a6ff;
--red: #f85149;
--yellow: #e3b341;
--purple: #bc8cff;
--text: #e6edf3;
--muted: #8b949e;
--r: 8px;
} }
* { margin:0; padding:0; box-sizing:border-box; }
html, body { min-height:100%; }
body { body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); background: var(--bg); color: var(--text);
min-height: 100vh; overflow-x: hidden; font-size: 14px;
padding: 20px;
}
.container {
max-width: 1200px;
margin: 0 auto;
background: rgba(255, 255, 255, 0.95);
border-radius: 15px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
overflow: hidden;
} }
/* Header */
.header { .header {
background: linear-gradient(135deg, #667eea, #764ba2); background: linear-gradient(135deg,#1a2744 0%,#1e1a3a 100%);
color: white; padding: 11px 16px; border-bottom: 1px solid var(--border);
padding: 20px 30px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 2px 10px rgba(0,0,0,0.2);
} }
.header h1 { .header h1 {
font-size: 1.8em; font-size: 1.0em; font-weight: 700; color: var(--accent);
display: flex; display: flex; align-items: center; gap: 8px;
align-items: center;
gap: 10px;
} }
.header p { font-size: 0.78em; color: var(--muted); margin:0; }
.badge { .badge {
background: rgba(255, 255, 255, 0.2); background: rgba(67,206,162,.15); color: var(--accent);
padding: 5px 12px; padding: 2px 8px; border-radius: 12px; font-size: 0.65em;
border-radius: 20px; font-weight: 600; border: 1px solid rgba(67,206,162,.3);
font-size: 0.5em;
font-weight: normal;
}
/* ========== 통일된 네비게이션 ========== */
.nav {
background: #f8f9fa;
padding: 0;
border-bottom: 2px solid #e0e0e0;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
.nav a {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 15px 20px;
text-decoration: none;
color: #666;
font-weight: 500;
font-size: 0.95em;
border-bottom: 3px solid transparent;
transition: all 0.3s;
white-space: nowrap; white-space: nowrap;
min-width: 120px; }
.header-spacer { flex:1; }
/* Nav */
.nav {
background: var(--panel); border-bottom: 1px solid var(--border);
display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch;
scrollbar-width: none;
}
.nav::-webkit-scrollbar { display:none; }
.nav a {
display: inline-flex; align-items: center;
padding: 10px 13px; text-decoration: none; color: var(--muted);
font-size: 0.78em; font-weight: 500;
border-bottom: 2px solid transparent; white-space: nowrap;
transition: color .2s, border-color .2s;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--accent); border-bottom-color: var(--accent); }
/* Content */
.content { padding: 12px; }
/* Headings */
h2 {
color: var(--accent); margin: 14px 0 10px;
font-size: 0.82em; font-weight: 700; text-transform: uppercase;
letter-spacing: .5px; padding-bottom: 6px;
border-bottom: 1px solid var(--border);
}
h3 {
color: var(--text); font-size: 0.85em; font-weight: 600;
margin-bottom: 10px; padding-bottom: 6px;
border-bottom: 1px solid var(--border);
} }
.nav a:hover { /* Buttons */
background: #e9ecef; .btn, button {
color: #667eea; padding: 6px 13px; border: 1px solid var(--border);
transform: translateY(-2px); border-radius: var(--r); background: var(--bg); color: var(--muted);
font-size: 0.8em; font-weight: 600; cursor: pointer;
font-family: inherit; transition: all .15s; white-space: nowrap;
-webkit-tap-highlight-color: transparent; touch-action: manipulation;
} }
.btn:hover, button:hover { border-color: var(--accent); color: var(--accent); }
.btn:active, button:active { transform: scale(.97); }
.btn-primary { border-color:var(--blue); color:var(--blue); }
.btn-success { border-color:var(--accent); color:var(--accent); }
.btn-danger { border-color:var(--red); color:var(--red); }
.btn-warning { border-color:var(--yellow); color:var(--yellow); }
.btn-secondary{ border-color:var(--muted); color:var(--muted); }
.btn-primary:hover { background:rgba(88,166,255,.10); }
.btn-success:hover { background:rgba(67,206,162,.10); }
.btn-danger:hover { background:rgba(248,81,73,.10); }
.btn-warning:hover { background:rgba(227,179,65,.10); }
.btn-secondary:hover{ background:rgba(139,148,158,.10); }
.btn-small { padding:4px 9px; font-size:.75em; }
.button-group, .btn-group { display:flex; gap:6px; flex-wrap:wrap; margin-top:10px; }
.nav a.active { /* Forms */
color: #764ba2; label {
border-bottom-color: #764ba2; display:block; font-weight:600; color:var(--muted);
background: white; margin-bottom:4px; font-size:.78em;
font-weight: 600; text-transform:uppercase; letter-spacing:.3px;
} }
input[type="text"], input[type="password"], input[type="number"],
.content { select, textarea {
padding: 30px; width:100%; padding:7px 10px;
border:1px solid var(--border); border-radius:var(--r);
font-size:.85em; font-family:inherit;
background:var(--bg); color:var(--text);
transition:border-color .2s;
} }
input:focus, select:focus, textarea:focus {
.control-panel { outline:none; border-color:var(--accent);
background: #f8f9fa; box-shadow:0 0 0 2px rgba(67,206,162,.10);
padding: 20px;
border-radius: 10px;
margin-bottom: 20px;
display: grid;
grid-template-columns: 1fr;
gap: 20px;
} }
input[type="checkbox"], input[type="radio"] {
.control-group { width:15px; height:15px; cursor:pointer; accent-color:var(--accent);
background: white;
padding: 15px;
border-radius: 8px;
border: 1px solid #e0e0e0;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
} }
select option { background:var(--panel); color:var(--text); }
.control-group.full-width { /* Panels */
grid-template-columns: 1fr; .section, .settings-section, .send-panel, .stats,
.control-panel, .auto-trigger-section {
background:var(--panel); border:1px solid var(--border);
border-radius:var(--r); padding:13px; margin-bottom:10px;
} }
.form-group { margin-bottom:12px; }
.control-section { .form-group:last-child { margin-bottom:0; }
display: flex; .help-text { font-size:.76em; color:var(--muted); margin-top:4px; line-height:1.4; }
flex-direction: column;
}
.control-group h3 {
color: #333;
margin-bottom: 15px;
font-size: 1.1em;
border-bottom: 2px solid #667eea;
padding-bottom: 8px;
}
.form-row { .form-row {
display: grid; display:grid;
grid-template-columns: 120px 1fr; grid-template-columns:repeat(auto-fit,minmax(min(100%,190px),1fr));
gap: 10px; gap:10px; margin-bottom:10px;
margin-bottom: 12px; }
align-items: center; .form-row label { text-transform:none; font-size:.78em; }
.checkbox-group, .checkbox-row {
display:flex; align-items:center; gap:8px;
margin-bottom:8px; padding:7px 10px;
background:var(--card); border-radius:6px; border:1px solid var(--border);
}
.checkbox-group label, .checkbox-row label {
text-transform:none; cursor:pointer; margin-bottom:0;
color:var(--text); font-size:.85em; letter-spacing:0;
} }
.form-row label { /* Alerts */
color: #555; .alert {
font-weight: 500; padding:9px 13px; border-radius:var(--r);
margin-bottom:10px; display:none;
align-items:center; gap:9px;
font-size:.83em; font-weight:600;
border:1px solid var(--border); background:var(--panel); color:var(--text);
} }
.alert.show { display:flex; }
.alert-success { border-color:rgba(67,206,162,.4); color:var(--accent); background:rgba(67,206,162,.07); }
.alert-info { border-color:rgba(88,166,255,.4); color:var(--blue); background:rgba(88,166,255,.07); }
.alert-warning { border-color:rgba(227,179,65,.4); color:var(--yellow); background:rgba(227,179,65,.07); }
.alert-icon { font-size:1.15em; }
.alert-text { flex:1; }
@keyframes slideDown { from{opacity:0;transform:translateY(-6px);}to{opacity:1;transform:translateY(0);} }
.checkbox-row { /* Connection status */
display: flex; .connection-status {
align-items: center; position:fixed; top:10px; right:10px;
gap: 10px; padding:4px 11px; border-radius:20px;
margin-top: 12px; font-size:.75em; font-weight:600; z-index:1000;
padding: 10px; border:1px solid var(--border); background:var(--panel); color:var(--muted);
background: #f8f9fa;
border-radius: 5px;
} }
.connection-status.connected { border-color:rgba(67,206,162,.5); color:var(--accent); background:rgba(67,206,162,.08); }
.connection-status.disconnected { border-color:rgba(248,81,73,.5); color:var(--red); background:rgba(248,81,73,.08); }
.checkbox-row input[type="checkbox"] { @media (max-width:480px) { .content{padding:8px;} h2{font-size:.78em;} }
width: 18px;
height: 18px; /* serial terminal specific */
cursor: pointer; .control-panel {
background:var(--panel); border:1px solid var(--border);
border-radius:var(--r); padding:13px; margin-bottom:10px;
} }
.control-group {
.checkbox-row label { background:var(--card); border:1px solid var(--border);
color: #555; border-radius:var(--r); padding:12px;
font-weight: 500; display:grid; grid-template-columns:1fr 1fr; gap:16px;
cursor: pointer;
} }
@media(max-width:600px){ .control-group{ grid-template-columns:1fr; } }
select, input[type="text"], input[type="number"] { .control-group.full-width { grid-template-columns:1fr; }
padding: 8px 12px; .control-group h3 { grid-column:1/-1; color:var(--accent); font-size:.85em; border-color:var(--border); }
border: 1px solid #ddd; .control-section { display:flex; flex-direction:column; }
border-radius: 5px; .form-row { grid-template-columns:110px 1fr; align-items:center; gap:8px; }
font-size: 14px; .form-row label { text-transform:none; color:var(--muted); font-size:.80em; margin-bottom:0; }
width: 100%; /* Terminal */
}
select:focus, input:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.btn-group {
display: flex;
gap: 10px;
margin-top: 15px;
}
.btn {
flex: 1;
padding: 12px;
border: none;
border-radius: 8px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.btn:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.btn-primary {
background: linear-gradient(135deg, #667eea, #764ba2);
color: white;
}
.btn-success {
background: linear-gradient(135deg, #11998e, #38ef7d);
color: white;
}
.btn-danger {
background: linear-gradient(135deg, #eb3349, #f45c43);
color: white;
}
.btn-secondary {
background: #6c757d;
color: white;
}
.terminal-container { .terminal-container {
background: #1e1e1e; background:#090d13; border:1px solid var(--border); border-radius:var(--r); overflow:hidden;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 5px 20px rgba(0,0,0,0.3);
} }
.terminal-header { .terminal-header {
background: #2d2d2d; background:var(--panel); padding:8px 12px;
padding: 10px 15px; display:flex; justify-content:space-between; align-items:center;
display: flex; border-bottom:1px solid var(--border);
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #444;
} }
.terminal-title { color:var(--muted); font-size:.78em; font-weight:500; }
.terminal-title { .terminal-controls { display:flex; gap:6px; }
color: #ccc;
font-size: 13px;
font-weight: 500;
}
.terminal-controls {
display: flex;
gap: 8px;
}
.terminal-btn { .terminal-btn {
padding: 4px 12px; padding:3px 10px; border:1px solid var(--border); border-radius:4px;
border: none; font-size:.75em; cursor:pointer; background:var(--bg); color:var(--muted);
border-radius: 4px; transition:all .15s; font-family:inherit;
font-size: 12px;
cursor: pointer;
background: #444;
color: #ccc;
transition: all 0.2s;
} }
.terminal-btn:hover { border-color:var(--accent); color:var(--accent); }
.terminal-btn:hover {
background: #555;
}
.terminal { .terminal {
height: 400px; height:380px; overflow-y:auto; padding:12px;
overflow-y: auto; font-family:'SF Mono','Fira Code','Courier New',monospace;
padding: 15px; font-size:12px; line-height:1.55; color:#c9d1d9; background:#090d13;
font-family: 'Courier New', monospace;
font-size: 13px;
line-height: 1.5;
color: #f0f0f0;
} }
.terminal.teraterm-mode { height:330px; }
.terminal.teraterm-mode { .terminal::-webkit-scrollbar { width:5px; }
height: 350px; .terminal::-webkit-scrollbar-track { background:#0d1117; }
padding-bottom: 5px; .terminal::-webkit-scrollbar-thumb { background:#30363d; border-radius:3px; }
} .terminal::-webkit-scrollbar-thumb:hover { background:#484f58; }
.terminal-input-area { .terminal-input-area {
display: none; display:none; background:var(--panel); padding:8px 12px;
background: #2d2d2d; border-top:1px solid var(--border);
padding: 10px 15px;
border-top: 1px solid #444;
} }
.terminal-input-area.active { display:flex; align-items:center; gap:8px; }
.terminal-input-area.active { .terminal-input-area .prompt { color:var(--accent); font-family:monospace; font-size:.82em; }
display: flex;
align-items: center;
gap: 10px;
}
.terminal-input-area .prompt {
color: #4fc3f7;
font-family: 'Courier New', monospace;
font-size: 13px;
}
.terminal-input-area input { .terminal-input-area input {
flex: 1; flex:1; background:var(--bg); border:1px solid var(--border);
background: #1e1e1e; color:var(--text); padding:5px 8px;
border: 1px solid #444; font-family:monospace; font-size:.82em; border-radius:4px;
color: #f0f0f0;
padding: 6px 10px;
font-family: 'Courier New', monospace;
font-size: 13px;
border-radius: 3px;
} }
.terminal-input-area input:focus { outline:none; border-color:var(--accent); }
.terminal-input-area input:focus { /* Log line colors */
outline: none; .line { margin-bottom:3px; font-family:monospace; }
border-color: #667eea; .timestamp { color:#484f58; margin-right:8px; }
box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2); .rx { color:#79c0ff; }
} .tx { color:#7ee787; }
/* Modbus */
.terminal::-webkit-scrollbar {
width: 10px;
}
.terminal::-webkit-scrollbar-track {
background: #2d2d2d;
}
.terminal::-webkit-scrollbar-thumb {
background: #555;
border-radius: 5px;
}
.terminal::-webkit-scrollbar-thumb:hover {
background: #666;
}
.line {
margin-bottom: 5px;
font-family: 'Courier New', monospace;
}
.timestamp {
color: #888;
margin-right: 10px;
}
.rx {
color: #4fc3f7;
}
.tx {
color: #81c784;
}
/* Modbus 파싱 스타일 */
.modbus-frame { .modbus-frame {
display: inline-block; display:inline-block; padding:4px 8px; margin:3px 0;
padding: 5px 10px; background:var(--card); border-radius:4px; border-left:2px solid var(--blue);
margin: 5px 0;
background: #2a2a2a;
border-radius: 5px;
border-left: 3px solid #667eea;
} }
.modbus-addr { color:var(--yellow); font-weight:bold; }
.modbus-addr { .modbus-func { color:var(--accent); font-weight:bold; }
color: #ffd54f; .modbus-data { color:#79c0ff; }
font-weight: bold; .modbus-crc { color:#ffa657; }
} .modbus-label { color:var(--muted); font-size:.85em; margin-left:4px; }
.modbus-error { color:var(--red); }
.modbus-func { /* Send / Stats */
color: #81c784; .send-panel { margin-top:10px; }
font-weight: bold; .send-panel h3, .stats h3 { color:var(--accent); border-color:var(--border); }
} .send-controls { display:flex; gap:8px; align-items:center; }
.send-controls input { flex:1; }
.modbus-data { .stats { margin-top:10px; }
color: #4fc3f7;
}
.modbus-crc {
color: #ff8a65;
}
.modbus-label {
color: #aaa;
font-size: 11px;
margin-left: 5px;
}
.modbus-error {
color: #f44336;
}
.send-panel {
background: white;
padding: 15px;
border-radius: 8px;
margin-top: 20px;
border: 1px solid #e0e0e0;
}
.send-panel h3 {
color: #333;
margin-bottom: 15px;
font-size: 1.1em;
border-bottom: 2px solid #667eea;
padding-bottom: 8px;
}
.send-controls {
display: flex;
gap: 10px;
align-items: center;
}
.send-controls input {
flex: 1;
}
.stats {
background: white;
padding: 15px;
border-radius: 8px;
margin-top: 20px;
border: 1px solid #e0e0e0;
}
.stats h3 {
color: #333;
margin-bottom: 15px;
font-size: 1.1em;
border-bottom: 2px solid #667eea;
padding-bottom: 8px;
}
.stat-grid { .stat-grid {
display: grid; display:grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); grid-template-columns:repeat(auto-fit,minmax(min(100%,120px),1fr));
gap: 15px; gap:8px;
} }
.stat-item { .stat-item {
text-align: center; text-align:center; padding:11px; background:var(--card);
padding: 15px; border-radius:var(--r); border:1px solid var(--border);
background: #f8f9fa;
border-radius: 8px;
}
.stat-value {
font-size: 24px;
font-weight: bold;
color: #667eea;
margin-bottom: 5px;
}
.stat-label {
font-size: 12px;
color: #666;
text-transform: uppercase;
}
/* ========== 반응형 디자인 ========== */
@media (max-width: 768px) {
body {
padding: 5px;
}
.container {
border-radius: 10px;
}
.header {
padding: 15px;
flex-direction: column;
text-align: center;
gap: 10px;
}
.header h1 {
font-size: 1.4em;
}
.nav {
padding: 5px;
}
.nav a {
padding: 12px 15px;
font-size: 0.85em;
}
.content {
padding: 15px;
}
.btn {
padding: 10px 20px;
font-size: 13px;
}
}
@media (min-width: 769px) and (max-width: 1024px) {
.header h1 {
font-size: 1.6em;
}
.nav a {
padding: 13px 18px;
font-size: 0.9em;
}
.content {
padding: 25px;
}
}
@media (min-width: 1025px) {
.content {
padding: 30px;
}
} }
.stat-value { font-size:1.4em; font-weight:bold; color:var(--accent); margin-bottom:3px; font-family:monospace; }
.stat-label { font-size:.70em; color:var(--muted); text-transform:uppercase; letter-spacing:.5px; }
</style> </style>
</head> </head>
<body> <body>
<div class="container"> <div class="header">
<div class="header">
<h1> <h1>
📟 Serial1 Terminal 📟 Serial1 Terminal
<span class="badge">GPIO 17/18</span> <span class="badge">GPIO 17/18</span>
</h1> </h1>
</div> </div>
<div class="nav"> <div class="nav">
<a href="/">📊 Monitor</a> <a href="/">📊 Monitor</a>
<a href="/transmit">📤 Transmit</a> <a href="/transmit">📤 Transmit</a>
<a href="/graph">📈 Graph</a> <a href="/graph">📈 Graph</a>
@@ -544,7 +290,7 @@ const char serial_terminal_html[] PROGMEM = R"rawliteral(
<a href="/serial2">📟 Serial2</a> <a href="/serial2">📟 Serial2</a>
</div> </div>
<div class="content"> <div class="content">
<div class="control-panel"> <div class="control-panel">
<div class="control-group"> <div class="control-group">
<div class="control-section"> <div class="control-section">

View File

@@ -9,352 +9,211 @@ const char settings_html[] PROGMEM = R"rawliteral(
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Settings - Byun CAN Logger</title> <title>Settings - Byun CAN Logger</title>
<style> <style>
* { margin: 0; padding: 0; box-sizing: border-box; } :root {
--bg: #0e1117;
--panel: #161b24;
--card: #1c2230;
--border: #2d3748;
--accent: #43cea2;
--green: #3fb950;
--blue: #58a6ff;
--red: #f85149;
--yellow: #e3b341;
--purple: #bc8cff;
--text: #e6edf3;
--muted: #8b949e;
--r: 8px;
}
* { margin:0; padding:0; box-sizing:border-box; }
html, body { min-height:100%; }
body { body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); background: var(--bg); color: var(--text);
min-height: 100vh; overflow-x: hidden; font-size: 14px;
padding: 10px;
}
.container {
max-width: 800px;
margin: 0 auto;
background: white;
border-radius: 15px;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
overflow: hidden;
} }
/* Header */
.header { .header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); background: linear-gradient(135deg,#1a2744 0%,#1e1a3a 100%);
color: #666; padding: 11px 16px; border-bottom: 1px solid var(--border);
padding: 20px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
text-align: center;
} }
.header h1 { font-size: 1.8em; margin-bottom: 5px; } .header h1 {
.header p { opacity: 0.9; font-size: 0.9em; } font-size: 1.0em; font-weight: 700; color: var(--accent);
/* ========== 통일된 네비게이션 ========== */ display: flex; align-items: center; gap: 8px;
.nav {
background: #f8f9fa;
padding: 0;
border-bottom: 2px solid #e0e0e0;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
} }
.header p { font-size: 0.78em; color: var(--muted); margin:0; }
.nav a { .badge {
display: inline-flex; background: rgba(67,206,162,.15); color: var(--accent);
align-items: center; padding: 2px 8px; border-radius: 12px; font-size: 0.65em;
justify-content: center; font-weight: 600; border: 1px solid rgba(67,206,162,.3);
padding: 15px 20px;
text-decoration: none;
color: #666;
font-weight: 500;
font-size: 0.95em;
border-bottom: 3px solid transparent;
transition: all 0.3s;
white-space: nowrap; white-space: nowrap;
min-width: 120px; }
.header-spacer { flex:1; }
/* Nav */
.nav {
background: var(--panel); border-bottom: 1px solid var(--border);
display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch;
scrollbar-width: none;
}
.nav::-webkit-scrollbar { display:none; }
.nav a {
display: inline-flex; align-items: center;
padding: 10px 13px; text-decoration: none; color: var(--muted);
font-size: 0.78em; font-weight: 500;
border-bottom: 2px solid transparent; white-space: nowrap;
transition: color .2s, border-color .2s;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--accent); border-bottom-color: var(--accent); }
/* Content */
.content { padding: 12px; }
/* Headings */
h2 {
color: var(--accent); margin: 14px 0 10px;
font-size: 0.82em; font-weight: 700; text-transform: uppercase;
letter-spacing: .5px; padding-bottom: 6px;
border-bottom: 1px solid var(--border);
}
h3 {
color: var(--text); font-size: 0.85em; font-weight: 600;
margin-bottom: 10px; padding-bottom: 6px;
border-bottom: 1px solid var(--border);
} }
.nav a:hover { /* Buttons */
background: #e9ecef; .btn, button {
color: #667eea; padding: 6px 13px; border: 1px solid var(--border);
transform: translateY(-2px); border-radius: var(--r); background: var(--bg); color: var(--muted);
} font-size: 0.8em; font-weight: 600; cursor: pointer;
font-family: inherit; transition: all .15s; white-space: nowrap;
.nav a.active { -webkit-tap-highlight-color: transparent; touch-action: manipulation;
color: #764ba2;
border-bottom-color: #764ba2;
background: white;
font-weight: 600;
}
.content { padding: 30px; }
.settings-section {
background: #f8f9fa;
padding: 25px;
border-radius: 10px;
margin-bottom: 20px;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.section-title {
color: #333;
font-size: 1.3em;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 3px solid #667eea;
display: flex;
align-items: center;
gap: 10px;
}
.form-group {
margin-bottom: 20px;
}
.form-group:last-child {
margin-bottom: 0;
} }
.btn:hover, button:hover { border-color: var(--accent); color: var(--accent); }
.btn:active, button:active { transform: scale(.97); }
.btn-primary { border-color:var(--blue); color:var(--blue); }
.btn-success { border-color:var(--accent); color:var(--accent); }
.btn-danger { border-color:var(--red); color:var(--red); }
.btn-warning { border-color:var(--yellow); color:var(--yellow); }
.btn-secondary{ border-color:var(--muted); color:var(--muted); }
.btn-primary:hover { background:rgba(88,166,255,.10); }
.btn-success:hover { background:rgba(67,206,162,.10); }
.btn-danger:hover { background:rgba(248,81,73,.10); }
.btn-warning:hover { background:rgba(227,179,65,.10); }
.btn-secondary:hover{ background:rgba(139,148,158,.10); }
.btn-small { padding:4px 9px; font-size:.75em; }
.button-group, .btn-group { display:flex; gap:6px; flex-wrap:wrap; margin-top:10px; }
/* Forms */
label { label {
display: block; display:block; font-weight:600; color:var(--muted);
font-weight: 600; margin-bottom:4px; font-size:.78em;
color: #333; text-transform:uppercase; letter-spacing:.3px;
margin-bottom: 8px; }
font-size: 0.95em; input[type="text"], input[type="password"], input[type="number"],
} select, textarea {
width:100%; padding:7px 10px;
.help-text { border:1px solid var(--border); border-radius:var(--r);
font-size: 0.85em; font-size:.85em; font-family:inherit;
color: #666; background:var(--bg); color:var(--text);
margin-top: 5px; transition:border-color .2s;
line-height: 1.4; }
} input:focus, select:focus, textarea:focus {
outline:none; border-color:var(--accent);
input[type="text"], box-shadow:0 0 0 2px rgba(67,206,162,.10);
input[type="password"] { }
width: 100%; input[type="checkbox"], input[type="radio"] {
padding: 12px 15px; width:15px; height:15px; cursor:pointer; accent-color:var(--accent);
border: 2px solid #e1e8ed; }
border-radius: 8px; select option { background:var(--panel); color:var(--text); }
font-size: 0.95em;
transition: all 0.3s; /* Panels */
background: white; .section, .settings-section, .send-panel, .stats,
} .control-panel, .auto-trigger-section {
background:var(--panel); border:1px solid var(--border);
input[type="text"]:focus, border-radius:var(--r); padding:13px; margin-bottom:10px;
input[type="password"]:focus { }
outline: none; .form-group { margin-bottom:12px; }
border-color: #667eea; .form-group:last-child { margin-bottom:0; }
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); .help-text { font-size:.76em; color:var(--muted); margin-top:4px; line-height:1.4; }
} .form-row {
display:grid;
input[type="checkbox"] { grid-template-columns:repeat(auto-fit,minmax(min(100%,190px),1fr));
width: 20px; gap:10px; margin-bottom:10px;
height: 20px; }
cursor: pointer; .form-row label { text-transform:none; font-size:.78em; }
margin-right: 10px; .checkbox-group, .checkbox-row {
} display:flex; align-items:center; gap:8px;
margin-bottom:8px; padding:7px 10px;
.checkbox-group { background:var(--card); border-radius:6px; border:1px solid var(--border);
display: flex; }
align-items: center; .checkbox-group label, .checkbox-row label {
margin-bottom: 15px; text-transform:none; cursor:pointer; margin-bottom:0;
} color:var(--text); font-size:.85em; letter-spacing:0;
.checkbox-group label {
margin-bottom: 0;
cursor: pointer;
user-select: none;
}
.sta-settings {
background: #f0f4f8;
padding: 20px;
border-radius: 8px;
margin-top: 15px;
border-left: 4px solid #667eea;
}
.sta-settings.disabled {
opacity: 0.5;
pointer-events: none;
}
.button-group {
display: flex;
gap: 15px;
margin-top: 30px;
flex-wrap: wrap;
}
button {
flex: 1;
min-width: 150px;
padding: 14px 28px;
border: none;
border-radius: 8px;
font-size: 1em;
font-weight: 700;
cursor: pointer;
transition: all 0.3s;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.btn-save {
background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
color: #666;
box-shadow: 0 4px 15px rgba(17, 153, 142, 0.3);
}
.btn-save:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(17, 153, 142, 0.4);
}
.btn-cancel {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: #666;
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}
.btn-cancel:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}
button:active {
transform: translateY(0);
} }
/* Alerts */
.alert { .alert {
padding: 15px 20px; padding:9px 13px; border-radius:var(--r);
border-radius: 8px; margin-bottom:10px; display:none;
margin-bottom: 20px; align-items:center; gap:9px;
display: none; font-size:.83em; font-weight:600;
align-items: center; border:1px solid var(--border); background:var(--panel); color:var(--text);
gap: 12px;
animation: slideDown 0.3s ease-out;
} }
.alert.show { display:flex; }
.alert-success { border-color:rgba(67,206,162,.4); color:var(--accent); background:rgba(67,206,162,.07); }
.alert-info { border-color:rgba(88,166,255,.4); color:var(--blue); background:rgba(88,166,255,.07); }
.alert-warning { border-color:rgba(227,179,65,.4); color:var(--yellow); background:rgba(227,179,65,.07); }
.alert-icon { font-size:1.15em; }
.alert-text { flex:1; }
@keyframes slideDown { from{opacity:0;transform:translateY(-6px);}to{opacity:1;transform:translateY(0);} }
@keyframes slideDown { /* Connection status */
from { .connection-status {
opacity: 0; position:fixed; top:10px; right:10px;
transform: translateY(-10px); padding:4px 11px; border-radius:20px;
} font-size:.75em; font-weight:600; z-index:1000;
to { border:1px solid var(--border); background:var(--panel); color:var(--muted);
opacity: 1;
transform: translateY(0);
}
} }
.connection-status.connected { border-color:rgba(67,206,162,.5); color:var(--accent); background:rgba(67,206,162,.08); }
.connection-status.disconnected { border-color:rgba(248,81,73,.5); color:var(--red); background:rgba(248,81,73,.08); }
.alert.show { @media (max-width:480px) { .content{padding:8px;} h2{font-size:.78em;} }
display: flex;
/* settings.h specific */
.section-title {
color:var(--accent); font-size:.85em; font-weight:700;
margin-bottom:14px; padding-bottom:7px; border-bottom:1px solid var(--border);
display:flex; align-items:center; gap:7px;
text-transform:uppercase; letter-spacing:.4px;
} }
.sta-settings {
.alert-success { background:var(--card); padding:13px; border-radius:var(--r);
background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); margin-top:10px; border:1px solid var(--border); border-left:3px solid var(--blue);
color: #666;
} }
.sta-settings.disabled { opacity:.4; pointer-events:none; }
.alert-info { .btn-save { border-color:var(--accent); color:var(--accent); flex:1; min-width:130px; padding:9px 18px; }
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); .btn-save:hover { background:rgba(67,206,162,.10); }
color: #666; .btn-cancel { border-color:var(--muted); color:var(--muted); flex:1; min-width:130px; padding:9px 18px; }
} .btn-cancel:hover { background:rgba(139,148,158,.10); }
.alert-warning {
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
color: #666;
}
.alert-icon {
font-size: 1.5em;
}
.alert-text {
flex: 1;
font-weight: 600;
}
.info-box { .info-box {
background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%); background:rgba(88,166,255,.06); border:1px solid rgba(88,166,255,.2);
border-left: 4px solid #667eea; border-left:3px solid var(--blue); padding:11px 13px; border-radius:var(--r); margin-top:10px;
padding: 15px 20px;
border-radius: 8px;
margin-top: 15px;
}
.info-box-title {
font-weight: 700;
color: #333;
margin-bottom: 8px;
display: flex;
align-items: center;
gap: 8px;
}
.info-box-text {
color: #555;
font-size: 0.9em;
line-height: 1.6;
}
/* ========== 반응형 디자인 ========== */
@media (max-width: 768px) {
body {
padding: 5px;
}
.container {
border-radius: 10px;
}
.header {
padding: 15px;
flex-direction: column;
text-align: center;
gap: 10px;
}
.header h1 {
font-size: 1.4em;
}
.nav {
padding: 5px;
}
.nav a {
padding: 12px 15px;
font-size: 0.85em;
}
.content {
padding: 15px;
}
.btn {
padding: 10px 20px;
font-size: 13px;
}
}
@media (min-width: 769px) and (max-width: 1024px) {
.header h1 {
font-size: 1.6em;
}
.nav a {
padding: 13px 18px;
font-size: 0.9em;
}
.content {
padding: 25px;
}
}
@media (min-width: 1025px) {
.content {
padding: 30px;
}
} }
.info-box-title { font-weight:700; color:var(--blue); margin-bottom:5px; display:flex; align-items:center; gap:5px; font-size:.83em; }
.info-box-text { color:var(--muted); font-size:.80em; line-height:1.6; }
</style> </style>
</head> </head>
<body> <body>
<div class="container"> <div class="header">
<div class="header">
<h1> Settings</h1> <h1> Settings</h1>
<p>Configure WiFi and System Settings</p> <p>Configure WiFi and System Settings</p>
</div> </div>
<div class="nav"> <div class="nav">
<a href="/">📊 Monitor</a> <a href="/">📊 Monitor</a>
<a href="/transmit">📤 Transmit</a> <a href="/transmit">📤 Transmit</a>
<a href="/graph">📈 Graph</a> <a href="/graph">📈 Graph</a>
@@ -364,7 +223,7 @@ const char settings_html[] PROGMEM = R"rawliteral(
<a href="/serial2">📟 Serial2</a> <a href="/serial2">📟 Serial2</a>
</div> </div>
<div class="content"> <div class="content">
<div id="alert-success" class="alert alert-success"> <div id="alert-success" class="alert alert-success">
<span class="alert-icon"></span> <span class="alert-icon"></span>
<span class="alert-text">Settings saved successfully!</span> <span class="alert-text">Settings saved successfully!</span>
@@ -420,7 +279,7 @@ const char settings_html[] PROGMEM = R"rawliteral(
<div class="help-text"> WiFi </div> <div class="help-text"> WiFi </div>
</div> </div>
<div id="sta-status" style="display: none; margin-top: 15px; padding: 12px; background: #e8f5e9; border-radius: 6px; color: #2e7d32; font-weight: 600;"> <div id="sta-status" style="display:none;margin-top:9px;padding:8px 12px;background:rgba(67,206,162,.10);border-radius:6px;color:var(--accent);font-weight:600;border:1px solid rgba(67,206,162,.2);">
WiFi : <span id="sta-ip"></span> WiFi : <span id="sta-ip"></span>
</div> </div>
</div> </div>

View File

@@ -9,330 +9,224 @@ const char transmit_html[] PROGMEM = R"rawliteral(
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CAN Transmit - Sequence Editor</title> <title>CAN Transmit - Sequence Editor</title>
<style> <style>
* { margin: 0; padding: 0; box-sizing: border-box; } :root {
--bg: #0e1117;
--panel: #161b24;
--card: #1c2230;
--border: #2d3748;
--accent: #43cea2;
--green: #3fb950;
--blue: #58a6ff;
--red: #f85149;
--yellow: #e3b341;
--purple: #bc8cff;
--text: #e6edf3;
--muted: #8b949e;
--r: 8px;
}
* { margin:0; padding:0; box-sizing:border-box; }
html, body { min-height:100%; }
body { body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); background: var(--bg); color: var(--text);
min-height: 100vh; overflow-x: hidden; font-size: 14px;
padding: 10px;
}
.container {
max-width: 1400px;
margin: 0 auto;
background: white;
border-radius: 15px;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
overflow: hidden;
} }
/* Header */
.header { .header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); background: linear-gradient(135deg,#1a2744 0%,#1e1a3a 100%);
color: white; padding: 11px 16px; border-bottom: 1px solid var(--border);
padding: 20px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
text-align: center;
} }
.header h1 { font-size: 1.8em; margin-bottom: 5px; } .header h1 {
.header p { opacity: 0.9; font-size: 0.9em; } font-size: 1.0em; font-weight: 700; color: var(--accent);
/* ========== 통일된 네비게이션 ========== */ display: flex; align-items: center; gap: 8px;
.nav {
background: #f8f9fa;
padding: 0;
border-bottom: 2px solid #e0e0e0;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
} }
.header p { font-size: 0.78em; color: var(--muted); margin:0; }
.nav a { .badge {
display: inline-flex; background: rgba(67,206,162,.15); color: var(--accent);
align-items: center; padding: 2px 8px; border-radius: 12px; font-size: 0.65em;
justify-content: center; font-weight: 600; border: 1px solid rgba(67,206,162,.3);
padding: 15px 20px;
text-decoration: none;
color: #666;
font-weight: 500;
font-size: 0.95em;
border-bottom: 3px solid transparent;
transition: all 0.3s;
white-space: nowrap; white-space: nowrap;
min-width: 120px;
} }
.header-spacer { flex:1; }
.nav a:hover { /* Nav */
background: #e9ecef; .nav {
color: #667eea; background: var(--panel); border-bottom: 1px solid var(--border);
transform: translateY(-2px); display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch;
scrollbar-width: none;
} }
.nav::-webkit-scrollbar { display:none; }
.nav a.active { .nav a {
color: #764ba2; display: inline-flex; align-items: center;
border-bottom-color: #764ba2; padding: 10px 13px; text-decoration: none; color: var(--muted);
background: white; font-size: 0.78em; font-weight: 500;
font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap;
transition: color .2s, border-color .2s;
} }
.content { padding: 20px; } .nav a:hover { color: var(--text); }
.nav a.active { color: var(--accent); border-bottom-color: var(--accent); }
.section { /* Content */
background: #f8f9fa; .content { padding: 12px; }
border-radius: 10px;
padding: 20px;
margin-bottom: 20px;
}
/* Headings */
h2 { h2 {
color: #333; color: var(--accent); margin: 14px 0 10px;
margin-bottom: 15px; font-size: 0.82em; font-weight: 700; text-transform: uppercase;
font-size: 1.3em; letter-spacing: .5px; padding-bottom: 6px;
border-bottom: 3px solid #667eea; border-bottom: 1px solid var(--border);
padding-bottom: 8px; }
h3 {
color: var(--text); font-size: 0.85em; font-weight: 600;
margin-bottom: 10px; padding-bottom: 6px;
border-bottom: 1px solid var(--border);
} }
.form-row { /* Buttons */
display: grid; .btn, button {
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); padding: 6px 13px; border: 1px solid var(--border);
gap: 15px; border-radius: var(--r); background: var(--bg); color: var(--muted);
margin-bottom: 15px; font-size: 0.8em; font-weight: 600; cursor: pointer;
} font-family: inherit; transition: all .15s; white-space: nowrap;
-webkit-tap-highlight-color: transparent; touch-action: manipulation;
.form-group {
display: flex;
flex-direction: column;
} }
.btn:hover, button:hover { border-color: var(--accent); color: var(--accent); }
.btn:active, button:active { transform: scale(.97); }
.btn-primary { border-color:var(--blue); color:var(--blue); }
.btn-success { border-color:var(--accent); color:var(--accent); }
.btn-danger { border-color:var(--red); color:var(--red); }
.btn-warning { border-color:var(--yellow); color:var(--yellow); }
.btn-secondary{ border-color:var(--muted); color:var(--muted); }
.btn-primary:hover { background:rgba(88,166,255,.10); }
.btn-success:hover { background:rgba(67,206,162,.10); }
.btn-danger:hover { background:rgba(248,81,73,.10); }
.btn-warning:hover { background:rgba(227,179,65,.10); }
.btn-secondary:hover{ background:rgba(139,148,158,.10); }
.btn-small { padding:4px 9px; font-size:.75em; }
.button-group, .btn-group { display:flex; gap:6px; flex-wrap:wrap; margin-top:10px; }
/* Forms */
label { label {
font-weight: 600; display:block; font-weight:600; color:var(--muted);
margin-bottom: 5px; margin-bottom:4px; font-size:.78em;
color: #333; text-transform:uppercase; letter-spacing:.3px;
font-size: 0.9em; }
input[type="text"], input[type="password"], input[type="number"],
select, textarea {
width:100%; padding:7px 10px;
border:1px solid var(--border); border-radius:var(--r);
font-size:.85em; font-family:inherit;
background:var(--bg); color:var(--text);
transition:border-color .2s;
}
input:focus, select:focus, textarea:focus {
outline:none; border-color:var(--accent);
box-shadow:0 0 0 2px rgba(67,206,162,.10);
}
input[type="checkbox"], input[type="radio"] {
width:15px; height:15px; cursor:pointer; accent-color:var(--accent);
}
select option { background:var(--panel); color:var(--text); }
/* Panels */
.section, .settings-section, .send-panel, .stats,
.control-panel, .auto-trigger-section {
background:var(--panel); border:1px solid var(--border);
border-radius:var(--r); padding:13px; margin-bottom:10px;
}
.form-group { margin-bottom:12px; }
.form-group:last-child { margin-bottom:0; }
.help-text { font-size:.76em; color:var(--muted); margin-top:4px; line-height:1.4; }
.form-row {
display:grid;
grid-template-columns:repeat(auto-fit,minmax(min(100%,190px),1fr));
gap:10px; margin-bottom:10px;
}
.form-row label { text-transform:none; font-size:.78em; }
.checkbox-group, .checkbox-row {
display:flex; align-items:center; gap:8px;
margin-bottom:8px; padding:7px 10px;
background:var(--card); border-radius:6px; border:1px solid var(--border);
}
.checkbox-group label, .checkbox-row label {
text-transform:none; cursor:pointer; margin-bottom:0;
color:var(--text); font-size:.85em; letter-spacing:0;
} }
input, select { /* Alerts */
padding: 10px; .alert {
border: 2px solid #ddd; padding:9px 13px; border-radius:var(--r);
border-radius: 5px; margin-bottom:10px; display:none;
font-size: 1em; align-items:center; gap:9px;
transition: all 0.3s; font-size:.83em; font-weight:600;
border:1px solid var(--border); background:var(--panel); color:var(--text);
} }
.alert.show { display:flex; }
.alert-success { border-color:rgba(67,206,162,.4); color:var(--accent); background:rgba(67,206,162,.07); }
.alert-info { border-color:rgba(88,166,255,.4); color:var(--blue); background:rgba(88,166,255,.07); }
.alert-warning { border-color:rgba(227,179,65,.4); color:var(--yellow); background:rgba(227,179,65,.07); }
.alert-icon { font-size:1.15em; }
.alert-text { flex:1; }
@keyframes slideDown { from{opacity:0;transform:translateY(-6px);}to{opacity:1;transform:translateY(0);} }
input:focus, select:focus { /* Connection status */
outline: none;
border-color: #667eea;
}
.button-group {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
button {
padding: 12px 24px;
border: none;
border-radius: 5px;
font-size: 1em;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
}
.btn-primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
}
.btn-success {
background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
color: white;
}
.btn-danger {
background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
color: white;
}
.btn-warning {
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
color: white;
}
button:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.steps-list {
background: white;
border-radius: 8px;
padding: 15px;
max-height: 400px;
overflow-y: auto;
}
.step-item {
background: #f8f9fa;
padding: 12px;
margin-bottom: 10px;
border-radius: 5px;
border-left: 4px solid #667eea;
display: flex;
justify-content: space-between;
align-items: center;
}
.step-info {
flex: 1;
font-family: 'Courier New', monospace;
font-size: 0.9em;
}
.step-actions {
display: flex;
gap: 5px;
}
.btn-small {
padding: 5px 10px;
font-size: 0.85em;
}
.sequence-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 15px;
}
.sequence-card {
background: white;
padding: 15px;
border-radius: 8px;
border: 2px solid #ddd;
transition: all 0.3s;
}
.sequence-card:hover {
border-color: #667eea;
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.sequence-card h3 {
color: #667eea;
margin-bottom: 10px;
font-size: 1.1em;
}
.sequence-info {
font-size: 0.9em;
color: white;
margin-bottom: 10px;
}
.status-badge {
display: inline-block;
padding: 4px 8px;
border-radius: 4px;
font-size: 0.8em;
font-weight: 600;
margin-right: 5px;
}
.badge-once { background: #e3f2fd; color: #1976d2; }
.badge-count { background: #fff3e0; color: #f57c00; }
.badge-infinite { background: #f3e5f5; color: #7b1fa2; }
.badge-running { background: #c8e6c9; color: #388e3c; }
.connection-status { .connection-status {
position: fixed; position:fixed; top:10px; right:10px;
top: 10px; padding:4px 11px; border-radius:20px;
right: 10px; font-size:.75em; font-weight:600; z-index:1000;
padding: 8px 15px; border:1px solid var(--border); background:var(--panel); color:var(--muted);
border-radius: 20px;
font-size: 0.85em;
font-weight: 600;
z-index: 1000;
} }
.connection-status.connected { .connection-status.connected { border-color:rgba(67,206,162,.5); color:var(--accent); background:rgba(67,206,162,.08); }
background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); .connection-status.disconnected { border-color:rgba(248,81,73,.5); color:var(--red); background:rgba(248,81,73,.08); }
color: white;
@media (max-width:480px) { .content{padding:8px;} h2{font-size:.78em;} }
/* transmit.h specific */
.steps-list {
background:var(--bg); border:1px solid var(--border);
border-radius:var(--r); padding:8px; max-height:360px; overflow-y:auto;
} }
.connection-status.disconnected { .steps-list::-webkit-scrollbar { width:5px; }
background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%); .steps-list::-webkit-scrollbar-track { background:var(--panel); }
color: white; .steps-list::-webkit-scrollbar-thumb { background:var(--border); border-radius:3px; }
.step-item {
background:var(--card); padding:9px 11px; margin-bottom:6px;
border-radius:6px; border:1px solid var(--border); border-left:3px solid var(--blue);
display:flex; justify-content:space-between; align-items:center;
} }
.step-item:hover { border-color:var(--blue); }
.step-info { flex:1; font-family:'SF Mono','Fira Code','Courier New',monospace; font-size:.80em; color:var(--text); }
.step-actions { display:flex; gap:4px; }
/* ========== 반응형 디자인 ========== */ .sequence-list {
@media (max-width: 768px) { display:grid;
body { grid-template-columns:repeat(auto-fill,minmax(min(100%,260px),1fr));
padding: 5px; gap:8px;
}
.container {
border-radius: 10px;
}
.header {
padding: 15px;
flex-direction: column;
text-align: center;
gap: 10px;
}
.header h1 {
font-size: 1.4em;
}
.nav {
padding: 5px;
}
.nav a {
padding: 12px 15px;
font-size: 0.85em;
}
.content {
padding: 15px;
}
.btn {
padding: 10px 20px;
font-size: 13px;
}
} }
.sequence-card {
@media (min-width: 769px) and (max-width: 1024px) { background:var(--card); padding:12px; border-radius:var(--r);
.header h1 { border:1px solid var(--border); transition:border-color .15s;
font-size: 1.6em;
}
.nav a {
padding: 13px 18px;
font-size: 0.9em;
}
.content {
padding: 25px;
}
}
@media (min-width: 1025px) {
.content {
padding: 30px;
}
} }
.sequence-card:hover { border-color:var(--blue); }
.sequence-card h3 { color:var(--blue); margin-bottom:7px; font-size:.92em; border-bottom:1px solid var(--border); padding-bottom:5px; }
.sequence-info { font-size:.80em; color:var(--muted); margin-bottom:7px; }
.status-badge { display:inline-block; padding:2px 7px; border-radius:4px; font-size:.73em; font-weight:600; margin-right:4px; }
.badge-once { background:rgba(88,166,255,.12); color:var(--blue); border:1px solid rgba(88,166,255,.2); }
.badge-count { background:rgba(227,179,65,.12); color:var(--yellow); border:1px solid rgba(227,179,65,.2); }
.badge-infinite { background:rgba(188,140,255,.12);color:var(--purple); border:1px solid rgba(188,140,255,.2);}
.badge-running { background:rgba(67,206,162,.12); color:var(--accent); border:1px solid rgba(67,206,162,.2); }
</style> </style>
</head> </head>
<body> <body>
<div id="connection-status" class="connection-status disconnected">🔴 Disconnected</div> <div id="connection-status" class="connection-status disconnected">🔴 Disconnected</div>
<div class="container"> <div class="header">
<div class="header">
<h1>🚀 CAN Sequence Transmitter</h1> <h1>🚀 CAN Sequence Transmitter</h1>
<p>Create and Execute CAN Message Sequences</p> <p>Create and Execute CAN Message Sequences</p>
</div> </div>
<div class="nav"> <div class="nav">
<a href="/">📊 Monitor</a> <a href="/">📊 Monitor</a>
<a href="/transmit" class="active">📤 Transmit</a> <a href="/transmit" class="active">📤 Transmit</a>
<a href="/graph">📈 Graph</a> <a href="/graph">📈 Graph</a>
@@ -342,7 +236,7 @@ const char transmit_html[] PROGMEM = R"rawliteral(
<a href="/serial2">📟 Serial2</a> <a href="/serial2">📟 Serial2</a>
</div> </div>
<div class="content"> <div class="content">
<div class="section"> <div class="section">
<h2>Create New Sequence</h2> <h2>Create New Sequence</h2>
@@ -628,10 +522,23 @@ const char transmit_html[] PROGMEM = R"rawliteral(
})) }))
}; };
console.log('Saving sequence:', sequence); console.log(' Saving sequence:', sequence);
console.log('📊 Total steps:', currentSteps.length);
if (ws && ws.readyState === WebSocket.OPEN) { if (ws && ws.readyState === WebSocket.OPEN) {
ws.send(JSON.stringify(sequence)); ws.send(JSON.stringify(sequence));
console.log(' Sequence save command sent to server');
// ⭐⭐⭐ 저장 확인 메시지 (3초 후 자동 사라짐)
alert('Sequence "' + name + '" saved successfully!\n' +
'Steps: ' + currentSteps.length + '\n' +
'Repeat: ' + (mode === 0 ? 'Once' : mode === 1 ? count + ' times' : 'Forever'));
// 입력 필드 초기화 (선택 사항)
// document.getElementById('seq-name').value = '';
} else {
console.error(' WebSocket not connected!');
alert('Error: Not connected to server');
} }
} }
@@ -685,20 +592,22 @@ const char transmit_html[] PROGMEM = R"rawliteral(
function loadSequenceDetail(index) { function loadSequenceDetail(index) {
if (ws && ws.readyState === WebSocket.OPEN) { if (ws && ws.readyState === WebSocket.OPEN) {
ws.send(JSON.stringify({cmd: 'getSequence', index: index})); ws.send(JSON.stringify({cmd: 'getSequenceDetail', index: index}));
console.log(' getSequenceDetail :', index);
} }
} }
function handleSequenceDetail(data) { function handleSequenceDetail(data) {
const seq = data.sequence; console.log(' Sequence Detail :', data);
document.getElementById('seq-name').value = seq.name; // ESP32에서 보낸 형식에 맞춰 처리
document.getElementById('repeat-mode').value = seq.mode !== undefined ? seq.mode : seq.repeatMode; document.getElementById('seq-name').value = data.name || '';
document.getElementById('repeat-count').value = seq.count !== undefined ? seq.count : seq.repeatCount; document.getElementById('repeat-mode').value = data.repeatMode !== undefined ? data.repeatMode : 0;
document.getElementById('repeat-count').value = data.repeatCount !== undefined ? data.repeatCount : 1;
currentSteps = []; currentSteps = [];
if (seq.steps && Array.isArray(seq.steps)) { if (data.steps && Array.isArray(data.steps)) {
seq.steps.forEach(step => { data.steps.forEach(step => {
let dataBytes = []; let dataBytes = [];
if (typeof step.data === 'string') { if (typeof step.data === 'string') {
dataBytes = step.data.split(' ').map(b => parseInt(b, 16)); dataBytes = step.data.split(' ').map(b => parseInt(b, 16));
@@ -707,7 +616,7 @@ const char transmit_html[] PROGMEM = R"rawliteral(
} }
currentSteps.push({ currentSteps.push({
canId: typeof step.id === 'string' ? parseInt(step.id, 16) : step.id, canId: typeof step.id === 'string' ? parseInt(step.id.replace('0x', ''), 16) : step.id,
extended: step.ext || step.extended || false, extended: step.ext || step.extended || false,
dlc: step.dlc, dlc: step.dlc,
data: dataBytes, data: dataBytes,
@@ -719,6 +628,7 @@ const char transmit_html[] PROGMEM = R"rawliteral(
updateStepsList(); updateStepsList();
document.querySelector('.section').scrollIntoView({ behavior: 'smooth' }); document.querySelector('.section').scrollIntoView({ behavior: 'smooth' });
alert('Sequence loaded! You can now edit and save it.'); alert('Sequence loaded! You can now edit and save it.');
console.log(' Loaded steps:', currentSteps);
} }
function startSequence(index) { function startSequence(index) {