dvmarinoff / Flux

Indoor Cycling App for Structured Training
https://flux-web.vercel.app
GNU Affero General Public License v3.0
506 stars 86 forks source link

Use full range of Uint8 for ResistanceTarget #70

Closed ihilt closed 2 years ago

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/dmarinov/flux/GnxjkDfmN34vfyTodNFCKL32Qk7c
✅ Preview: https://flux-git-fork-ihilt-master-dmarinov.vercel.app

ihilt commented 2 years ago

The setting on master of 25.4 isn't high enough for my trainer - I get around 60-70 watts of resistance at about 80-90rpm cadence. This fixes that but I have no idea why it was changed to 25.4 so this might end up breaking someone else's setup. Interested in discussing. Thanks for the app btw!

dvmarinoff commented 2 years ago

Let's first discuss this in the linked issue: https://github.com/dvmarinoff/Flux/issues/71

dvmarinoff commented 2 years ago

BTW what is your trainer?

ihilt commented 2 years ago

On 12/11/21 at 01:21:09 PM, Dimitar Marinov @.***> wrote:

BTW what is your trainer?

Sportneer Electromagnetic Smart Trainer. Not the best so that might be part of the problem.

Amazon link: https://www.amazon.com/dp/B08V87WH3R

dvmarinoff commented 2 years ago

Now I think I would trust the Tacx implementation and go for the following values:

src/models/models.js

class ResistanceTarget extends Target {
    postInit(args) {
        this.min = args.min || -100;
        this.max = args.max || 100;
        this.step = args.step || 10;
    }
    parse(value) { return parseInt(value); }
}

And

src/ble/ftms/control-point.js


95    const definitions = {
96        resistance: {resolution: 0.1, unit: '', size: 2, min: -100, max: 100, default: 0},
97    };

108   view.setInt16(1, resistance, true);

117   const resistance = data.decodeField('resistance', dataview.getInt16(1, true));