UL212 FAQ/未命名
`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fuel Sensor Configure — 10 Points</title>
<style>
- root{
--bg:#12181c;
--panel:#1a2226;
--panel-2:#202a2f;
--line:#2c383e;
--text:#e7ecee;
--muted:#8fa3ab;
--accent:#ffb703;
--accent-dim:#8a6a10;
--fixed:#3a4750;
--green:#3ea87a;
--mono: 'Consolas', 'SFMono-Regular', Menlo, monospace;
}
- {box-sizing:border-box;}
body{
margin:0;
background:var(--bg);
color:var(--text);
font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
padding:32px 16px 64px;
}
.wrap{max-width:760px;margin:0 auto;}
header{margin-bottom:24px;}
.eyebrow{
font-family:var(--mono);
font-size:12px;
letter-spacing:.12em;
color:var(--accent);
text-transform:uppercase;
}
h1{
font-size:22px;
font-weight:600;
margin:6px 0 4px;
letter-spacing:-.01em;
}
.sub{color:var(--muted); font-size:14px; line-height:1.5;}
.panel{
background:var(--panel);
border:1px solid var(--line);
border-radius:10px;
padding:20px;
margin-bottom:20px;
}
.panel h2{
font-size:13px;
text-transform:uppercase;
letter-spacing:.08em;
color:var(--muted);
margin:0 0 14px;
font-weight:600;
}
.inputs-row{
display:grid;
grid-template-columns:1fr 1fr;
gap:14px;
}
.field label{
display:block;
font-size:12px;
color:var(--muted);
margin-bottom:6px;
}
.field .unit{color:var(--accent-dim);}
.field input{
width:100%;
background:#0f1518;
border:1px solid var(--line);
color:var(--accent);
font-family:var(--mono);
font-size:18px;
font-weight:600;
padding:10px 12px;
border-radius:6px;
outline:none;
}
.field input:focus{border-color:var(--accent);}
.note{
font-size:12px;
color:var(--muted);
margin-top:12px;
line-height:1.5;
border-left:2px solid var(--line);
padding-left:10px;
}
table{
width:100%;
border-collapse:collapse;
font-family:var(--mono);
font-size:13px;
}
th{
text-align:right;
font-size:11px;
text-transform:uppercase;
letter-spacing:.06em;
color:var(--muted);
font-weight:600;
padding:0 10px 10px;
border-bottom:1px solid var(--line);
}
th:first-child, td:first-child{text-align:left;}
td{
padding:9px 10px;
text-align:right;
border-bottom:1px solid var(--line);
}
tr:last-child td{border-bottom:none;}
.point-id{color:var(--muted); font-weight:600;}
.val-fixed{color:var(--fixed);}
.val-calc{color:var(--text);}
.val-input{color:var(--accent); font-weight:600;}
tr.row-fixed td.point-id::after,
tr.row-input td.point-id::after{
content:;
}
.tag{
display:inline-block;
font-size:9px;
letter-spacing:.05em;
text-transform:uppercase;
padding:2px 5px;
border-radius:3px;
margin-left:6px;
vertical-align:1px;
}
.tag-fixed{background:#26313a; color:var(--muted);}
.tag-input{background:var(--accent-dim); color:var(--accent);}
.actions{
display:flex;
gap:10px;
margin-top:18px;
flex-wrap:wrap;
}
button{
font-family:inherit;
font-size:13px;
font-weight:600;
padding:9px 16px;
border-radius:6px;
border:1px solid var(--line);
background:var(--panel-2);
color:var(--text);
cursor:pointer;
}
button:hover{border-color:var(--muted);}
button.primary{
background:var(--accent);
color:#1a1400;
border-color:var(--accent);
}
button.primary:hover{opacity:.9;}
- copyMsg{
font-size:12px;
color:var(--green);
align-self:center;
opacity:0;
transition:opacity .2s;
}
- copyMsg.show{opacity:1;}
footer{
margin-top:28px;
font-size:11px;
color:var(--muted);
text-align:center;
}
@media (max-width:480px){
.inputs-row{grid-template-columns:1fr;}
table{font-size:12px;}
th,td{padding:7px 6px;}
}
</style>
</head>
<body>
<div class="wrap">
<header>
<div class="eyebrow">Calibration tool</div>
<h1>Fuel sensor configure — 10 points</h1>
<div class="sub">Enter the tank's full height and full capacity below. Points 2–9 are calculated automatically as 9 equal steps.</div>
</header>
<div class="panel">
<h2>Tank inputs</h2>
<div class="inputs-row">
<div class="field">
<label>Full tank height <span class="unit">(mm)</span></label>
<input type="number" id="fullHeight" value="700" step="any">
</div>
<div class="field">
<label>Full tank capacity <span class="unit">(Litre)</span></label>
<input type="number" id="fullCapacity" value="650" step="any">
</div>
</div>
<div class="note">
Point 1 is fixed at 10 mm / 0 L (sensor mounting offset — do not change).
Points 2–9 are generated automatically: each step = full value ÷ 9.
</div>
</div>
<div class="panel">
<h2>10-point table</h2>
<table>
<thead>
<tr>
<th>Point</th>
<th>Tank height (mm)</th>
<th>Tank capacity (L)</th>
</tr>
</thead>
<tbody id="tableBody"></tbody>
</table>
<div class="actions"> <button class="primary" id="copyBtn">Copy table</button> <button id="csvBtn">Download CSV</button> <button id="resetBtn">Reset to default</button> <span id="copyMsg">Copied</span> </div>
</div>
<footer>Converted from Fuel_Sensor_Configure_10_points.xlsx — logic preserved: point 1 fixed, point 10 manual, points 2–9 auto-generated.</footer>
</div>
<script>
const fullHeightEl = document.getElementById('fullHeight');
const fullCapacityEl = document.getElementById('fullCapacity');
const tableBody = document.getElementById('tableBody');
const FIXED_HEIGHT_P1 = 10;
const FIXED_CAPACITY_P1 = 0;
function round2(n){
return Math.round(n * 100) / 100;
}
function compute(){
const fullHeight = parseFloat(fullHeightEl.value) || 0;
const fullCapacity = parseFloat(fullCapacityEl.value) || 0;
const heightStep = fullHeight / 9;
const capacityStep = fullCapacity / 9;
const heights = new Array(11);
const capacities = new Array(11);
heights[1] = FIXED_HEIGHT_P1;
capacities[1] = FIXED_CAPACITY_P1;
heights[10] = fullHeight;
capacities[10] = fullCapacity;
for (let p = 9; p >= 2; p--) {
heights[p] = round2(heights[p + 1] - heightStep);
capacities[p] = round2(capacities[p + 1] - capacityStep);
}
return { heights, capacities };
}
function render(){
const { heights, capacities } = compute();
let rows = ;
for (let p = 1; p <= 10; p++){
let rowClass = ;
let tag = ;
let valClass = 'val-calc';
if (p === 1){
rowClass = 'row-fixed';
tag = '<span class="tag tag-fixed">fixed</span>';
valClass = 'val-fixed';
} else if (p === 10){
rowClass = 'row-input';
tag = '<span class="tag tag-input">manual</span>';
valClass = 'val-input';
}
rows += <tr class="${rowClass}"> <td class="point-id">${p}${tag}</td> <td class="${valClass}">${heights[p].toLocaleString(undefined,{maximumFractionDigits:2})}</td> <td class="${valClass}">${capacities[p].toLocaleString(undefined,{maximumFractionDigits:2})}</td> </tr>;
}
tableBody.innerHTML = rows;
}
function tableToText(){
const { heights, capacities } = compute();
let lines = ['Point\tTank Height (mm)\tTank Capacity (Litre)'];
for (let p = 1; p <= 10; p++){
lines.push(${p}\t${heights[p]}\t${capacities[p]});
}
return lines.join('\n');
}
document.getElementById('copyBtn').addEventListener('click', async () => {
const text = tableToText();
try{
await navigator.clipboard.writeText(text);
} catch(e){
const ta = document.createElement('textarea');
ta.value = text;
document.body.appendChild(ta);
ta.select();
document.execCommand('copy');
document.body.removeChild(ta);
}
const msg = document.getElementById('copyMsg');
msg.classList.add('show');
setTimeout(() => msg.classList.remove('show'), 1400);
});
document.getElementById('csvBtn').addEventListener('click', () => {
const { heights, capacities } = compute();
let csv = 'Point,Tank Height (mm),Tank Capacity (Litre)\n';
for (let p = 1; p <= 10; p++){
csv += ${p},${heights[p]},${capacities[p]}\n;
}
const blob = new Blob([csv], { type: 'text/csv' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'fuel_sensor_10_points.csv';
a.click();
URL.revokeObjectURL(url);
});
document.getElementById('resetBtn').addEventListener('click', () => {
fullHeightEl.value = 700;
fullCapacityEl.value = 650;
render();
});
fullHeightEl.addEventListener('input', render);
fullCapacityEl.addEventListener('input', render);
render();
</script>
</body>
</html>`