mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +03:00
Merge pull request #477 from projectkk2glider/projectkk2glider/issue_316_frsky_voltages
Fixes #316: better arithmetics for FrSky CELL voltages, VFAS battery vol...
This commit is contained in:
commit
d82fc6b9be
7 changed files with 49 additions and 25 deletions
|
@ -53,14 +53,14 @@ TEST(BatteryTest, BatteryADCToVoltage)
|
|||
batteryInit(&batteryConfig);
|
||||
|
||||
batteryAdcToVoltageExpectation_t batteryAdcToVoltageExpectations[] = {
|
||||
{1420, 125, ELEVEN_TO_ONE_VOLTAGE_DIVIDER},
|
||||
{1430, 126, ELEVEN_TO_ONE_VOLTAGE_DIVIDER},
|
||||
{1440, 127, ELEVEN_TO_ONE_VOLTAGE_DIVIDER},
|
||||
{1890, 167, ELEVEN_TO_ONE_VOLTAGE_DIVIDER},
|
||||
{1900, 168, ELEVEN_TO_ONE_VOLTAGE_DIVIDER},
|
||||
{1910, 169, ELEVEN_TO_ONE_VOLTAGE_DIVIDER},
|
||||
{ 0, 0, VBAT_SCALE_MAX},
|
||||
{4096, 841, VBAT_SCALE_MAX}
|
||||
{1420, 126 /*125.88*/, ELEVEN_TO_ONE_VOLTAGE_DIVIDER},
|
||||
{1430, 127 /*126.76*/, ELEVEN_TO_ONE_VOLTAGE_DIVIDER},
|
||||
{1440, 128 /*127.65*/, ELEVEN_TO_ONE_VOLTAGE_DIVIDER},
|
||||
{1890, 168 /*167.54*/, ELEVEN_TO_ONE_VOLTAGE_DIVIDER},
|
||||
{1900, 168 /*168.42*/, ELEVEN_TO_ONE_VOLTAGE_DIVIDER},
|
||||
{1910, 169 /*169.31*/, ELEVEN_TO_ONE_VOLTAGE_DIVIDER},
|
||||
{ 0, 0 /* 0.00*/, VBAT_SCALE_MAX},
|
||||
{4096, 842 /*841.71*/, VBAT_SCALE_MAX}
|
||||
};
|
||||
uint8_t testIterationCount = sizeof(batteryAdcToVoltageExpectations) / sizeof(batteryAdcToVoltageExpectation_t);
|
||||
|
||||
|
@ -77,7 +77,7 @@ TEST(BatteryTest, BatteryADCToVoltage)
|
|||
#endif
|
||||
uint16_t pointOneVoltSteps = batteryAdcToVoltage(batteryAdcToVoltageExpectation->adcReading);
|
||||
|
||||
EXPECT_EQ(pointOneVoltSteps, batteryAdcToVoltageExpectation->expectedVoltageInDeciVoltSteps);
|
||||
EXPECT_EQ(batteryAdcToVoltageExpectation->expectedVoltageInDeciVoltSteps, pointOneVoltSteps);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue