mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 09:45:37 +03:00
CF/BF - declare variable at point of first usage (code style)
This commit is contained in:
parent
85b05d3483
commit
9482a12677
1 changed files with 1 additions and 2 deletions
|
@ -97,11 +97,10 @@ PG_REGISTER(currentMeterVirtualConfig_t, currentMeterVirtualConfig, PG_CURRENT_S
|
||||||
|
|
||||||
static int32_t currentMeterADCToCentiamps(const uint16_t src)
|
static int32_t currentMeterADCToCentiamps(const uint16_t src)
|
||||||
{
|
{
|
||||||
int32_t millivolts;
|
|
||||||
|
|
||||||
const currentSensorADCConfig_t *config = currentSensorADCConfig();
|
const currentSensorADCConfig_t *config = currentSensorADCConfig();
|
||||||
|
|
||||||
millivolts = ((uint32_t)src * ADCVREF) / 4096;
|
int32_t millivolts = ((uint32_t)src * ADCVREF) / 4096;
|
||||||
millivolts -= config->offset;
|
millivolts -= config->offset;
|
||||||
|
|
||||||
return (millivolts * 1000) / (int32_t)config->scale; // current in 0.01A steps
|
return (millivolts * 1000) / (int32_t)config->scale; // current in 0.01A steps
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue