Skip to content

[Calories] Update formulas for less active inflation - #4303

Merged
bobrippling merged 8 commits into
espruino:masterfrom
RKBoss6:caloriesUpdate
Jul 30, 2026
Merged

[Calories] Update formulas for less active inflation#4303
bobrippling merged 8 commits into
espruino:masterfrom
RKBoss6:caloriesUpdate

Conversation

@RKBoss6

@RKBoss6 RKBoss6 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #4286, uses different weighting and interpolation of maxHR to cut down significantly on caloric inflation.

Copilot AI review requested due to automatic review settings July 29, 2026 19:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Calories app’s active-calorie estimation to reduce overestimation during low-activity periods by introducing a max-HR–based scaling factor and adjusting how step vs HR contributions are blended.

Changes:

  • Adds a max-HR interpolation coefficient to scale down active calories at lower exertion levels.
  • Adjusts step-rate thresholds/weighting used when blending step-based vs HR-based calorie estimates.
  • Updates app docs/metadata/changelog to reflect the new formula behavior and version bump.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
apps/calories/lib.js Introduces max-HR scaling for active calories and updates step/HR blending logic.
apps/calories/README.md Documents the added max-HR–based interpolation step in the algorithm description.
apps/calories/metadata.json Bumps app version from 0.01 to 0.02.
apps/calories/ChangeLog Notes the 0.02 formula adjustment aimed at reducing overestimation.
Comments suppressed due to low confidence (2)

apps/calories/lib.js:160

  • The added print statements in the core calorie calculation will run for every interval and can degrade performance and flood logs. These should be removed or gated behind an explicit debug flag.
  let stepsKcalMin = (stepsMet * 3.5 * weight) / 200;
  // blend METs
  let finalActiveKcalMin = 0;
  if (stepsPerMin > 180) {
    // strenuous activity
    finalActiveKcalMin = hrKcalMin * 0.5 + stepsKcalMin * 0.5;
  } else if (stepsPerMin >= 60) {

apps/calories/lib.js:176

  • Remove remaining debugging output from the library return path; this function is likely called periodically and should not print each time.
    bmrCalories: Math.round(bmr * healthData.duration)
  };

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/calories/lib.js Outdated
RKBoss6 added 2 commits July 29, 2026 15:51
Removed 'BETA' from the name and simplified the description.
Updated beta testing section to clarify app status.
@RKBoss6

RKBoss6 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

I've also removed the BETA status from the app in metadata and title, as the app is pretty reliable as of now. I kept the beta testing info in the README so users still know what to do if unexpected behavior occurs or wants to cross-test, but I think this app is good to go now without the beta tag.

@bobrippling
bobrippling merged commit 1fffae7 into espruino:master Jul 30, 2026
2 checks passed
@RKBoss6
RKBoss6 deleted the caloriesUpdate branch August 10, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calories App on a Bangle.js 2 and I wonder if the calculations are correct

3 participants