Repository navigation
Board detection: derive target metadata from the catalog, explain detection decisions in place, and check probed pins per detector family - #364
Merged
Conversation
Use the board catalog as the source of chip, board ID and generated names instead of repeating those facts in target adapters. Check canonical IDs against the C++ enum and generate complete detect-class expectations for local constexpr copies. Exercise every detector family with production GPIO probes and reject any observed pad absent from its detection snapshot.
Generated detector lists, order constraints and GPIO power-hold IDs now carry
the board names and the existing reason from detector_order.json as comments,
so a numeric edge such as { 154, 140 } no longer has to be resolved through
boards.hpp. The emitted code (values, order, IDs) is unchanged. A reason that
contains a backslash or the ??/ trigraph is rejected by the schema and the
generator, because a trailing line splice would pull the next edge into the
comment.
The common detection code states each decision at the place that makes it:
the family ranking and scan stop in the runner, the no_signature reason that
ends a session without retrying, which failures retry up to max_attempts, the
persistence condition, and what transaction rollback does not restore (LP pad
ownership, deliberately, and PMIC register writes). Local names in the runner
separate the confirm gate from the family result.
def_flag_fallback and fallback_only() are renamed to def_flag_candidate_only
and candidate_only(). These internal names were easy to confuse with the
public fallback_board setting, which is unrelated: the flag marks boards that
have no positive signature and are only returned as weak candidates.
ESP32-C6 package and flash values are documented next to their checks
(pkg 1 = QFN32 FH4/FH8, 0 = QFN40; StampC6 is FH8 with FLASH_CAP 2, NanoC6 is
FH4 with FLASH_CAP 1, as mapped by esptool's get_chip_description).
Firmware machine code is unchanged apart from the renamed helper's symbol
name and one debug log wording.
The host pin-coverage test previously only checked that every probed pad was in the chip-wide detection snapshot. That set is a union over all boards of the chip, so a probe moved to a pin another board already contributes, or a catalog pin left behind after the code changed, passed unnoticed (NanoC6 GPIO3, for example, also enters the set as NessoN1 touch INT). The generator now emits, for each detector family, the union of its members' detection pins (probe_pins, descriptor pins, detect_class and Cardputer sense pins, computed by the same function as the firmware snapshot) together with the member IDs. The host test checks that the pads touched by signature() and confirm() stay inside that set and that the C++ family members match the catalog. prepare/refine are outside this check. The Atom touch and LED pads are shared with the host model so they are observed too. This found the Atom family probing GPIO 2, 13, 21, 23, 27 and 34 without declaring them. probe_pins for AtomLite, AtomMatrix, AtomU and AtomVoice now follow each board's path through the detector, with the missing pins added to their catalogs. Probe pins on a board without wiring_output never reach the firmware snapshot, so the catalog check now rejects that combination (E_TGT_DETECTION_WIRING). The firmware detection pin sets are unchanged.
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.
Commits
targets.jsonno longer repeats chip, legacy board ID, board enum, descriptor name and C++ namespace; they come from the board catalog (two namespace exceptions remain explicit). Canonical board IDs are checked against thelgfx::board_tenum (octal, duplicate, conditional and macro definitions are rejected). Detect-class expectations are generated. A new host test runs every detector family with the production GPIO probes and fails if a pad is touched outside the detection snapshot.detector_order.jsonas comments, so{ 154, 140 }reads as StampC6 before NanoC6 without a trip toboards.hpp. The common code states each decision where it is made (family ranking and scan stop,no_signatureending a session, which failures retry, the persistence condition, what rollback does not restore).def_flag_fallback/fallback_only()becomedef_flag_candidate_only/candidate_only(): these internal names were easy to confuse with the unrelated publicfallback_boardsetting. Areasoncontaining\or??/is rejected, because a line splice would pull the next generated edge into the comment.signature()/confirm()to be inside the family's own catalog pins (computed by the same function as the firmware snapshot) and the C++ family members to match the catalog. It found the Atom family probing GPIO 2, 13, 21, 23, 27 and 34 without declaring them; the four Atom boards now declare the pins on their own path. Probe pins on a board withoutwiring_outputnever reach the firmware snapshot, so that combination is now rejected (E_TGT_DETECTION_WIRING).Detection behavior is unchanged. With logging disabled, the allocated sections of
M5GFX.cpp.oare identical to develop (ESP32 / ESP32-S3 / ESP32-P4 / ESP32-C6 with Arduino, ESP32-S3 with ESP-IDF 5.5), except for the renamed internal helper's section name. The firmware detection pin sets are unchanged.Testing
sh test/board_detect/run.sh(31 programs, 34 families),npm test/npm run checkinextras/board_specprobe_pinsonly, an Atom touch pin removed from the catalog, a family member removed)