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

SITL: add ENABLED defines for remaining simulated I2C devices #28848

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

srmainwaring
Copy link
Contributor

@srmainwaring srmainwaring commented Dec 12, 2024

Adds conditional compilation defines for the remainder of the I2C sensors included in SIM_I2C.cpp.

Motivation

Aside from consistency, this reduces DRAM use for SIM on HW (esp. esp32empty and esp32s3empty where RAM limits are causing WiFi to not initialise correctly).

cd ./build/esp32s3empty/esp-idf_build
ninja -v -v size-files | grep SIM_I2C.cpp

Before:

Object File DRAM .data .bss IRAM .text RAM Total Flash .text .rodata Flash Total
SIM_I2C.cpp.0.o 116 20620 0 20736 867 184 1167

After:

Object File DRAM .data .bss IRAM .text RAM Total Flash .text .rodata Flash Total
SIM_I2C.cpp.0.o 36 3984 0 4020 71 24 131

See also:

- Reduces DRAM use for SIM on HW (esp. esp32empty and esp32s3empty).

Signed-off-by: Rhys Mainwaring <[email protected]>
@@ -2,6 +2,14 @@

#include "SIM_I2CDevice.h"

#include <AP_HAL/AP_HAL_Boards.h>

#ifndef AP_SIM_AIRSPEEDDLVR_ENABLED
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should go in SIM_config.h

Also, please add underscores in each of them:

Suggested change
#ifndef AP_SIM_AIRSPEEDDLVR_ENABLED
#ifndef AP_SIM_AIRSPEED_DLVR_ENABLED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants