Render rpm, power as integers, and plot rpm with one decimal place
This commit is contained in:
@@ -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();
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user