Skip to content

Commit 7fd57cb

Browse files
Copilotdorkmo
andcommitted
Change level display to feet and inches format (ft/in)
Co-authored-by: dorkmo <[email protected]>
1 parent 979c1aa commit 7fd57cb

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

TankAlarm-112025-Viewer-BluesOpta/TankAlarm-112025-Viewer-BluesOpta.ino

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ static const char VIEWER_DASHBOARD_HTML[] PROGMEM = R"HTML(
237237
<tr>
238238
<th>Site</th>
239239
<th>Tank</th>
240-
<th>Level (in)</th>
240+
<th>Level (ft/in)</th>
241241
<th>24hr Change</th>
242242
<th>Updated</th>
243243
</tr>
@@ -382,7 +382,7 @@ static const char VIEWER_DASHBOARD_HTML[] PROGMEM = R"HTML(
382382
tr.innerHTML = `
383383
<td>${escapeHtml(tank.site, '--')}</td>
384384
<td>${escapeHtml(tank.label || 'Tank')} #${escapeHtml((tank.tank ?? '?'))}</td>
385-
<td>${formatNumber(tank.levelInches)}</td>
385+
<td>${formatFeetInches(tank.levelInches)}</td>
386386
<td>--</td>
387387
<td>${formatEpoch(tank.lastUpdate)}</td>`;
388388
tbody.appendChild(tr);
@@ -401,6 +401,13 @@ static const char VIEWER_DASHBOARD_HTML[] PROGMEM = R"HTML(
401401
return (typeof val === 'number' && isFinite(val)) ? val.toFixed(1) : '--';
402402
}
403403
404+
function formatFeetInches(inches) {
405+
if (typeof inches !== 'number' || !isFinite(inches)) return '--';
406+
const feet = Math.floor(inches / 12);
407+
const remainingInches = inches % 12;
408+
return `${feet}' ${remainingInches.toFixed(1)}"`;
409+
}
410+
404411
function formatEpoch(epoch) {
405412
if (!epoch) return '--';
406413
const date = new Date(epoch * 1000);

0 commit comments

Comments
 (0)