Update watts -> power
This commit is contained in:
@@ -111,10 +111,10 @@
|
||||
const integerNumber = (num) => parseInt(num);
|
||||
const decimalNumber = (num) => parseFloat(num.toFixed(1));
|
||||
|
||||
function updateBikeDisplay(distance, calories, watts, speed, rpm) {
|
||||
function updateBikeDisplay(distance, calories, power, speed, rpm) {
|
||||
distanceDisplay.textContent = decimalNumber(distance);
|
||||
caloriesDisplay.textContent = decimalNumber(calories);
|
||||
wattsDisplay.textContent = integerNumber(watts);
|
||||
wattsDisplay.textContent = integerNumber(power);
|
||||
speedDisplay.textContent = decimalNumber(speed);
|
||||
rpmDisplay.textContent = integerNumber(rpm);
|
||||
}
|
||||
@@ -324,18 +324,18 @@
|
||||
// Add the new data point to the data array
|
||||
data.push(newData);
|
||||
|
||||
let watts = generators['{{ user.bike.code_name }}'].rpm.power(rpm)
|
||||
let power = generators['{{ user.bike.code_name }}'].rpm.power(rpm)
|
||||
let speed = generators['{{ user.bike.code_name }}'].rpm.speed(rpm)
|
||||
if (previousReadingTime) {
|
||||
distance += calculateDistance(previousReadingTime, new Date(), speed)
|
||||
calories += calculateCalories(previousReadingTime, new Date(), watts)
|
||||
calories += calculateCalories(previousReadingTime, new Date(), power)
|
||||
}
|
||||
|
||||
previousReadingTime = new Date();
|
||||
updateBikeDisplay(distance, calories, watts, speed, rpm);
|
||||
updateBikeDisplay(distance, calories, power, speed, rpm);
|
||||
updateGraph();
|
||||
|
||||
workout.push({ distance, calories, watts, speed, rpm, timestamp: new Date() })
|
||||
workout.push({ distance, calories, power, speed, rpm, timestamp: new Date() })
|
||||
}
|
||||
}
|
||||
prevRes = res;
|
||||
|
||||
Reference in New Issue
Block a user