GithubHelp home page GithubHelp logo

olliv / bfree Goto Github PK

View Code? Open in Web Editor NEW
28.0 28.0 3.0 11.75 MB

Bfree smart trainer app.

Home Page: https://bfree.vercel.app

License: GNU General Public License v3.0

TypeScript 97.93% JavaScript 1.33% CSS 0.74%
cycling heartrate-monitor nextjs trainer web-ble web-bluetooth

bfree's People

Contributors

dependabot[bot] avatar olliv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bfree's Issues

Training session

Create a training session object that has useRef to the selected measurements.

Example:

{
  speedRef: [ cscRef, csRed ],
  powerRef: [ cspRed ]
}

Persisting configuration

Save config on regular interval by checking if there are changes using setTimeout() and a global flag. Show a notification when the config is stored to local storage.

Free Ride Slope mode issues

  • Calculate altitude data in Free Ride Slope mode
  • The trainer is making weird noises, it sounds like it's slipping???

Make it a PWA

This could be nice addition as it doesn't require internet connection anyway.

One possible solution is here next-pwa.

Table issue

Warning: validateDOMNesting(...): <tr> cannot appear as a child of <table>. Add a <tbody>, <thead> or <tfoot> to your code to match the DOM tree generated by the browser.
    in tr (at MeasurementCard.tsx:132)
    in table (at MeasurementCard.tsx:121)
    in div (created by ForwardRef(Container))
    in ForwardRef(Container) (created by 

Check BT availability before attempting to use it

(async () => {
  try {
    const isBluetoothAvailable = await navigator.bluetooth.getAvailability();
    log(`> Bluetooth is ${isBluetoothAvailable ? 'available' : 'unavailable'}`);
  } catch(error) {
    log('Argh! ' + error);
  }
})();

if ('onavailabilitychanged' in navigator.bluetooth) {
  navigator.bluetooth.addEventListener('availabilitychanged', function(event) {
    log(`> Bluetooth is ${event.value ? 'available' : 'unavailable'}`);
  });
}

https://googlechrome.github.io/samples/web-bluetooth/availability-async-await.html

Workout mode

Initially it would be probably enough to support the three resistance modes or even just power.
The workouts could even just scripted with JS. This would/should allow an easy access to different lap triggering modes (time, distance, etc.).

Implement showing previous rides

It's currently half-done as history.tsx will load all the loggers but isn't able to show any.
There might be also a memory consumption concern. Maybe it shouldn't load all the data permanently but create a new logger when one is actually needed again?

Fix time warp in the record graph

Missing measurements should either be replaced with the previous measurement or with a zero, or intelligently with and average of the previous and next measurement if existing.

Avg speed may go to NaN

At least avg speed and probably others too may go NaN if a value is missing or the ride is paused, not sure which one or both.

Making a lap split doesn't fix the issue.

Move the title to left on the record page

Moving the title to the left side of the page and moving the content up in the record page would give more space for the measurements. It would be nice to animate this move if possible.

Implement ride recovery

Currently the log is incomplete after a crash. It should be fairly easy to recover an incomplete log in most of the cases.
We could either show an error and ask the user to press a button or attempt an automatic fix.

Unpairing a device that has multiple sensors disconnects them all

For example a trainer may have a FE-C and a separate power meter in the same device, if one is disconnected the browser will disconnect all active services.

This sometimes results the following error:

Uncaught (in promise) DOMException: GATT Service no longer exists.

Steps to reproduce

  1. Connect to the FE-C service
  2. Connect to the cycling power service
  3. Disconnect the cycling power service

This should result the FEC-C service being dropped as well.

Persist training session

  • Persist sessions after riding
  • Allow downloading previously persisted rides
  • Persist ongoing ride periodically to avoid dataloss

State management

Is there any better way to make it absolutely sure that we don't lose the BLE connections if something happens? Pretty much everything else can be just pushed to the local storage either immediately or periodically. Is it possible to move the data logging to a worker?

Cadence filtering option

Ignore zeroes, avg whatever it's that makes bad cadence sensors less useless. Should be a toggle switch in the sensors setup.

Send user configuration to the trainer

We are probably missing the right bike parameters to calculate speed and distance accurately. The trainer is currently sending a User configuration required flag all the time.

Add blood oximeter support

Add support for Bluetooth blood oximeters. This could be potentially shown along with hr data and the oximeter can also act as a source for HR.

Max & avg, and graph sometimes broken

The max and avg values for speed are still randomly showing NaN and Infinity for the rest of the session since the beginning.

The graph sometimes fails in the beginning and requires a lap split to start drawing something.

Avg is broken

  • Avg is showing too many decimals
  • power avg is showing unrealistically low values

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.