add a fallback for missing VSPI on ESP32-C3 etc.
What does this implement/fix?
On the ESP32-C3 etc. the define VSPI is missing, this PR adds a fallback by setting VSPI when it is missing.
Types of changes
- [x] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Other
Related issue or feature (if applicable): fixes
Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#<esphome-docs PR number goes here>
Test Environment
- [x] ESP32
- [x] ESP32 IDF
- [ ] ESP8266
Checklist:
- [ ] The code change is tested and works locally.
- [ ] Tests have been added to verify that the new code works (under
tests/folder).
If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated in esphome-docs.
Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration (spi) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
There must be a reason they specifically did not add it here: https://github.com/espressif/arduino-esp32/blob/c93bf11f1e3c3ca8088b837525dcdd78c8579a7a/cores/esp32/esp32-hal-spi.h#L29-L37
I tried this PR on my FunHouse board and it works, but according to this the ESP32S2 does not have VSPI, only FSPI, which is likely why it's not defined as @jesserockz pointed out above.
Edit: more info here
Out of curiosity I tried changing this line to this->hw_spi_ = new SPIClass(FSPI); and this works...it actually works noticeably better. The refresh time on my FunHouse ST7789 display dropped from over 4 seconds down to less than one. I think this is the (more) correct resolution...wrapped appropriately to detect the ESP32 vs. other variants (S2, S3, C3, etc.).
@nielsnl68 @jesserockz would love to know if https://github.com/esphome/esphome/pull/3728 works for you -- I believe this is the more proper/correct fix
Fantastic that you found a better way of doing this. My PR was based on some suggestions. When yours is faster then this one then lets close this one and use yours.
closed in favor of #3728