AP_Notify: allow display drivers to be disabled - #34064
Open
muramura wants to merge 1 commit into
Open
Conversation
peterbarker
requested changes
Aug 15, 2026
peterbarker
left a comment
Contributor
There was a problem hiding this comment.
Encase all of the relevant source files in the same defines.
i.e. do not rely on the compiler eliding stuff, it's not entirely reliable and does lead to stuff being included when you really don't want it.
Comment on lines
+20
to
+23
| // allow boards to include only the display drivers they use | ||
| #ifndef AP_NOTIFY_DISPLAY_SSD1306_ENABLED | ||
| #define AP_NOTIFY_DISPLAY_SSD1306_ENABLED HAL_DISPLAY_ENABLED | ||
| #endif |
Contributor
There was a problem hiding this comment.
Suggested change
| // allow boards to include only the display drivers they use | |
| #ifndef AP_NOTIFY_DISPLAY_SSD1306_ENABLED | |
| #define AP_NOTIFY_DISPLAY_SSD1306_ENABLED HAL_DISPLAY_ENABLED | |
| #endif | |
| #ifndef AP_NOTIFY_DISPLAY_BACKEND_DEFAULT_ENABLED | |
| #define AP_NOTIFY_DISPLAY_BACKEND_DEFAULT_ENABLED HAL_DISPLAY_ENABLED | |
| #endif | |
| // allow boards to include only the display drivers they use | |
| #ifndef AP_NOTIFY_DISPLAY_SSD1306_ENABLED | |
| #define AP_NOTIFY_DISPLAY_SSD1306_ENABLED AP_NOTIFY_DISPLAY_BACKEND_DEFAULT_ENABLED | |
| #endif |
| #endif | ||
|
|
||
| #ifndef AP_NOTIFY_DISPLAY_SH1106_ENABLED | ||
| #define AP_NOTIFY_DISPLAY_SH1106_ENABLED HAL_DISPLAY_ENABLED |
Contributor
There was a problem hiding this comment.
Suggested change
| #define AP_NOTIFY_DISPLAY_SH1106_ENABLED HAL_DISPLAY_ENABLED | |
| #define AP_NOTIFY_DISPLAY_SH1106_ENABLED AP_NOTIFY_DISPLAY_BACKEND_DEFAULT_ENABLED |
| #endif | ||
|
|
||
| #ifndef AP_NOTIFY_DISPLAY_SITL_ENABLED | ||
| #define AP_NOTIFY_DISPLAY_SITL_ENABLED (HAL_DISPLAY_ENABLED && (CONFIG_HAL_BOARD == HAL_BOARD_SITL)) |
Contributor
There was a problem hiding this comment.
Suggested change
| #define AP_NOTIFY_DISPLAY_SITL_ENABLED (HAL_DISPLAY_ENABLED && (CONFIG_HAL_BOARD == HAL_BOARD_SITL)) | |
| #define AP_NOTIFY_DISPLAY_SITL_ENABLED (AP_NOTIFY_DISPLAY_BACKEND_DEFAULT_ENABLED && (CONFIG_HAL_BOARD == HAL_BOARD_SITL)) |
| _driver = probe_i2c_display(i, Display_SH1106_I2C::probe); | ||
| break; | ||
| } | ||
| #endif |
Contributor
There was a problem hiding this comment.
Suggested change
| #endif | |
| #endif // AP_NOTIFY_DISPLAY_SH1106_ENABLED |
similarly elswhere
muramura
force-pushed
the
ap-notify-display-driver-options
branch
from
August 17, 2026 16:40
3e935d5 to
8432c69
Compare
Contributor
Author
|
@peterbarker san
Thanks for the review! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Allow boards to enable only the AP_Notify display drivers they use.
This adds per-display-driver build options for SSD1306, SH1106, and SITL display backends, while keeping the existing default behavior unchanged.
Classification & Testing (check all that apply and add your own)
Built Copter for
esp32s3m5stampflywith extra hwdef settings enabling only SSD1306 display support and disabling SH1106 display support. Confirmed the build succeeds, the final ELF containsDisplay_SSD1306symbols, and noDisplay_SH1106symbols are present.Also built Copter for
esp32s3m5stampflywith extra hwdef settings enabling only SH1106 display support and disabling SSD1306 display support. Confirmed the build succeeds, the final ELF containsDisplay_SH1106symbols, and noDisplay_SSD1306symbols are present.Hardware tested on M5StampFly with a Grove SSD1315 OLED display connected to the I2C Grove port. The display works using the SSD1306 driver with
NTF_DISPLAY_TYPE=1.Description
Some small boards only need one AP_Notify display backend. Before this change,
Display.cppreferenced SSD1306, SH1106, and SITL display backends directly whenever display support was enabled. That made it difficult for board-specific hwdef files to include only the display backend they actually use.This change adds:
AP_NOTIFY_DISPLAY_SSD1306_ENABLEDAP_NOTIFY_DISPLAY_SH1106_ENABLEDAP_NOTIFY_DISPLAY_SITL_ENABLEDThe defaults preserve current behavior. Boards can override these defines from hwdef to reduce unused display driver code.