Skip to content

Commit c58be22

Browse files
Copilotdorkmo
andcommitted
Fix floating-point precision in formatFeetInches and remove unused formatNumber
Co-authored-by: dorkmo <[email protected]>
1 parent 4d1180f commit c58be22

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,14 +397,10 @@ static const char VIEWER_DASHBOARD_HTML[] PROGMEM = R"HTML(
397397
return `<span class="status-pill alarm">${label}</span>`;
398398
}
399399
400-
function formatNumber(val) {
401-
return (typeof val === 'number' && isFinite(val)) ? val.toFixed(1) : '--';
402-
}
403-
404400
function formatFeetInches(inches) {
405401
if (typeof inches !== 'number' || !isFinite(inches) || inches < 0) return '--';
406402
const feet = Math.floor(inches / 12);
407-
const remainingInches = inches % 12;
403+
const remainingInches = inches - (feet * 12);
408404
return `${feet}' ${remainingInches.toFixed(1)}"`;
409405
}
410406

0 commit comments

Comments
 (0)