diff --git a/templates/attemptv2.html b/templates/attemptv2.html index 4cd7eb9..ef5bb4f 100644 --- a/templates/attemptv2.html +++ b/templates/attemptv2.html @@ -64,20 +64,13 @@ let startTime = 0; let intervalId = null; + const integerNumber = (num) => parseInt(num); + const decimalNumber = (num) => parseFloat(num.toFixed(1)); + // Update RPM and Power function updateRpmPower(rpm, power) { - - // Update displays - rpmDisplay.textContent = rpm; - powerDisplay.textContent = power; - - const newData = { - x: data.length, - y: rpm, - }; - - // Add the new data point to the data array - data.push(newData); + rpmDisplay.textContent = integerNumber(rpm); + powerDisplay.textContent = integerNumber(power); } // Update Duration @@ -258,6 +251,14 @@ let rpm = revsToRPM(prevRes, res); if (rpm > 0) { + const newData = { + x: data.length, + y: decimalNumber(rpm), + }; + + // Add the new data point to the data array + data.push(newData); + updateRpmPower(rpm, 0); updateGraph(); /*