Skip to content

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

@netlify
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
@haslinghuis haslinghuis marked this pull request as ready for review November 23, 2024 00:10
nerdCopter
nerdCopter previously approved these changes Nov 23, 2024
@sonarqubecloud
Copy link

@VitroidFPV VitroidFPV merged commit 3d8520c into betaflight:master Dec 1, 2024
8 checks passed
@haslinghuis haslinghuis deleted the fix-formula branch December 1, 2024 19:27
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.

4 participants