Skip to content

Fix excluded modules configuration handling - #7838

Merged
fifieldt merged 3 commits into
meshtastic:developfrom
capricornusx:fix-excluded-modules-dev
Sep 7, 2025
Merged

Fix excluded modules configuration handling#7838
fifieldt merged 3 commits into
meshtastic:developfrom
capricornusx:fix-excluded-modules-dev

Conversation

@capricornusx

Copy link
Copy Markdown
Contributor

Fix excluded modules appearing in client applications

🐛 Problem

When modules are excluded via MESHTASTIC_EXCLUDE_* flags during compilation, two issues occurred:

  • Excluded modules still appeared in client application menus
  • These excluded modules sometimes caused PAYLOADVARIANT_NOT_SET errors

💡 Solution

Added comprehensive conditional compilation guards to prevent excluded modules from:

  • Being flagged as available in device metadata getDeviceMetadata()
  • Responding to admin config requests handleGetModuleConfig()
  • Being enumerated in phone API getFromRadio()
  • Having default configs installed installDefaultModuleConfig()

🎯 Changes

  • src/main.cpp: Added excluded_modules flags for MQTT, PAXCOUNTER, STOREFORWARD, RANGETEST, NEIGHBORINFO
  • src/modules/AdminModule.cpp: Added conditional guards for RANGETEST, AUDIO, PAXCOUNTER, STOREFORWARD, EXTNOTIF, DETECTIONSENSOR, AMBIENTLIGHTING
  • src/mesh/PhoneAPI.cpp: Added skip logic for excluded modules during config enumeration
  • src/mesh/NodeDB.cpp: Added conditional has_* flags only for included modules

Testing

Tested with various MESHTASTIC_EXCLUDE_* combinations to verify excluded modules no longer appear in client apps and don't generate payload variant errors.

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
  • Heltec Wireless Paper

- Add excluded_modules flags in getDeviceMetadata() for MQTT, PAXCOUNTER, STOREFORWARD, RANGETEST, NEIGHBORINFO
- Add conditional compilation guards in AdminModule for RANGETEST, AUDIO, PAXCOUNTER, STOREFORWARD, EXTNOTIF, DETECTIONSENSOR, AMBIENTLIGHTING
- Add skip logic in PhoneAPI for excluded modules during config enumeration
- Add conditional has_* flags in NodeDB only for included modules

Fixes issue where excluded modules still appeared in client applications and sometimes caused PAYLOADVARIANT_NOT_SET errors.
@thebentern thebentern added the bug Something isn't working label Sep 3, 2025
@capricornusx

capricornusx commented Sep 3, 2025

Copy link
Copy Markdown
Contributor Author

@thebentern, Hi :) Please, re-run Check PR Labels job

@fifieldt fifieldt added the bugfix Pull request that fixes bugs label Sep 4, 2025
Comment thread src/main.cpp Outdated
@fifieldt

fifieldt commented Sep 4, 2025

Copy link
Copy Markdown
Member

Thanks for your comprehensive work :)

@thebentern
thebentern requested a review from Copilot September 4, 2025 11:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes issues where excluded modules were still appearing in client applications and causing configuration errors. The changes add comprehensive conditional compilation guards to prevent excluded modules from being exposed through the device API.

  • Adds conditional compilation guards around module configuration handling
  • Updates device metadata to properly flag excluded modules
  • Implements skip logic for excluded modules during API enumeration

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/modules/AdminModule.cpp Added conditional guards for module config requests to prevent responses for excluded modules
src/mesh/PhoneAPI.cpp Added skip logic to prevent excluded modules from being enumerated in phone API responses
src/mesh/NodeDB.cpp Added conditional has_* flags only for included modules in default config installation
src/main.cpp Added excluded module flags for MQTT, PAXCOUNTER, STOREFORWARD, RANGETEST, and NEIGHBORINFO in device metadata

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/mesh/PhoneAPI.cpp Outdated
Comment thread src/mesh/NodeDB.cpp
Comment thread src/mesh/NodeDB.cpp
- Restore original PAXCOUNTER logic: only exclude on non-ESP32 platforms due to memory constraints
- Fix has_store_forward flag to be conditionally compiled based on MESHTASTIC_EXCLUDE_STOREFORWARD
- Refactor PhoneAPI module config skipping logic to use helper function skipExcludedModuleConfig()
- Reduce code duplication in PhoneAPI by extracting common skip logic

This addresses the three issues identified in the code review:
1. PAXCOUNTER memory impact on non-ESP32 devices
2. Unconditional has_store_forward flag setting
3. Duplicated state management logic across multiple #else blocks
@capricornusx

capricornusx commented Sep 4, 2025

Copy link
Copy Markdown
Contributor Author

Result:

изображение

- Add conditional compilation guards for ambient lighting in PhoneAPI.cpp
- Replace old HAS_RGB_LED logic with MESHTASTIC_EXCLUDE_AMBIENTLIGHTING check in AdminModule.cpp
- Ensure ambient lighting module is properly excluded when MESHTASTIC_EXCLUDE_AMBIENTLIGHTING=1
@capricornusx

Copy link
Copy Markdown
Contributor Author

@fifieldt
Is anything else needed from me before merging?

@fifieldt
fifieldt merged commit 9c6544e into meshtastic:develop Sep 7, 2025
78 checks passed
thebentern added a commit that referenced this pull request Sep 19, 2025
@capricornusx

Copy link
Copy Markdown
Contributor Author

@thebentern
Hi, could you please clarify the reason for the revert? I’d like to understand what went wrong so I can adjust my contribution accordingly. Thanks in advance!

jeek pushed a commit to jeek/Meshtastic-Exploiteers-Hacker-Pager that referenced this pull request Jun 30, 2026
* Fix excluded modules configuration handling

- Add excluded_modules flags in getDeviceMetadata() for MQTT, PAXCOUNTER, STOREFORWARD, RANGETEST, NEIGHBORINFO
- Add conditional compilation guards in AdminModule for RANGETEST, AUDIO, PAXCOUNTER, STOREFORWARD, EXTNOTIF, DETECTIONSENSOR, AMBIENTLIGHTING
- Add skip logic in PhoneAPI for excluded modules during config enumeration
- Add conditional has_* flags in NodeDB only for included modules

Fixes issue where excluded modules still appeared in client applications and sometimes caused PAYLOADVARIANT_NOT_SET errors.

* Fix excluded modules issues and refactor code

- Restore original PAXCOUNTER logic: only exclude on non-ESP32 platforms due to memory constraints
- Fix has_store_forward flag to be conditionally compiled based on MESHTASTIC_EXCLUDE_STOREFORWARD
- Refactor PhoneAPI module config skipping logic to use helper function skipExcludedModuleConfig()
- Reduce code duplication in PhoneAPI by extracting common skip logic

This addresses the three issues identified in the code review:
1. PAXCOUNTER memory impact on non-ESP32 devices
2. Unconditional has_store_forward flag setting
3. Duplicated state management logic across multiple #else blocks

* Fix ambient lighting module exclusion in PhoneAPI and AdminModule

- Add conditional compilation guards for ambient lighting in PhoneAPI.cpp
- Replace old HAS_RGB_LED logic with MESHTASTIC_EXCLUDE_AMBIENTLIGHTING check in AdminModule.cpp
- Ensure ambient lighting module is properly excluded when MESHTASTIC_EXCLUDE_AMBIENTLIGHTING=1
jeek pushed a commit to jeek/Meshtastic-Exploiteers-Hacker-Pager that referenced this pull request Jun 30, 2026
Itzdavid01 pushed a commit to Itzdavid01/firmware that referenced this pull request Sep 5, 2026
* Fix excluded modules configuration handling

- Add excluded_modules flags in getDeviceMetadata() for MQTT, PAXCOUNTER, STOREFORWARD, RANGETEST, NEIGHBORINFO
- Add conditional compilation guards in AdminModule for RANGETEST, AUDIO, PAXCOUNTER, STOREFORWARD, EXTNOTIF, DETECTIONSENSOR, AMBIENTLIGHTING
- Add skip logic in PhoneAPI for excluded modules during config enumeration
- Add conditional has_* flags in NodeDB only for included modules

Fixes issue where excluded modules still appeared in client applications and sometimes caused PAYLOADVARIANT_NOT_SET errors.

* Fix excluded modules issues and refactor code

- Restore original PAXCOUNTER logic: only exclude on non-ESP32 platforms due to memory constraints
- Fix has_store_forward flag to be conditionally compiled based on MESHTASTIC_EXCLUDE_STOREFORWARD
- Refactor PhoneAPI module config skipping logic to use helper function skipExcludedModuleConfig()
- Reduce code duplication in PhoneAPI by extracting common skip logic

This addresses the three issues identified in the code review:
1. PAXCOUNTER memory impact on non-ESP32 devices
2. Unconditional has_store_forward flag setting
3. Duplicated state management logic across multiple #else blocks

* Fix ambient lighting module exclusion in PhoneAPI and AdminModule

- Add conditional compilation guards for ambient lighting in PhoneAPI.cpp
- Replace old HAS_RGB_LED logic with MESHTASTIC_EXCLUDE_AMBIENTLIGHTING check in AdminModule.cpp
- Ensure ambient lighting module is properly excluded when MESHTASTIC_EXCLUDE_AMBIENTLIGHTING=1
Itzdavid01 pushed a commit to Itzdavid01/firmware that referenced this pull request Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working bugfix Pull request that fixes bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants