mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 17:25:20 +03:00
refactor motor idle, rename dshot_idle_value to motor_idle (#13936)
* use idleOffset, simplify idle : check PWM idle * remove get for dshot idle and calculate it once only * fixes from reviews, thanks * use motor_idle for CLI name * use motorConfig->motorIdle not idleOffset * rename dshotmotorIdle variable to motorIdlePercent * small comment improvement
This commit is contained in:
parent
10d5963d24
commit
5ffeea6ab1
17 changed files with 29 additions and 66 deletions
|
@ -51,7 +51,6 @@ extern "C" {
|
|||
#include "gtest/gtest.h"
|
||||
|
||||
uint32_t testFeatureMask = 0;
|
||||
uint16_t testMinThrottle = 0;
|
||||
throttleStatus_e throttleStatus = THROTTLE_HIGH;
|
||||
|
||||
enum {
|
||||
|
@ -755,11 +754,6 @@ void beeper(beeperMode_e mode)
|
|||
UNUSED(mode);
|
||||
}
|
||||
|
||||
uint16_t getCurrentMinthrottle(void)
|
||||
{
|
||||
return testMinThrottle;
|
||||
}
|
||||
|
||||
bool isUsingSticksForArming(void)
|
||||
{
|
||||
return isUsingSticksToArm;
|
||||
|
|
|
@ -32,7 +32,6 @@ extern "C" {
|
|||
extern "C" {
|
||||
|
||||
bool featureIsEnabled(uint8_t f);
|
||||
float getDigitalIdleOffset(const motorConfig_t *motorConfig);
|
||||
float scaleRangef(float a, float b, float c, float d, float e);
|
||||
|
||||
// Mocking functions
|
||||
|
@ -43,12 +42,6 @@ bool featureIsEnabled(uint8_t f)
|
|||
return true;
|
||||
}
|
||||
|
||||
float getDigitalIdleOffset(const motorConfig_t *motorConfig)
|
||||
{
|
||||
UNUSED(motorConfig);
|
||||
return 0;
|
||||
}
|
||||
|
||||
float scaleRangef(float a, float b, float c, float d, float e)
|
||||
{
|
||||
UNUSED(a);
|
||||
|
|
|
@ -36,7 +36,6 @@ PG_REGISTER_WITH_RESET_TEMPLATE(motorConfig_t, motorConfig, PG_MOTOR_CONFIG, 1);
|
|||
|
||||
PG_RESET_TEMPLATE(motorConfig_t, motorConfig,
|
||||
.dev = {.motorPwmRate = 400},
|
||||
.minthrottle = 1150,
|
||||
.maxthrottle = 1850,
|
||||
.mincommand = 1000,
|
||||
);
|
||||
|
@ -50,7 +49,6 @@ TEST(ParameterGroupsfTest, Test_pgResetAll)
|
|||
{
|
||||
memset(motorConfigMutable(), 0, sizeof(motorConfig_t));
|
||||
pgResetAll();
|
||||
EXPECT_EQ(1150, motorConfig()->minthrottle);
|
||||
EXPECT_EQ(1850, motorConfig()->maxthrottle);
|
||||
EXPECT_EQ(1000, motorConfig()->mincommand);
|
||||
EXPECT_EQ(400, motorConfig()->dev.motorPwmRate);
|
||||
|
@ -61,7 +59,6 @@ TEST(ParameterGroupsfTest, Test_pgFind)
|
|||
memset(motorConfigMutable(), 0, sizeof(motorConfig_t));
|
||||
const pgRegistry_t *pgRegistry = pgFind(PG_MOTOR_CONFIG);
|
||||
pgReset(pgRegistry);
|
||||
EXPECT_EQ(1150, motorConfig()->minthrottle);
|
||||
EXPECT_EQ(1850, motorConfig()->maxthrottle);
|
||||
EXPECT_EQ(1000, motorConfig()->mincommand);
|
||||
EXPECT_EQ(400, motorConfig()->dev.motorPwmRate);
|
||||
|
@ -70,7 +67,6 @@ TEST(ParameterGroupsfTest, Test_pgFind)
|
|||
memset(&motorConfig2, 0, sizeof(motorConfig_t));
|
||||
motorConfigMutable()->dev.motorPwmRate = 500;
|
||||
pgStore(pgRegistry, &motorConfig2, sizeof(motorConfig_t));
|
||||
EXPECT_EQ(1150, motorConfig2.minthrottle);
|
||||
EXPECT_EQ(1850, motorConfig2.maxthrottle);
|
||||
EXPECT_EQ(1000, motorConfig2.mincommand);
|
||||
EXPECT_EQ(500, motorConfig2.dev.motorPwmRate);
|
||||
|
@ -78,7 +74,6 @@ TEST(ParameterGroupsfTest, Test_pgFind)
|
|||
motorConfig_t motorConfig3;
|
||||
memset(&motorConfig3, 0, sizeof(motorConfig_t));
|
||||
pgResetCopy(&motorConfig3, PG_MOTOR_CONFIG);
|
||||
EXPECT_EQ(1150, motorConfig3.minthrottle);
|
||||
EXPECT_EQ(1850, motorConfig3.maxthrottle);
|
||||
EXPECT_EQ(1000, motorConfig3.mincommand);
|
||||
EXPECT_EQ(400, motorConfig3.dev.motorPwmRate);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue