Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce BLHeli flash usage #13006

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions libraries/AP_BLHeli/AP_BLHeli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@

extern const AP_HAL::HAL& hal;

#define BLHELI_DEBUG (HAL_MEM_CLASS == HAL_MEM_CLASS_2000)

#if BLHELI_DEBUG
#define debug(fmt, args ...) do { if (debug_level) { gcs().send_text(MAV_SEVERITY_INFO, "ESC: " fmt, ## args); } } while (0)
#else
#define debug(fmt, args ...)
#endif

// key for locking UART for exclusive use. This prevents any other writes from corrupting
// the MSP protocol on hal.console
Expand Down Expand Up @@ -79,14 +85,14 @@ const AP_Param::GroupInfo AP_BLHeli::var_info[] = {
// @Range: 0 500
// @User: Standard
AP_GROUPINFO("TRATE", 5, AP_BLHeli, telem_rate, 10),

#if BLHELI_DEBUG
// @Param: DEBUG
// @DisplayName: BLHeli debug level
// @Description: When set to 1 this enabled verbose debugging output over MAVLink when the blheli protocol is active. This can be used to diagnose failures.
// @Values: 0:Disabled,1:Enabled
// @User: Standard
AP_GROUPINFO("DEBUG", 6, AP_BLHeli, debug_level, 0),

#endif
// @Param: OTYPE
// @DisplayName: BLHeli output type override
// @Description: When set to a non-zero value this overrides the output type for the output channels given by SERVO_BLH_MASK. This can be used to enable DShot on outputs that are not part of the multicopter motors group.
Expand Down
1 change: 1 addition & 0 deletions libraries/AP_HAL/AP_HAL_Boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
#define HAL_MEM_CLASS_300 4
#define HAL_MEM_CLASS_500 5
#define HAL_MEM_CLASS_1000 6
#define HAL_MEM_CLASS_2000 7

/* Operating system features
*
Expand Down
4 changes: 3 additions & 1 deletion libraries/AP_HAL/board/chibios.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

#define HAL_BOARD_NAME "ChibiOS"

#if HAL_MEMORY_TOTAL_KB >= 1000
#if HAL_MEMORY_TOTAL_KB >= 2000
#define HAL_MEM_CLASS HAL_MEM_CLASS_2000
#elif HAL_MEMORY_TOTAL_KB >= 1000
#define HAL_MEM_CLASS HAL_MEM_CLASS_1000
#elif HAL_MEMORY_TOTAL_KB >= 500
#define HAL_MEM_CLASS HAL_MEM_CLASS_500
Expand Down
2 changes: 1 addition & 1 deletion libraries/AP_HAL/board/sitl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#define HAL_BOARD_NAME "SITL"
#define HAL_CPU_CLASS HAL_CPU_CLASS_1000
#define HAL_MEM_CLASS HAL_MEM_CLASS_1000
#define HAL_MEM_CLASS HAL_MEM_CLASS_2000
#define HAL_OS_POSIX_IO 1
#define HAL_OS_SOCKETS 1
#define HAL_STORAGE_SIZE 16384
Expand Down