Skip to content

Commit

Permalink
Moved ENABLE_THRUST_BAT_COMPENSATED define to Kbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
victorhook committed Nov 15, 2022
1 parent 7fda52e commit e82edd4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 0 additions & 4 deletions src/drivers/interface/motors.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@
#define MOTORS_TIM_DBG_CFG DBGMCU_APB2PeriphConfig
#define MOTORS_GPIO_AF_CFG(a,b,c) GPIO_PinAFConfig(a,b,c)

// Compensate thrust depending on battery voltage so it will produce about the same
// amount of thrust independent of the battery voltage. Based on thrust measurement.
// Not applied for brushless motor setup.
#define ENABLE_THRUST_BAT_COMPENSATED

#ifdef CONFIG_MOTORS_ESC_PROTOCOL_ONESHOT125
/**
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/src/motors.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ GPIO_InitTypeDef GPIO_PassthroughOutput =
// Voltage needed with the Supply voltage.
float motorsCompensateBatteryVoltage(uint32_t id, float iThrust, float supplyVoltage)
{
#ifdef ENABLE_THRUST_BAT_COMPENSATED
#ifdef CONFIG_ENABLE_THRUST_BAT_COMPENSATED
ASSERT(id < NBR_OF_MOTORS);

if (motorMap[id]->drvType == BRUSHED)
Expand Down
9 changes: 9 additions & 0 deletions src/modules/src/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,15 @@ config POWER_DISTRIBUTION_FLAPPER_REVB
help
Power distribution function for Flapper Nimble+ with revB PCB

config ENABLE_THRUST_BAT_COMPENSATED
bool "Enable battery thrust compensation"
default y
help
Compensate thrust depending on battery voltage so it will produce about the same
amount of thrust independent of the battery voltage.
The compensation is based on thrust measurements, which are only valid for CF2.X stock configuration.
Not applied for brushless motor setup.

endmenu

menu "Parameter subsystem"
Expand Down

0 comments on commit e82edd4

Please sign in to comment.