디자인 다크 모드 수정

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

490
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">
<title>CAN Signal Graph</title>
<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 {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #43cea2 0%, #185a9d 100%);
min-height: 100vh;
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;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: var(--bg); color: var(--text);
overflow-x: hidden; font-size: 14px;
}
/* Header */
.header {
background: linear-gradient(135deg, #43cea2 0%, #185a9d 100%);
color: white;
padding: 20px;
text-align: center;
background: linear-gradient(135deg,#1a2744 0%,#1e1a3a 100%);
padding: 11px 16px; border-bottom: 1px solid var(--border);
display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.header h1 { font-size: 1.8em; margin-bottom: 5px; }
/* ========== 통일된 네비게이션 ========== */
.nav {
background: #f8f9fa;
padding: 0;
border-bottom: 2px solid #e0e0e0;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
.header h1 {
font-size: 1.0em; font-weight: 700; color: var(--accent);
display: flex; align-items: center; gap: 8px;
}
.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;
.header p { font-size: 0.78em; color: var(--muted); margin:0; }
.badge {
background: rgba(67,206,162,.15); color: var(--accent);
padding: 2px 8px; border-radius: 12px; font-size: 0.65em;
font-weight: 600; border: 1px solid rgba(67,206,162,.3);
white-space: nowrap;
min-width: 120px;
}
.nav a:hover {
background: #e9ecef;
color: #667eea;
transform: translateY(-2px);
.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 a.active {
color: #764ba2;
border-bottom-color: #764ba2;
background: white;
font-weight: 600;
.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;
}
.content { padding: 15px; }
.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);
}
/* Buttons */
.btn, button {
padding: 6px 13px; border: 1px solid var(--border);
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;
}
/* Alerts */
.alert {
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);} }
/* 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 {
background: #f8f9fa;
padding: 20px;
border-radius: 10px;
margin-bottom: 15px;
background:var(--panel); border:1px solid var(--border);
border-radius:var(--r); padding:13px; margin-bottom:10px;
}
.upload-area {
border: 3px dashed #43cea2;
border-radius: 10px;
padding: 30px 20px;
text-align: center;
cursor: pointer;
transition: all 0.3s;
border:2px dashed var(--border); border-radius:var(--r);
padding:26px 18px; text-align:center; cursor:pointer;
transition:all .2s; color:var(--muted); font-size:.85em;
}
.upload-area:hover { background: #f0f9ff; border-color: #185a9d; }
.upload-area input { display: none; }
.upload-area:hover { border-color:var(--accent); color:var(--accent); background:rgba(67,206,162,.04); }
.upload-area input { display:none; }
.upload-area p { margin-top:8px; }
.signal-selector {
background: #f8f9fa;
padding: 15px;
border-radius: 10px;
margin-bottom: 15px;
}
.search-container {
margin-bottom: 15px;
position: relative;
background:var(--panel); border:1px solid var(--border);
border-radius:var(--r); padding:13px; margin-bottom:10px;
}
.search-container { margin-bottom:10px; position:relative; }
.search-box {
width: 100%;
padding: 12px 12px 12px 40px;
border: 2px solid #43cea2;
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;
width:100%; padding:8px 10px 8px 34px;
border:1px solid var(--border); border-radius:var(--r);
font-size:.85em; background:var(--bg); color:var(--text);
}
.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 {
margin-top: 8px;
padding: 8px 12px;
background: #e3f2fd;
border-radius: 5px;
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;
margin-top:5px; padding:5px 10px;
background:rgba(88,166,255,.08); border-radius:5px;
font-size:.78em; color:var(--blue); font-weight:600;
border:1px solid rgba(88,166,255,.2);
}
.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 {
padding: 8px 15px;
border: 2px solid #43cea2;
background: white;
border-radius: 5px;
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;
padding:4px 10px; border:1px solid var(--border);
background:var(--bg); border-radius:6px; font-size:.76em;
cursor:pointer; font-weight:600; color:var(--muted); font-family:inherit;
transition:all .15s;
}
.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 {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 10px;
margin-top: 15px;
display:grid;
grid-template-columns:repeat(auto-fill,minmax(min(100%,170px),1fr));
gap:7px; margin-top:10px;
}
.signal-item {
background: white;
padding: 12px;
border-radius: 8px;
border: 2px solid #ddd;
cursor: pointer;
transition: all 0.3s;
background:var(--card); padding:9px;
border-radius:var(--r); border:1px solid var(--border); cursor:pointer; transition:all .15s;
}
.signal-item:hover { border-color: #43cea2; transform: translateY(-2px); }
.signal-item.selected { border-color: #185a9d; background: #e3f2fd; }
.signal-name { font-weight: 600; color: #333; margin-bottom: 5px; font-size: 0.9em; }
.signal-info { font-size: 0.8em; color: #555; line-height: 1.4; }
.highlight {
background-color: #ffeb3b;
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; }
.signal-item:hover { border-color:var(--accent); background:rgba(67,206,162,.04); }
.signal-item.selected { border-color:var(--accent); background:rgba(67,206,162,.10); }
.signal-name { font-weight:600; color:var(--text); margin-bottom:3px; font-size:.83em; }
.signal-info { font-size:.74em; color:var(--muted); line-height:1.4; }
.highlight { background:rgba(227,179,65,.22); color:var(--yellow); padding:1px 0; font-weight:600; }
.controls { display:flex; gap:5px; margin-bottom:10px; flex-wrap:wrap; }
.selection-info {
background: #e3f2fd;
padding: 12px 15px;
border-radius: 8px;
margin-bottom: 15px;
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;
}
background:rgba(88,166,255,.07); padding:9px 12px;
border-radius:var(--r); margin-bottom:10px;
border:1px solid rgba(88,166,255,.2); border-left:3px solid var(--blue);
font-size:.83em; color:var(--text);
}
.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>
</head>
<body>
<div class="container">
<div class="header">
<div class="header">
<h1>CAN Signal Graph</h1>
<p>Real-time Signal Visualization (Offline Mode)</p>
</div>
<div class="nav">
<div class="nav">
<a href="/">📊 Monitor</a>
<a href="/transmit">📤 Transmit</a>
<a href="/graph" class="active">📈 Graph</a>
@@ -321,7 +269,7 @@ const char graph_html[] PROGMEM = R"rawliteral(
<a href="/serial2">📟 Serial2</a>
</div>
<div class="content">
<div class="content">
<div id="status" class="status" style="display:none;"></div>
<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>
<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;">
<strong> Info:</strong> Click "Start" to open a new window with real-time graphs.
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">
<title>CAN Signal Graph Viewer</title>
<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 {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 10px;
color: white;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: var(--bg);
color: var(--text);
overflow-x: hidden;
font-size: 14px;
}
/* ── Header ── */
.header {
background: linear-gradient(135deg, #667eea, #764ba2);
padding: 15px;
text-align: center;
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;
background: linear-gradient(135deg, #1a2744 0%, #1e1a3a 100%);
padding: 12px 16px;
border-bottom: 1px solid var(--border);
display: flex;
flex-wrap: wrap;
justify-content: 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 {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 15px 20px;
padding: 10px 14px;
text-decoration: none;
color: #666;
color: var(--muted);
font-size: 0.8em;
font-weight: 500;
font-size: 0.95em;
border-bottom: 3px solid transparent;
transition: all 0.3s;
border-bottom: 2px solid transparent;
white-space: nowrap;
min-width: 120px;
}
.nav a:hover {
background: #e9ecef;
color: #667eea;
transform: translateY(-2px);
}
.nav a.active {
color: #764ba2;
border-bottom-color: #764ba2;
background: white;
font-weight: 600;
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); }
/* ── Controls ── */
.controls {
background: #2a2a2a;
padding: 10px 15px;
background: var(--panel);
border-bottom: 1px solid var(--border);
padding: 8px 12px;
display: flex;
gap: 10px;
justify-content: center;
flex-wrap: wrap;
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
gap: 6px;
align-items: center;
}
.control-group {
display: flex;
gap: 10px;
align-items: center;
gap: 4px;
flex-wrap: wrap;
}
.control-label {
font-size: 0.85em;
color: #aaa;
font-size: 0.72em;
color: var(--muted);
white-space: nowrap;
padding-right: 2px;
}
.ctrl-sep {
width: 1px;
height: 20px;
background: var(--border);
margin: 0 4px;
}
.btn {
padding: 8px 20px;
border: none;
border-radius: 5px;
font-size: 0.9em;
padding: 5px 11px;
border: 1px solid var(--border);
border-radius: 6px;
background: var(--bg);
color: var(--muted);
font-size: 0.78em;
font-weight: 600;
cursor: pointer;
transition: all 0.15s;
white-space: nowrap;
font-family: inherit;
-webkit-tap-highlight-color: transparent;
touch-action: manipulation;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: scale(0.96); }
.btn.active {
background: rgba(67,206,162,0.15);
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;
}
.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-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 {
box-shadow: inset 0 3px 5px rgba(0,0,0,0.3);
transform: translateY(0);
.status.disconnected {
background: rgba(248,81,73,0.12);
color: var(--red);
border-color: rgba(248,81,73,0.3);
}
/* ── Graph grid ── */
.graphs {
padding: 15px;
padding: 10px;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
gap: 15px;
/* ★ 모바일 핵심: min(100%, 440px) 로 가로 스크롤 방지 */
grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
gap: 10px;
}
.graph-container {
background: #2a2a2a;
padding: 15px;
border-radius: 10px;
border: 2px solid #3a3a3a;
background: var(--card);
border-radius: var(--radius);
border: 1px solid var(--border);
overflow: hidden;
}
.graph-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
padding-bottom: 8px;
border-bottom: 2px solid #43cea2;
padding: 8px 12px;
border-bottom: 1px solid var(--border);
background: rgba(67,206,162,0.05);
gap: 8px;
}
.graph-title {
font-size: 1em;
font-weight: 600;
color: #43cea2;
font-size: 0.82em;
font-weight: 700;
color: var(--accent);
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.graph-value {
font-size: 1.2em;
font-size: 1em;
font-weight: 700;
color: #38ef7d;
font-family: 'Courier New', monospace;
color: var(--accent2);
font-family: 'Courier New', 'SF Mono', monospace;
white-space: nowrap;
flex-shrink: 0;
}
/* ★ canvas: CSS padding/background 제거, height만 설정 */
canvas {
display: block;
width: 100%;
height: 250px;
border: 1px solid #3a3a3a;
border-radius: 5px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 10px;
height: 200px;
border: none;
}
.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;
/* ── Responsive ── */
@media (max-width: 480px) {
.controls { padding: 6px 8px; gap: 5px; }
.ctrl-sep { display: none; }
.btn { padding: 6px 9px; font-size: 0.8em; }
.header h1 { font-size: 0.95em; }
canvas { height: 175px; }
.stats-bar { gap: 8px; font-size: 0.7em; }
}
.status.disconnected {
border-color: #eb3349;
background: #3a2a2a;
@media (min-width: 768px) {
canvas { height: 230px; }
}
/* ========== 반응형 디자인 ========== */
@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;
}
@media (min-width: 1200px) {
canvas { height: 260px; }
}
</style>
</head>
<body>
<div class="header">
<h1>Real-time CAN Signal Graphs (Scatter Mode)</h1>
<p>Viewing <span id="graph-count">0</span> signals</p>
<div>
<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 class="nav">
@@ -236,42 +258,46 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
<div class="controls">
<div class="control-group">
<button class="btn btn-success" onclick="startGraphing()">Start</button>
<button class="btn btn-danger" onclick="stopGraphing()">Stop</button>
<button class="btn btn-danger" onclick="window.close()">Close</button>
<button class="btn btn-success active" id="btn-start" onclick="startGraphing()"> Start</button>
<button class="btn btn-danger" id="btn-stop" onclick="stopGraphing()"> Stop</button>
</div>
<div class="ctrl-sep"></div>
<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" 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 class="ctrl-sep"></div>
<div class="control-group">
<span class="control-label">X-Axis Range:</span>
<button class="btn btn-warning active" id="btn-range-10s" onclick="setRangeMode('10s')">10s Window</button>
<button class="btn btn-warning" id="btn-range-all" onclick="setRangeMode('all')">All Time</button>
<span class="control-label">Range:</span>
<button class="btn btn-warning active" id="btn-range-10s" onclick="setRangeMode('10s')">10s</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 class="ctrl-sep"></div>
<div class="control-group">
<span class="control-label">Sort by:</span>
<button class="btn btn-info active" id="btn-sort-selection" onclick="setSortMode('selection')">Selection Order</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-sort-name-desc" onclick="setSortMode('name-desc')">Name (ZA)</button>
<span class="control-label">Plot:</span>
<button class="btn btn-info active" id="btn-plot-line" onclick="setPlotMode('line')">Line</button>
<button class="btn btn-info" id="btn-plot-scatter" onclick="setPlotMode('scatter')">Dot</button>
</div>
<div class="ctrl-sep"></div>
<div class="control-group">
<button class="btn btn-success" onclick="downloadCSV()" style="background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);">
📥 Download CSV
</button>
<button class="btn btn-danger" onclick="clearData()" style="background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);">
🗑 Clear Data
</button>
<span class="control-label">Sort:</span>
<button class="btn btn-info active" id="btn-sort-selection" onclick="setSortMode('selection')">Order</button>
<button class="btn btn-info" id="btn-sort-name-asc" onclick="setSortMode('name-asc')">AZ</button>
<button class="btn btn-info" id="btn-sort-name-desc" onclick="setSortMode('name-desc')">ZA</button>
</div>
<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 class="status" id="status">Connecting...</div>
<div style="padding: 10px 15px; background: #2a2a2a; color: #aaa; font-size: 0.85em; display: flex; justify-content: space-between; align-items: center;">
<span>Data Points: <strong id="data-point-count" style="color: #43cea2;">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 class="stats-bar">
<span>Points:<strong id="data-point-count">0</strong></span>
<span>Time:<strong id="recording-time">0s</strong></span>
<span>Msgs:<strong id="msg-received">0</strong></span>
</div>
<div class="graphs" id="graphs"></div>
@@ -285,12 +311,13 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
let dbcData = {};
let lastTimestamps = {};
let sortMode = 'selection';
const MAX_DATA_POINTS = 60;
const MAX_DATA_POINTS = 300;
let scaleMode = 'index';
let rangeMode = '10s';
let totalMsgReceived = 0;
let lastCanCounts = {}; // ★ 각 CAN ID별 마지막 count 저장
let lastSignalTimes = {}; // ⭐ 각 신호별 마지막 시간 저장 (time-base 모드용)
let lastCanCounts = {};
let lastSignalTimes = {};
let plotMode = 'line'; // ★ 'line' | 'scatter'
const COLORS = [
{line: '#FF6384', fill: 'rgba(255, 99, 132, 0.2)'},
@@ -334,10 +361,13 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
resizeCanvas() {
const rect = this.canvas.getBoundingClientRect();
this.canvas.width = rect.width * window.devicePixelRatio;
this.canvas.height = rect.height * window.devicePixelRatio;
this.ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
this.width = rect.width;
if (rect.width === 0) return;
const dpr = window.devicePixelRatio || 1;
this.canvas.width = rect.width * dpr;
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.draw();
}
@@ -380,127 +410,170 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
}
draw() {
if (this.data.length === 0) return;
const ctx = this.ctx;
const padding = 40;
const graphWidth = this.width - padding * 2;
const graphHeight = this.height - padding * 2;
ctx.fillStyle = '#1a1a1a';
ctx.fillRect(0, 0, this.width, this.height);
let displayData = [];
let displayTimes = [];
let displayLabels = [];
if (rangeMode === '10s') {
const currentTime = parseFloat(this.times[this.times.length - 1]);
const W = this.width, H = this.height;
if (!W || !H) return;
const PAD_L = 52, PAD_R = 8, PAD_T = 12, PAD_B = 28;
const gW = W - PAD_L - PAD_R;
const gH = H - PAD_T - PAD_B;
// 배경
ctx.fillStyle = '#111827';
ctx.fillRect(0, 0, W, H);
// ★ 빈 데이터 상태 표시
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++) {
if (currentTime - parseFloat(this.times[i]) <= 10) {
if (this.times[i] >= cutoff) {
displayData.push(this.data[i]);
displayTimes.push(this.times[i]);
displayLabels.push(this.labels[i]);
}
}
} else {
displayData = [...this.data];
displayTimes = [...this.times];
displayLabels = [...this.labels];
// ★ index 모드: 최근 N개만 표시
const N = rangeMode === '30s' ? 150 : 60;
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;
const minValue = Math.min(...displayData);
const maxValue = Math.max(...displayData);
const range = maxValue - minValue || 1;
let minTime, maxTime, timeRange;
if (scaleMode === 'time') {
minTime = parseFloat(displayTimes[0]);
maxTime = parseFloat(displayTimes[displayTimes.length - 1]);
timeRange = maxTime - minTime || 1;
}
ctx.strokeStyle = '#888';
ctx.lineWidth = 2;
ctx.beginPath();
ctx.moveTo(padding, padding);
ctx.lineTo(padding, this.height - padding);
ctx.lineTo(this.width - padding, this.height - padding);
ctx.stroke();
ctx.fillStyle = '#ccc';
ctx.font = '11px Arial';
ctx.textAlign = 'right';
if (this.signal.valueTable) {
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);
});
const range = maxValue - minValue || 1;
// ── Y 그리드 ──
const GRID_Y = 4;
ctx.lineWidth = 0.5;
for (let i = 0; i <= GRID_Y; i++) {
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 {
ctx.fillText(this.getValueText(maxValue), padding - 5, padding + 5);
ctx.fillText(this.getValueText(minValue), padding - 5, this.height - padding);
label = Math.abs(v) < 100 ? v.toFixed(2) : v.toFixed(0);
}
} else {
ctx.fillText(maxValue.toFixed(2), padding - 5, padding + 5);
ctx.fillText(minValue.toFixed(2), padding - 5, this.height - padding);
ctx.fillStyle = '#6b7280';
ctx.font = '9px monospace';
ctx.textAlign = 'right';
ctx.fillText(label, PAD_L - 3, y + 3);
}
ctx.textAlign = 'center';
ctx.fillStyle = '#ccc';
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);
}
// ── X 그리드 ──
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.fillText('Time (sec)', this.width / 2, this.height - 5);
ctx.strokeStyle = '#444';
// ── 축선 ──
ctx.strokeStyle = '#2d3748';
ctx.lineWidth = 1;
for (let i = 1; i < 5; i++) {
const y = padding + (graphHeight / 5) * i;
ctx.beginPath();
ctx.moveTo(PAD_L, PAD_T);
ctx.lineTo(PAD_L, PAD_T + gH);
ctx.lineTo(PAD_L + gW, PAD_T + gH);
ctx.stroke();
// ── 좌표 변환 함수 ──
let minTime, timeRange;
if (scaleMode === 'time' && displayTimes.length > 1) {
minTime = displayTimes[0];
timeRange = displayTimes[displayTimes.length - 1] - minTime || 1;
}
const xOf = (i) => {
if (scaleMode === 'time' && displayTimes.length > 1) {
return PAD_L + ((displayTimes[i] - minTime) / timeRange) * gW;
}
// ★ 버그수정: MAX_DATA_POINTS 고정값 대신 실제 표시 데이터 개수 사용
return PAD_L + (displayData.length > 1 ? (i / (displayData.length - 1)) * gW : 0);
};
const yOf = (v) => PAD_T + gH - ((v - minValue) / range) * gH;
const lineColor = this.colors.line;
// ── Fill 영역 ──
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.moveTo(padding, y);
ctx.lineTo(this.width - padding, y);
ctx.moveTo(xOf(0), yOf(displayData[0]));
for (let i = 1; i < displayData.length; i++) {
ctx.lineTo(xOf(i), yOf(displayData[i]));
}
ctx.stroke();
}
if (displayData.length < 1) return;
ctx.fillStyle = this.colors.line;
// 점 그리기
for (let i = 0; i < displayData.length; i++) {
let x;
if (scaleMode === 'time') {
const timePos = (parseFloat(displayTimes[i]) - minTime) / timeRange;
x = padding + graphWidth * timePos;
} else {
x = padding + (graphWidth / (MAX_DATA_POINTS - 1)) * i;
const isLast = (i === displayData.length - 1);
if (plotMode === 'scatter' || isLast) {
const r = isLast ? 4.5 : 2.5;
ctx.fillStyle = isLast ? '#ffffff' : lineColor;
ctx.strokeStyle = lineColor;
ctx.lineWidth = isLast ? 1.5 : 0;
ctx.beginPath();
ctx.arc(xOf(i), yOf(displayData[i]), r, 0, Math.PI * 2);
ctx.fill();
if (isLast) ctx.stroke();
}
}
// ── X 라벨 ──
ctx.fillStyle = '#6b7280';
ctx.font = '9px monospace';
ctx.textAlign = 'center';
if (displayLabels.length > 0) {
ctx.fillText(displayLabels[0] + 's', PAD_L, PAD_T + gH + 16);
ctx.fillText(displayLabels[displayLabels.length-1] + 's', PAD_L + gW, PAD_T + gH + 16);
if (displayLabels.length > 4) {
const mid = Math.floor(displayLabels.length / 2);
ctx.fillText(displayLabels[mid] + 's', PAD_L + gW * 0.5, PAD_T + gH + 16);
}
const y = this.height - padding - ((displayData[i] - minValue) / range) * graphHeight;
ctx.beginPath();
ctx.arc(x, y, 5, 0, Math.PI * 2);
ctx.fill();
ctx.strokeStyle = '#fff';
ctx.lineWidth = 1;
ctx.stroke();
}
}
}
@@ -542,9 +615,10 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
}
function updateStatus(text, isError) {
const status = document.getElementById('status');
status.textContent = text;
status.className = 'status' + (isError ? ' disconnected' : '');
const el = document.getElementById('status-pill');
if (!el) return;
el.textContent = text;
el.className = 'status' + (isError ? ' disconnected' : '');
}
function loadData() {
@@ -605,13 +679,61 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
function setSortMode(mode) {
sortMode = mode;
document.querySelectorAll('[id^="btn-sort-"]').forEach(btn => btn.classList.remove('active'));
document.getElementById('btn-sort-' + mode).classList.add('active');
createGraphs();
console.log('Sort mode changed to:', mode);
// ★ 버그수정: createGraphs() 호출 시 데이터 초기화 문제
// → 기존 차트 데이터를 보존한 채로 DOM 순서만 재배열
const graphsDiv = document.getElementById('graphs');
const oldCharts = Object.assign({}, charts);
const origSignals = [...selectedSignals];
const sorted = sortSignalsForDisplay();
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() {
@@ -628,10 +750,11 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
const canvas = document.createElement('canvas');
canvas.id = 'chart-' + index;
container.innerHTML =
container.innerHTML =
'<div class="graph-header">' +
'<div class="graph-title">' + signal.name + ' (0x' + signal.messageId.toString(16).toUpperCase() + ')' +
(signal.unit ? ' [' + signal.unit + ']' : '') + '</div>' +
'<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-' + index + '">-</div>' +
'</div>';
@@ -646,40 +769,44 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
function startGraphing() {
if (!graphing) {
graphing = true;
startTime = Date.now();
graphing = true;
startTime = Date.now();
lastTimestamps = {};
updateStatus('Graphing...', false);
console.log('Started graphing at', new Date().toISOString());
document.getElementById('btn-start').classList.add('active');
document.getElementById('btn-stop').classList.remove('active');
updateStatus('Recording', false);
}
}
function stopGraphing() {
graphing = false;
updateStatus('Stopped', false);
console.log('Stopped graphing');
document.getElementById('btn-start').classList.remove('active');
document.getElementById('btn-stop').classList.add('active');
updateStatus('Paused', false);
}
function setScaleMode(mode) {
scaleMode = mode;
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());
console.log('Scale mode changed to:', mode);
}
function setRangeMode(mode) {
rangeMode = mode;
document.getElementById('btn-range-10s').classList.toggle('active', mode === '10s');
document.getElementById('btn-range-all').classList.toggle('active', mode === 'all');
['10s','30s','all'].forEach(m => {
const el = document.getElementById('btn-range-' + m);
if (el) el.classList.toggle('active', m === mode);
});
Object.values(charts).forEach(chart => chart.draw());
}
// ★ 신규: 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());
console.log('Range mode changed to:', mode);
}
// ★★★ 새로운 함수: update 타입 메시지 처리
@@ -1010,9 +1137,10 @@ const char graph_viewer_html[] PROGMEM = R"rawliteral(
chart.draw();
});
lastTimestamps = {};
lastCanCounts = {}; // ★ count 기록도 초기화
startTime = Date.now();
lastTimestamps = {};
lastCanCounts = {};
lastSignalTimes = {}; // ★ 버그수정: 시간 계산 리셋
startTime = Date.now();
totalMsgReceived = 0;
updateStatistics();

1315
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">
<title>Serial2 Terminal - CAN Logger</title>
<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 {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: var(--bg); color: var(--text);
overflow-x: hidden; font-size: 14px;
}
.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 {
background: linear-gradient(135deg, #667eea, #764ba2);
color: white;
padding: 20px 30px;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 2px 10px rgba(0,0,0,0.2);
background: linear-gradient(135deg,#1a2744 0%,#1e1a3a 100%);
padding: 11px 16px; border-bottom: 1px solid var(--border);
display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.header h1 {
font-size: 1.8em;
display: flex;
align-items: center;
gap: 10px;
font-size: 1.0em; font-weight: 700; color: var(--accent);
display: flex; align-items: center; gap: 8px;
}
.header p { font-size: 0.78em; color: var(--muted); margin:0; }
.badge {
background: rgba(255, 255, 255, 0.2);
padding: 5px 12px;
border-radius: 20px;
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;
background: rgba(67,206,162,.15); color: var(--accent);
padding: 2px 8px; border-radius: 12px; font-size: 0.65em;
font-weight: 600; border: 1px solid rgba(67,206,162,.3);
white-space: nowrap;
min-width: 120px;
}
.nav a:hover {
background: #e9ecef;
color: #667eea;
transform: translateY(-2px);
.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 a.active {
color: #764ba2;
border-bottom-color: #764ba2;
background: white;
font-weight: 600;
.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;
}
.content {
padding: 30px;
.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);
}
.control-panel {
background: #f8f9fa;
padding: 20px;
border-radius: 10px;
margin-bottom: 20px;
display: grid;
grid-template-columns: 1fr;
gap: 20px;
h3 {
color: var(--text); font-size: 0.85em; font-weight: 600;
margin-bottom: 10px; padding-bottom: 6px;
border-bottom: 1px solid var(--border);
}
.control-group {
background: white;
padding: 15px;
border-radius: 8px;
border: 1px solid #e0e0e0;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
/* Buttons */
.btn, button {
padding: 6px 13px; border: 1px solid var(--border);
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;
}
.control-group.full-width {
grid-template-columns: 1fr;
.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;
}
.control-section {
display: flex;
flex-direction: column;
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;
}
.control-group h3 {
color: #333;
margin-bottom: 15px;
font-size: 1.1em;
border-bottom: 2px solid #667eea;
padding-bottom: 8px;
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: 120px 1fr;
gap: 10px;
margin-bottom: 12px;
align-items: center;
display:grid;
grid-template-columns:repeat(auto-fit,minmax(min(100%,190px),1fr));
gap:10px; margin-bottom:10px;
}
.form-row label {
color: #555;
font-weight: 500;
.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-row {
display: flex;
align-items: center;
gap: 10px;
margin-top: 12px;
padding: 10px;
background: #f8f9fa;
border-radius: 5px;
.checkbox-group label, .checkbox-row label {
text-transform:none; cursor:pointer; margin-bottom:0;
color:var(--text); font-size:.85em; letter-spacing:0;
}
.checkbox-row input[type="checkbox"] {
width: 18px;
height: 18px;
cursor: pointer;
/* Alerts */
.alert {
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);
}
.checkbox-row label {
color: #555;
font-weight: 500;
cursor: pointer;
.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);
}
select, input[type="text"], input[type="number"] {
padding: 8px 12px;
border: 1px solid #ddd;
border-radius: 5px;
font-size: 14px;
width: 100%;
.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;} }
/* serial terminal specific */
.control-panel {
background:var(--panel); border:1px solid var(--border);
border-radius:var(--r); padding:13px; margin-bottom:10px;
}
select:focus, input:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
.control-group {
background:var(--card); border:1px solid var(--border);
border-radius:var(--r); padding:12px;
display:grid; grid-template-columns:1fr 1fr; gap:16px;
}
.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;
}
@media(max-width:600px){ .control-group{ grid-template-columns:1fr; } }
.control-group.full-width { grid-template-columns:1fr; }
.control-group h3 { grid-column:1/-1; color:var(--accent); font-size:.85em; border-color:var(--border); }
.control-section { display:flex; flex-direction:column; }
.form-row { grid-template-columns:110px 1fr; align-items:center; gap:8px; }
.form-row label { text-transform:none; color:var(--muted); font-size:.80em; margin-bottom:0; }
/* Terminal */
.terminal-container {
background: #1e1e1e;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 5px 20px rgba(0,0,0,0.3);
background:#090d13; border:1px solid var(--border); border-radius:var(--r); overflow:hidden;
}
.terminal-header {
background: #2d2d2d;
padding: 10px 15px;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #444;
background:var(--panel); padding:8px 12px;
display:flex; justify-content:space-between; align-items:center;
border-bottom:1px solid var(--border);
}
.terminal-title {
color: #ccc;
font-size: 13px;
font-weight: 500;
}
.terminal-controls {
display: flex;
gap: 8px;
}
.terminal-title { color:var(--muted); font-size:.78em; font-weight:500; }
.terminal-controls { display:flex; gap:6px; }
.terminal-btn {
padding: 4px 12px;
border: none;
border-radius: 4px;
font-size: 12px;
cursor: pointer;
background: #444;
color: #ccc;
transition: all 0.2s;
padding:3px 10px; border:1px solid var(--border); border-radius:4px;
font-size:.75em; cursor:pointer; background:var(--bg); color:var(--muted);
transition:all .15s; font-family:inherit;
}
.terminal-btn:hover {
background: #555;
}
.terminal-btn:hover { border-color:var(--accent); color:var(--accent); }
.terminal {
height: 400px;
overflow-y: auto;
padding: 15px;
font-family: 'Courier New', monospace;
font-size: 13px;
line-height: 1.5;
color: #f0f0f0;
height:380px; overflow-y:auto; padding:12px;
font-family:'SF Mono','Fira Code','Courier New',monospace;
font-size:12px; line-height:1.55; color:#c9d1d9; background:#090d13;
}
.terminal.teraterm-mode {
height: 350px;
padding-bottom: 5px;
}
.terminal.teraterm-mode { height:330px; }
.terminal::-webkit-scrollbar { width:5px; }
.terminal::-webkit-scrollbar-track { background:#0d1117; }
.terminal::-webkit-scrollbar-thumb { background:#30363d; border-radius:3px; }
.terminal::-webkit-scrollbar-thumb:hover { background:#484f58; }
.terminal-input-area {
display: none;
background: #2d2d2d;
padding: 10px 15px;
border-top: 1px solid #444;
display:none; background:var(--panel); padding:8px 12px;
border-top:1px solid var(--border);
}
.terminal-input-area.active {
display: flex;
align-items: center;
gap: 10px;
}
.terminal-input-area .prompt {
color: #4fc3f7;
font-family: 'Courier New', monospace;
font-size: 13px;
}
.terminal-input-area.active { display:flex; align-items:center; gap:8px; }
.terminal-input-area .prompt { color:var(--accent); font-family:monospace; font-size:.82em; }
.terminal-input-area input {
flex: 1;
background: #1e1e1e;
border: 1px solid #444;
color: #f0f0f0;
padding: 6px 10px;
font-family: 'Courier New', monospace;
font-size: 13px;
border-radius: 3px;
flex:1; background:var(--bg); border:1px solid var(--border);
color:var(--text); padding:5px 8px;
font-family:monospace; font-size:.82em; border-radius:4px;
}
.terminal-input-area input:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}
.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 파싱 스타일 */
.terminal-input-area input:focus { outline:none; border-color:var(--accent); }
/* Log line colors */
.line { margin-bottom:3px; font-family:monospace; }
.timestamp { color:#484f58; margin-right:8px; }
.rx { color:#79c0ff; }
.tx { color:#7ee787; }
/* Modbus */
.modbus-frame {
display: inline-block;
padding: 5px 10px;
margin: 5px 0;
background: #2a2a2a;
border-radius: 5px;
border-left: 3px solid #667eea;
display:inline-block; padding:4px 8px; margin:3px 0;
background:var(--card); border-radius:4px; border-left:2px solid var(--blue);
}
.modbus-addr {
color: #ffd54f;
font-weight: bold;
}
.modbus-func {
color: #81c784;
font-weight: bold;
}
.modbus-data {
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;
}
.modbus-addr { color:var(--yellow); font-weight:bold; }
.modbus-func { color:var(--accent); font-weight:bold; }
.modbus-data { color:#79c0ff; }
.modbus-crc { color:#ffa657; }
.modbus-label { color:var(--muted); font-size:.85em; margin-left:4px; }
.modbus-error { color:var(--red); }
/* Send / Stats */
.send-panel { margin-top:10px; }
.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; }
.stats { margin-top:10px; }
.stat-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 15px;
display:grid;
grid-template-columns:repeat(auto-fit,minmax(min(100%,120px),1fr));
gap:8px;
}
.stat-item {
text-align: center;
padding: 15px;
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;
}
text-align:center; padding:11px; background:var(--card);
border-radius:var(--r); border:1px solid var(--border);
}
.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>
</head>
<body>
<div class="container">
<div class="header">
<div class="header">
<h1>
📟 Serial2 Terminal
<span class="badge">GPIO 6/7</span>
</h1>
</div>
<div class="nav">
<div class="nav">
<a href="/">📊 Monitor</a>
<a href="/transmit">📤 Transmit</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>
</div>
<div class="content">
<div class="content">
<div class="control-panel">
<div class="control-group">
<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">
<title>Serial1 Terminal - CAN Logger</title>
<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 {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: var(--bg); color: var(--text);
overflow-x: hidden; font-size: 14px;
}
.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 {
background: linear-gradient(135deg, #667eea, #764ba2);
color: white;
padding: 20px 30px;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 2px 10px rgba(0,0,0,0.2);
background: linear-gradient(135deg,#1a2744 0%,#1e1a3a 100%);
padding: 11px 16px; border-bottom: 1px solid var(--border);
display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.header h1 {
font-size: 1.8em;
display: flex;
align-items: center;
gap: 10px;
font-size: 1.0em; font-weight: 700; color: var(--accent);
display: flex; align-items: center; gap: 8px;
}
.header p { font-size: 0.78em; color: var(--muted); margin:0; }
.badge {
background: rgba(255, 255, 255, 0.2);
padding: 5px 12px;
border-radius: 20px;
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;
background: rgba(67,206,162,.15); color: var(--accent);
padding: 2px 8px; border-radius: 12px; font-size: 0.65em;
font-weight: 600; border: 1px solid rgba(67,206,162,.3);
white-space: nowrap;
min-width: 120px;
}
.nav a:hover {
background: #e9ecef;
color: #667eea;
transform: translateY(-2px);
.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 a.active {
color: #764ba2;
border-bottom-color: #764ba2;
background: white;
font-weight: 600;
.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;
}
.content {
padding: 30px;
.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);
}
.control-panel {
background: #f8f9fa;
padding: 20px;
border-radius: 10px;
margin-bottom: 20px;
display: grid;
grid-template-columns: 1fr;
gap: 20px;
h3 {
color: var(--text); font-size: 0.85em; font-weight: 600;
margin-bottom: 10px; padding-bottom: 6px;
border-bottom: 1px solid var(--border);
}
.control-group {
background: white;
padding: 15px;
border-radius: 8px;
border: 1px solid #e0e0e0;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
/* Buttons */
.btn, button {
padding: 6px 13px; border: 1px solid var(--border);
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;
}
.control-group.full-width {
grid-template-columns: 1fr;
.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;
}
.control-section {
display: flex;
flex-direction: column;
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;
}
.control-group h3 {
color: #333;
margin-bottom: 15px;
font-size: 1.1em;
border-bottom: 2px solid #667eea;
padding-bottom: 8px;
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: 120px 1fr;
gap: 10px;
margin-bottom: 12px;
align-items: center;
display:grid;
grid-template-columns:repeat(auto-fit,minmax(min(100%,190px),1fr));
gap:10px; margin-bottom:10px;
}
.form-row label {
color: #555;
font-weight: 500;
.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-row {
display: flex;
align-items: center;
gap: 10px;
margin-top: 12px;
padding: 10px;
background: #f8f9fa;
border-radius: 5px;
.checkbox-group label, .checkbox-row label {
text-transform:none; cursor:pointer; margin-bottom:0;
color:var(--text); font-size:.85em; letter-spacing:0;
}
.checkbox-row input[type="checkbox"] {
width: 18px;
height: 18px;
cursor: pointer;
/* Alerts */
.alert {
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);
}
.checkbox-row label {
color: #555;
font-weight: 500;
cursor: pointer;
.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);
}
select, input[type="text"], input[type="number"] {
padding: 8px 12px;
border: 1px solid #ddd;
border-radius: 5px;
font-size: 14px;
width: 100%;
.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;} }
/* serial terminal specific */
.control-panel {
background:var(--panel); border:1px solid var(--border);
border-radius:var(--r); padding:13px; margin-bottom:10px;
}
select:focus, input:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
.control-group {
background:var(--card); border:1px solid var(--border);
border-radius:var(--r); padding:12px;
display:grid; grid-template-columns:1fr 1fr; gap:16px;
}
.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;
}
@media(max-width:600px){ .control-group{ grid-template-columns:1fr; } }
.control-group.full-width { grid-template-columns:1fr; }
.control-group h3 { grid-column:1/-1; color:var(--accent); font-size:.85em; border-color:var(--border); }
.control-section { display:flex; flex-direction:column; }
.form-row { grid-template-columns:110px 1fr; align-items:center; gap:8px; }
.form-row label { text-transform:none; color:var(--muted); font-size:.80em; margin-bottom:0; }
/* Terminal */
.terminal-container {
background: #1e1e1e;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 5px 20px rgba(0,0,0,0.3);
background:#090d13; border:1px solid var(--border); border-radius:var(--r); overflow:hidden;
}
.terminal-header {
background: #2d2d2d;
padding: 10px 15px;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #444;
background:var(--panel); padding:8px 12px;
display:flex; justify-content:space-between; align-items:center;
border-bottom:1px solid var(--border);
}
.terminal-title {
color: #ccc;
font-size: 13px;
font-weight: 500;
}
.terminal-controls {
display: flex;
gap: 8px;
}
.terminal-title { color:var(--muted); font-size:.78em; font-weight:500; }
.terminal-controls { display:flex; gap:6px; }
.terminal-btn {
padding: 4px 12px;
border: none;
border-radius: 4px;
font-size: 12px;
cursor: pointer;
background: #444;
color: #ccc;
transition: all 0.2s;
padding:3px 10px; border:1px solid var(--border); border-radius:4px;
font-size:.75em; cursor:pointer; background:var(--bg); color:var(--muted);
transition:all .15s; font-family:inherit;
}
.terminal-btn:hover {
background: #555;
}
.terminal-btn:hover { border-color:var(--accent); color:var(--accent); }
.terminal {
height: 400px;
overflow-y: auto;
padding: 15px;
font-family: 'Courier New', monospace;
font-size: 13px;
line-height: 1.5;
color: #f0f0f0;
height:380px; overflow-y:auto; padding:12px;
font-family:'SF Mono','Fira Code','Courier New',monospace;
font-size:12px; line-height:1.55; color:#c9d1d9; background:#090d13;
}
.terminal.teraterm-mode {
height: 350px;
padding-bottom: 5px;
}
.terminal.teraterm-mode { height:330px; }
.terminal::-webkit-scrollbar { width:5px; }
.terminal::-webkit-scrollbar-track { background:#0d1117; }
.terminal::-webkit-scrollbar-thumb { background:#30363d; border-radius:3px; }
.terminal::-webkit-scrollbar-thumb:hover { background:#484f58; }
.terminal-input-area {
display: none;
background: #2d2d2d;
padding: 10px 15px;
border-top: 1px solid #444;
display:none; background:var(--panel); padding:8px 12px;
border-top:1px solid var(--border);
}
.terminal-input-area.active {
display: flex;
align-items: center;
gap: 10px;
}
.terminal-input-area .prompt {
color: #4fc3f7;
font-family: 'Courier New', monospace;
font-size: 13px;
}
.terminal-input-area.active { display:flex; align-items:center; gap:8px; }
.terminal-input-area .prompt { color:var(--accent); font-family:monospace; font-size:.82em; }
.terminal-input-area input {
flex: 1;
background: #1e1e1e;
border: 1px solid #444;
color: #f0f0f0;
padding: 6px 10px;
font-family: 'Courier New', monospace;
font-size: 13px;
border-radius: 3px;
flex:1; background:var(--bg); border:1px solid var(--border);
color:var(--text); padding:5px 8px;
font-family:monospace; font-size:.82em; border-radius:4px;
}
.terminal-input-area input:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}
.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 파싱 스타일 */
.terminal-input-area input:focus { outline:none; border-color:var(--accent); }
/* Log line colors */
.line { margin-bottom:3px; font-family:monospace; }
.timestamp { color:#484f58; margin-right:8px; }
.rx { color:#79c0ff; }
.tx { color:#7ee787; }
/* Modbus */
.modbus-frame {
display: inline-block;
padding: 5px 10px;
margin: 5px 0;
background: #2a2a2a;
border-radius: 5px;
border-left: 3px solid #667eea;
display:inline-block; padding:4px 8px; margin:3px 0;
background:var(--card); border-radius:4px; border-left:2px solid var(--blue);
}
.modbus-addr {
color: #ffd54f;
font-weight: bold;
}
.modbus-func {
color: #81c784;
font-weight: bold;
}
.modbus-data {
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;
}
.modbus-addr { color:var(--yellow); font-weight:bold; }
.modbus-func { color:var(--accent); font-weight:bold; }
.modbus-data { color:#79c0ff; }
.modbus-crc { color:#ffa657; }
.modbus-label { color:var(--muted); font-size:.85em; margin-left:4px; }
.modbus-error { color:var(--red); }
/* Send / Stats */
.send-panel { margin-top:10px; }
.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; }
.stats { margin-top:10px; }
.stat-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 15px;
display:grid;
grid-template-columns:repeat(auto-fit,minmax(min(100%,120px),1fr));
gap:8px;
}
.stat-item {
text-align: center;
padding: 15px;
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;
}
text-align:center; padding:11px; background:var(--card);
border-radius:var(--r); border:1px solid var(--border);
}
.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>
</head>
<body>
<div class="container">
<div class="header">
<div class="header">
<h1>
📟 Serial1 Terminal
<span class="badge">GPIO 17/18</span>
</h1>
</div>
<div class="nav">
<div class="nav">
<a href="/">📊 Monitor</a>
<a href="/transmit">📤 Transmit</a>
<a href="/graph">📈 Graph</a>
@@ -544,7 +290,7 @@ const char serial_terminal_html[] PROGMEM = R"rawliteral(
<a href="/serial2">📟 Serial2</a>
</div>
<div class="content">
<div class="content">
<div class="control-panel">
<div class="control-group">
<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">
<title>Settings - Byun CAN Logger</title>
<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 {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
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;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: var(--bg); color: var(--text);
overflow-x: hidden; font-size: 14px;
}
/* Header */
.header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: #666;
padding: 20px;
text-align: center;
background: linear-gradient(135deg,#1a2744 0%,#1e1a3a 100%);
padding: 11px 16px; border-bottom: 1px solid var(--border);
display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.header h1 { font-size: 1.8em; margin-bottom: 5px; }
.header p { opacity: 0.9; font-size: 0.9em; }
/* ========== 통일된 네비게이션 ========== */
.nav {
background: #f8f9fa;
padding: 0;
border-bottom: 2px solid #e0e0e0;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
.header h1 {
font-size: 1.0em; font-weight: 700; color: var(--accent);
display: flex; align-items: center; gap: 8px;
}
.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;
.header p { font-size: 0.78em; color: var(--muted); margin:0; }
.badge {
background: rgba(67,206,162,.15); color: var(--accent);
padding: 2px 8px; border-radius: 12px; font-size: 0.65em;
font-weight: 600; border: 1px solid rgba(67,206,162,.3);
white-space: nowrap;
min-width: 120px;
}
.nav a:hover {
background: #e9ecef;
color: #667eea;
transform: translateY(-2px);
.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 a.active {
color: #764ba2;
border-bottom-color: #764ba2;
background: white;
font-weight: 600;
.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;
}
.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);
.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);
}
.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;
h3 {
color: var(--text); font-size: 0.85em; font-weight: 600;
margin-bottom: 10px; padding-bottom: 6px;
border-bottom: 1px solid var(--border);
}
.form-group {
margin-bottom: 20px;
/* Buttons */
.btn, button {
padding: 6px 13px; border: 1px solid var(--border);
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;
}
.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 {
display: block;
font-weight: 600;
color: #333;
margin-bottom: 8px;
font-size: 0.95em;
display:block; font-weight:600; color:var(--muted);
margin-bottom:4px; font-size:.78em;
text-transform:uppercase; letter-spacing:.3px;
}
.help-text {
font-size: 0.85em;
color: #666;
margin-top: 5px;
line-height: 1.4;
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[type="text"],
input[type="password"] {
width: 100%;
padding: 12px 15px;
border: 2px solid #e1e8ed;
border-radius: 8px;
font-size: 0.95em;
transition: all 0.3s;
background: white;
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="text"]:focus,
input[type="password"]:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
input[type="checkbox"], input[type="radio"] {
width:15px; height:15px; cursor:pointer; accent-color:var(--accent);
}
input[type="checkbox"] {
width: 20px;
height: 20px;
cursor: pointer;
margin-right: 10px;
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;
}
.checkbox-group {
display: flex;
align-items: center;
margin-bottom: 15px;
.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;
}
.checkbox-group label {
margin-bottom: 0;
cursor: pointer;
user-select: none;
.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);
}
.sta-settings {
background: #f0f4f8;
padding: 20px;
border-radius: 8px;
margin-top: 15px;
border-left: 4px solid #667eea;
.checkbox-group label, .checkbox-row label {
text-transform:none; cursor:pointer; margin-bottom:0;
color:var(--text); font-size:.85em; letter-spacing:0;
}
.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 {
padding: 15px 20px;
border-radius: 8px;
margin-bottom: 20px;
display: none;
align-items: center;
gap: 12px;
animation: slideDown 0.3s ease-out;
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);
}
@keyframes slideDown {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
}
.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);
}
.alert.show {
display: flex;
.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;} }
/* 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;
}
.alert-success {
background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
color: #666;
.sta-settings {
background:var(--card); padding:13px; border-radius:var(--r);
margin-top:10px; border:1px solid var(--border); border-left:3px solid var(--blue);
}
.alert-info {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: #666;
}
.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;
}
.sta-settings.disabled { opacity:.4; pointer-events:none; }
.btn-save { border-color:var(--accent); color:var(--accent); flex:1; min-width:130px; padding:9px 18px; }
.btn-save:hover { background:rgba(67,206,162,.10); }
.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); }
.info-box {
background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
border-left: 4px solid #667eea;
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;
}
background:rgba(88,166,255,.06); border:1px solid rgba(88,166,255,.2);
border-left:3px solid var(--blue); padding:11px 13px; border-radius:var(--r); margin-top:10px;
}
.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>
</head>
<body>
<div class="container">
<div class="header">
<div class="header">
<h1> Settings</h1>
<p>Configure WiFi and System Settings</p>
</div>
<div class="nav">
<div class="nav">
<a href="/">📊 Monitor</a>
<a href="/transmit">📤 Transmit</a>
<a href="/graph">📈 Graph</a>
@@ -364,7 +223,7 @@ const char settings_html[] PROGMEM = R"rawliteral(
<a href="/serial2">📟 Serial2</a>
</div>
<div class="content">
<div class="content">
<div id="alert-success" class="alert alert-success">
<span class="alert-icon"></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>
<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>
</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">
<title>CAN Transmit - Sequence Editor</title>
<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 {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
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;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: var(--bg); color: var(--text);
overflow-x: hidden; font-size: 14px;
}
/* Header */
.header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 20px;
text-align: center;
background: linear-gradient(135deg,#1a2744 0%,#1e1a3a 100%);
padding: 11px 16px; border-bottom: 1px solid var(--border);
display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.header h1 { font-size: 1.8em; margin-bottom: 5px; }
.header p { opacity: 0.9; font-size: 0.9em; }
/* ========== 통일된 네비게이션 ========== */
.nav {
background: #f8f9fa;
padding: 0;
border-bottom: 2px solid #e0e0e0;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
.header h1 {
font-size: 1.0em; font-weight: 700; color: var(--accent);
display: flex; align-items: center; gap: 8px;
}
.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;
.header p { font-size: 0.78em; color: var(--muted); margin:0; }
.badge {
background: rgba(67,206,162,.15); color: var(--accent);
padding: 2px 8px; border-radius: 12px; font-size: 0.65em;
font-weight: 600; border: 1px solid rgba(67,206,162,.3);
white-space: nowrap;
min-width: 120px;
}
.nav a:hover {
background: #e9ecef;
color: #667eea;
transform: translateY(-2px);
.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 a.active {
color: #764ba2;
border-bottom-color: #764ba2;
background: white;
font-weight: 600;
.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;
}
.content { padding: 20px; }
.section {
background: #f8f9fa;
border-radius: 10px;
padding: 20px;
margin-bottom: 20px;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--accent); border-bottom-color: var(--accent); }
/* Content */
.content { padding: 12px; }
/* Headings */
h2 {
color: #333;
margin-bottom: 15px;
font-size: 1.3em;
border-bottom: 3px solid #667eea;
padding-bottom: 8px;
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);
}
.form-row {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 15px;
margin-bottom: 15px;
h3 {
color: var(--text); font-size: 0.85em; font-weight: 600;
margin-bottom: 10px; padding-bottom: 6px;
border-bottom: 1px solid var(--border);
}
.form-group {
display: flex;
flex-direction: column;
/* Buttons */
.btn, button {
padding: 6px 13px; border: 1px solid var(--border);
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 {
font-weight: 600;
margin-bottom: 5px;
color: #333;
font-size: 0.9em;
display:block; font-weight:600; color:var(--muted);
margin-bottom:4px; font-size:.78em;
text-transform:uppercase; letter-spacing:.3px;
}
input, select {
padding: 10px;
border: 2px solid #ddd;
border-radius: 5px;
font-size: 1em;
transition: all 0.3s;
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 {
outline: none;
border-color: #667eea;
input:focus, select:focus, textarea:focus {
outline:none; border-color:var(--accent);
box-shadow:0 0 0 2px rgba(67,206,162,.10);
}
.button-group {
display: flex;
gap: 10px;
flex-wrap: wrap;
input[type="checkbox"], input[type="radio"] {
width:15px; height:15px; cursor:pointer; accent-color:var(--accent);
}
button {
padding: 12px 24px;
border: none;
border-radius: 5px;
font-size: 1em;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
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;
}
.btn-primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
.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;
}
.btn-success {
background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
color: white;
.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);
}
.btn-danger {
background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
color: white;
.checkbox-group label, .checkbox-row label {
text-transform:none; cursor:pointer; margin-bottom:0;
color:var(--text); font-size:.85em; letter-spacing:0;
}
.btn-warning {
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
color: white;
/* Alerts */
.alert {
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);
}
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; }
.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: 8px 15px;
border-radius: 20px;
font-size: 0.85em;
font-weight: 600;
z-index: 1000;
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 {
background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
color: white;
.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;} }
/* 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 {
background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
color: white;
.steps-list::-webkit-scrollbar { width:5px; }
.steps-list::-webkit-scrollbar-track { background:var(--panel); }
.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;
}
/* ========== 반응형 디자인 ========== */
@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;
}
.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 {
display:grid;
grid-template-columns:repeat(auto-fill,minmax(min(100%,260px),1fr));
gap:8px;
}
@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;
}
.sequence-card {
background:var(--card); padding:12px; border-radius:var(--r);
border:1px solid var(--border); transition:border-color .15s;
}
.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>
</head>
<body>
<div id="connection-status" class="connection-status disconnected">🔴 Disconnected</div>
<div class="container">
<div class="header">
<div class="header">
<h1>🚀 CAN Sequence Transmitter</h1>
<p>Create and Execute CAN Message Sequences</p>
</div>
<div class="nav">
<div class="nav">
<a href="/">📊 Monitor</a>
<a href="/transmit" class="active">📤 Transmit</a>
<a href="/graph">📈 Graph</a>
@@ -342,7 +236,7 @@ const char transmit_html[] PROGMEM = R"rawliteral(
<a href="/serial2">📟 Serial2</a>
</div>
<div class="content">
<div class="content">
<div class="section">
<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) {
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) {
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) {
const seq = data.sequence;
console.log(' Sequence Detail :', data);
document.getElementById('seq-name').value = seq.name;
document.getElementById('repeat-mode').value = seq.mode !== undefined ? seq.mode : seq.repeatMode;
document.getElementById('repeat-count').value = seq.count !== undefined ? seq.count : seq.repeatCount;
// ESP32에서 보낸 형식에 맞춰 처리
document.getElementById('seq-name').value = data.name || '';
document.getElementById('repeat-mode').value = data.repeatMode !== undefined ? data.repeatMode : 0;
document.getElementById('repeat-count').value = data.repeatCount !== undefined ? data.repeatCount : 1;
currentSteps = [];
if (seq.steps && Array.isArray(seq.steps)) {
seq.steps.forEach(step => {
if (data.steps && Array.isArray(data.steps)) {
data.steps.forEach(step => {
let dataBytes = [];
if (typeof step.data === 'string') {
dataBytes = step.data.split(' ').map(b => parseInt(b, 16));
@@ -707,7 +616,7 @@ const char transmit_html[] PROGMEM = R"rawliteral(
}
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,
dlc: step.dlc,
data: dataBytes,
@@ -719,6 +628,7 @@ const char transmit_html[] PROGMEM = R"rawliteral(
updateStepsList();
document.querySelector('.section').scrollIntoView({ behavior: 'smooth' });
alert('Sequence loaded! You can now edit and save it.');
console.log(' Loaded steps:', currentSteps);
}
function startSequence(index) {