File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
TankAlarm-112025-Server-BluesOpta Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1083,7 +1083,7 @@ static const char DASHBOARD_HTML[] PROGMEM = R"HTML(
10831083 <th>Client</th>
10841084 <th>Site</th>
10851085 <th>Tank</th>
1086- <th>Level (in) </th>
1086+ <th>Level</th>
10871087 <th>Status</th>
10881088 <th>Updated</th>
10891089 <th>Refresh</th>
@@ -1148,6 +1148,18 @@ static const char DASHBOARD_HTML[] PROGMEM = R"HTML(
11481148 return (typeof value === 'number' && isFinite(value)) ? value.toFixed(1) : '--';
11491149 }
11501150
1151+ function formatLevel(inches) {
1152+ if (typeof inches !== 'number' || !isFinite(inches)) {
1153+ return '--';
1154+ }
1155+ const feet = Math.floor(inches / 12);
1156+ const remainingInches = inches % 12;
1157+ if (feet === 0) {
1158+ return `${remainingInches.toFixed(1)}"`;
1159+ }
1160+ return `${feet}' ${remainingInches.toFixed(1)}"`;
1161+ }
1162+
11511163 function formatEpoch(epoch) {
11521164 if (!epoch) return '--';
11531165 const date = new Date(epoch * 1000);
@@ -1216,7 +1228,7 @@ static const char DASHBOARD_HTML[] PROGMEM = R"HTML(
12161228 <td><code>${row.client || '--'}</code></td>
12171229 <td>${row.site || '--'}</td>
12181230 <td>${row.label || 'Tank'} #${row.tank || '?'}</td>
1219- <td>${formatNumber (row.levelInches)}</td>
1231+ <td>${formatLevel (row.levelInches)}</td>
12201232 <td>${statusBadge(row)}</td>
12211233 <td>${formatEpoch(row.lastUpdate)}</td>
12221234 <td>${refreshButton(row)}</td>`;
You can’t perform that action at this time.
0 commit comments