Repository navigation
Board detection: host tests against the production sources, StampP4 fixed_board, and a soft I2C bus fix that identifies StampS3Bat - #363
Merged
Conversation
The workflow ran `node --test test/`, which resolved the test directory through test/package.json's main entry and only ran board_spec.test.js. The ten detection test files (48 tests) never ran in CI. Run `npm test`, which expands test/*.test.js, and drop the misleading package.json. Changes to src/M5GFX.cpp and src/M5GFX.h now also trigger the workflow, since the remaining tests read them.
The detection tests in extras/board_spec/test sliced function bodies out of the C++ sources by string search and compiled them against reduced stand-in types, so any refactor broke them and a stand-in could hide a real difference (the P4 test assumed a signature that the production detector does not have). test/board_detect/ (run.sh, C++11, no Node) now includes the production headers and .inl files unchanged: descriptors, detectors, transactions, startup, prepare and the detection integration. Only the hardware is replaced (GPIO, I2C, SPI, delays, eFuse, the dedicated GPIO probe and the Atom touch peripheral). Descriptor and registry contents are kept as fixtures, and a new BoardDetect workflow runs the suite. To make the sources includeable, the detection integration moves from M5GFX.cpp into board_detect/detection_integration.inl and detection_package.inl, and board_detect.inl is split into units. These are moves only: with logging disabled, the allocated sections of the objects are identical for ESP32, ESP32-S3 and ESP32-P4 (Arduino) and ESP32-S3 (ESP-IDF 5.5). Log lines from the moved code now show the new file names. The hardware include and the Atom touch include can be replaced only when M5GFX_BOARD_DETECT_HOST_HAL / M5GFX_BOARD_DETECT_HOST_TOUCH are defined; otherwise they resolve as before. Four checks that need the public M5GFX class, the display construction settings and the M5Unified checks stay in the catalog tests for now (see test/board_detect/README.md).
StampP4 has no detector, so it was missing from the ESP32-P4 board table and fixed_board = board_M5StampP4 failed with "not supported by this chip". Register it as a displayless board, as the other Stamp modules are. Automatic detection is unchanged.
A device can be left mid transfer by traffic not addressed to it. On ESP32-S3 boards the detector reads the PM1 PMIC on G47/G48 in both orientations, because StickS3 (SDA 47, SCL 48) and StampS3Bat (SDA 48, SCL 47) wire it the other way round. The swapped read leaves the StampS3Bat PM1 NACKing with SDA released: it was never identified and fell back to StampS3Mini after five 200 ms attempts. Release alone does not show this state, and the existing recovery only runs while SDA is held low. init now issues nine STOP conditions as a best effort; each also gives a clock, the count of the standard bus clear. The steps are a fixed 5 us each (the standard-mode tLOW, tSU;STO and tBUF minimums) and do not wait for the lines, so a pin that is not an I2C bus cannot stretch the init; a device stretching the clock is not followed there, and beginTransaction still checks the bus. The sequence is skipped for a pin number the platform cannot drive (on ESP32 an out of range number would select another pin's output latch). A version that waited for the lines added 7.7 ms per init on the DinMeter button pin probed as a Paper bus. Measured on 41 boards against the previous build: only StampS3Bat changes (StampS3Mini -> StampS3Bat, begin 2173 ms -> 135 ms), board and display configuration of the others are unchanged and begin time moves by -4 to +3 ms.
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
node --test test/resolved the test directory throughtest/package.json'smainand only ranboard_spec.test.js. The ten detection test files (48 tests) never ran in CI. The workflow now runsnpm test.test/board_detect/(C++11, no Node) now includes the production headers and.inlfiles unchanged and replaces only the hardware (GPIO, I2C, SPI, delays, eFuse, the dedicated GPIO probe, the Atom touch peripheral). A newBoardDetectworkflow runs it.To make the sources includeable, the detection integration moves out of
M5GFX.cppandboard_detect.inlis split into units. These are moves only: with logging disabled, the allocated sections of the objects are identical (ESP32 / ESP32-S3 / ESP32-P4 with Arduino, ESP32-S3 with ESP-IDF 5.5). Log lines from the moved code show the new file names.Four checks that need the public
M5GFXclass, the display construction settings and the M5Unified checks stay in the catalog tests for now (test/board_detect/README.md).fixed_boardto select StampP4 — StampP4 was missing from the ESP32-P4 board table, sofixed_board = board_M5StampP4failed with "not supported by this chip". Automatic detection is unchanged.initnow issues nine STOP conditions on fixed 5 us steps, without waiting for the lines. The same change goes to LovyanGFX (the file is shared).Testing
sh test/board_detect/run.sh(22 programs),npm test/npm run checkinextras/board_specM5.begin2173 ms → 135 ms); the others are unchanged andM5.begintime moves by −4 to +3 ms