attempt to fix issue #24 (untested)

an attempt to fix problems with SPI OLED displays. It compiles, but not tested yet.
This commit is contained in:
Frank
2023-03-23 20:17:17 +01:00
parent 272a41f715
commit 8c92b76e2e
2 changed files with 10 additions and 1 deletions

View File

@@ -416,8 +416,17 @@ class FourLineDisplayUsermod : public Usermod {
if (ioPin[0] < 0 || ioPin[1] < 0) {
ioPin[0] = spi_sclk;
ioPin[1] = spi_mosi;
} else {
if ((spi_sclk < 0) && (spi_mosi < 0)) { // WLEDMM UM pins are valid, but global = -1 --> copy pins to "global"
spi_sclk = ioPin[0];
spi_mosi = ioPin[1];
}
}
if ((ioPin[0] < 0 || ioPin[1] < 0) && (spi_sclk < 0 || spi_mosi < 0)) { // invalid pins, or "use global" and global pins not defined
typeOK=false; strcpy(errorMessage, PSTR("SPI No Pins defined")); return; } //WLEDMM bugfix - ensure that "final" GPIO are valid
isHW = (ioPin[0]==spi_sclk && ioPin[1]==spi_mosi);
if ((ioPin[0] == -1) || (ioPin[1] == -1)) isHW = true; // WLEDMM "use global" = hardware
PinManagerPinType cspins[3] = { { ioPin[2], true }, { ioPin[3], true }, { ioPin[4], true } };
if (!pinManager.allocateMultiplePins(cspins, 3, PinOwner::UM_FourLineDisplay)) { typeOK=false; strcpy(errorMessage, PSTR("SPI3 alloc pins failed")); return; }
if (isHW) po = PinOwner::HW_SPI; // allow multiple allocations of HW I2C bus pins

View File

@@ -8,7 +8,7 @@
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2303231
#define VERSION 2303232
//uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG