ModuleService: KConfig for supported Module sets (BUT-207)#51
Open
klajocm wants to merge 1 commit into
Open
Conversation
Group supported modules under set-level menus in KConfig (Rick and Morty, Rover I2C, Wacky robot tokens) and gate the detection logic so sub-address pins / I2C probes for un-selected sets are never compiled in or touched during detection. Sub-address pins that no enabled set needs stay unregistered until a detected Module claims them via its PinModeMap.
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
In
ModuleService, group the supported modules by module set rather than presenting a flat list, and gate the detection logic so sub-address pins / I2C probes for un-selected sets are never compiled in or touched during detection.KConfig changes
The
Supported modulesmenu now contains three top-level set selectors (menuconfigs):CMF_MODULES_RM) — gates the existingRM_TempHum/RM_LED/RM_Motion/RM_CO2/RM_IR/RM_PerfBoardmodules. Enabling the set is now a prerequisite for picking any individual RM module (depends on CMF_MODULES_RM).CMF_MODULES_ROVER_I2C) — empty sub-menu for now.CMF_MODULES_TOKEN) — empty sub-menu for now.The
CONFIG_RM_*per-module symbols are kept verbatim, so existing per-module#ifdefgates inModuleDefs.cpp/ModuleType.hetc. continue to work unchanged.Detection / pin handling
ModuleService::checkAddr():SubAddress::Type::RMbranch is wrapped in#ifdef CONFIG_CMF_MODULES_RMSubAddress::Type::RM_I2Cbranch is wrapped in#ifdef CONFIG_CMF_MODULES_RM(RM-family I2C modules)SubAddress::Type::Rover_I2Cbranch is split out into its own block under#ifdef CONFIG_CMF_MODULES_ROVER_I2CSubAddress::Type::Tokenbranch is wrapped in#ifdef CONFIG_CMF_MODULES_TOKENReadRMAddress/ReadTokenAddresscached optionals are also#ifdef-gated so unused-variable warnings don't pop up when a set is off.ModuleService::registerSubAddressPinsInput()(detection-time pin registration) no longer registers all six sub-address pins unconditionally — it now only registers the pins each enabled set actually needs to read during detection:CMF_MODULES_TOKEN→ all 6 sub-address pins (strict superset of the RM set)CMF_MODULES_RM(without Token) → pins 3..5 only (the 3-bit RM sub-address)RM_I2C,Rover_I2C) → no sub-address pins are registered for detectionPins that no enabled set relies on stay unregistered until
registerSubAddressPinsModule()(called on module insert) claims them per the detected Module'sPinModeMap.Test plan
idf.py buildpasses with the existing RM-set sdkconfig (CONFIG_CMF_MODULES_RM=y).CONFIG_CMF_MODULES_RMand all individualRM_*modules disabled, neither RM sub-address pins (3..5) nor RM I2C probes are reachable at runtime.CONFIG_CMF_MODULES_TOKEN=yandCONFIG_CMF_MODULES_RM=n, pins 0..5 are registered for detection but pins 3..5 are not double-registered.Tracked in: BUT-207. Companion firmware-side KConfig defaults are bumped in ButterBot-Firmware.