Prevent arduino core from assigning default MISO pin#5672
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughIn ChangesDotStar SPI MISO Configuration Fix
🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@wled00/bus_wrapper.h`:
- Line 361: The inline comment next to the miso default workaround in
bus_wrapper.h contains a typo ("meaans"); update that comment to read "means" so
it correctly documents that in the Arduino core -1 means "default" and passing
127 prevents SPI.begin() from assigning the default pin (refer to the miso
variable and the SPI.begin() mention in the same line).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: cf6716cc-4df1-4e57-89b7-ad50d608a1e1
📒 Files selected for processing (1)
wled00/bus_wrapper.h
| #ifdef ESP8266 | ||
| dotStar_strip->Begin(); | ||
| #else | ||
| if (miso == -1) miso = 127; // note: in arduino core, -1 means "default" not "none", passing 127 as the MISO pin is a workaround to prevent SPI.begin() assign the default pin, see #5670 |
There was a problem hiding this comment.
@DedeHai is this workaround also working / needed for esp-idf V5 (arduino-esp32 3.5.x)?
If not, then we could wrap the line in #if ESP_IDF_VERSION_MAJOR == 4 .. #endif for future compatibility.
There was a problem hiding this comment.
from what I see, yes. the arduino.core code looks the same in the V5 branch
edit:
if it works the same I can't say - depends on what the IDF core does if you assign an out of scope pin but I would assume it wont tear down the SPI - just as it is in V4
willmmiles
left a comment
There was a problem hiding this comment.
Translating between our convention (-1 == unassigned) and whatever the arduino core does is the right way.
That said: this will break the setup of people who didn't think to set the pin because it turned out that they'd wired it on the default, and it just worked. I don't know if we want to think about some kind of upgrade handoff here. At the very least we'll need a "possibly breaking change" note on this one.
I do not follow (on both counts). This is only about the MISO i.e. input pin which is unused for LED purposes. Is there any dual-use of the SPI and is that even allowed? The scenario I imagine is that the busmanager claims the SPI via NPB and after that a UM also uses that same SPI - which would initialize it anew. Or what is the scenario? |
Adds invalid dummy pin if miso is undefined to prevent default fallback
fixes #5670
copy of comment from #5670:
Summary by CodeRabbit