Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formula #486

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Fix formula #486

wants to merge 4 commits into from

Conversation

haslinghuis
Copy link
Member

@haslinghuis haslinghuis commented Nov 18, 2024

According to code it should be

image

But this one from @KarateBrot looks cleaner

image

Copy link

netlify bot commented Nov 18, 2024

Deploy Preview for origin-betaflight-com ready!

Name Link
🔨 Latest commit 54f23a0
🔍 Latest deploy log https://app.netlify.com/sites/origin-betaflight-com/deploys/6744d8ffbd56b600081ed93d
😎 Deploy Preview https://deploy-preview-486.dev.web.betaflight.com
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

nerdCopter
nerdCopter previously approved these changes Nov 18, 2024
@nerdCopter
Copy link
Member

approval for workflow, but formula still in discussion in discord.

nerdCopter
nerdCopter previously approved these changes Nov 18, 2024
@haslinghuis
Copy link
Member Author

haslinghuis commented Nov 22, 2024

Do not merge yet. According to code it should be something like

$$ centiAmps = (\frac{ADC (mV) * 10000}{amperage_meter_scale} + amperage_meter_offset) / 10 $$

Which I think should give

$$ Current(Amps) = (\frac{ADC (mV) * 10000}{amperage_meter_scale} + amperage_meter_offset) / 1000 $$

https://github.com/betaflight/betaflight/blob/e422e42122d9f737df0feeee5ae65232d63f1eba/src/main/sensors/current.c#L117-L119

int32_t millivolts = ((uint32_t)src * getVrefMv()) / 4096;
// y=x/m+b m is scale in (mV/10A) and b is offset in (mA)
int32_t centiAmps = (millivolts * 10000 / (int32_t)config->scale + (int32_t)config->offset) / 10;

@nerdCopter nerdCopter marked this pull request as draft November 22, 2024 15:26
nerdCopter
nerdCopter previously approved these changes Nov 23, 2024
docs/wiki/configurator/power-tab.md Outdated Show resolved Hide resolved
Copy link

sonarcloud bot commented Nov 25, 2024

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.

3 participants