mirror of
https://github.com/wled/WLED.git
synced 2025-07-16 15:26:31 +00:00
4 Line Display new type fix.
This commit is contained in:
parent
cd8d2c141e
commit
6f0e944c7e
@ -130,7 +130,7 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
// gets called once at boot. Do all initialization that doesn't depend on
|
// gets called once at boot. Do all initialization that doesn't depend on
|
||||||
// network here
|
// network here
|
||||||
void setup() {
|
void setup() {
|
||||||
if (type==NONE) return;
|
if (type == NONE) return;
|
||||||
if (!pinManager.allocatePin(sclPin)) { sclPin = -1; type = NONE; return;}
|
if (!pinManager.allocatePin(sclPin)) { sclPin = -1; type = NONE; return;}
|
||||||
if (!pinManager.allocatePin(sdaPin)) { pinManager.deallocatePin(sclPin); sclPin = sdaPin = -1; type = NONE; return; }
|
if (!pinManager.allocatePin(sdaPin)) { pinManager.deallocatePin(sclPin); sclPin = sdaPin = -1; type = NONE; return; }
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -141,6 +141,7 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
u8x8 = (U8X8 *) new U8X8_SSD1306_128X32_UNIVISION_HW_I2C(U8X8_PIN_NONE, sclPin, sdaPin); // Pins are Reset, SCL, SDA
|
u8x8 = (U8X8 *) new U8X8_SSD1306_128X32_UNIVISION_HW_I2C(U8X8_PIN_NONE, sclPin, sdaPin); // Pins are Reset, SCL, SDA
|
||||||
|
lineHeight = 1;
|
||||||
break;
|
break;
|
||||||
case SH1106:
|
case SH1106:
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
@ -149,6 +150,7 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
u8x8 = (U8X8 *) new U8X8_SH1106_128X64_WINSTAR_HW_I2C(U8X8_PIN_NONE, sclPin, sdaPin); // Pins are Reset, SCL, SDA
|
u8x8 = (U8X8 *) new U8X8_SH1106_128X64_WINSTAR_HW_I2C(U8X8_PIN_NONE, sclPin, sdaPin); // Pins are Reset, SCL, SDA
|
||||||
|
lineHeight = 2;
|
||||||
break;
|
break;
|
||||||
case SSD1306_64:
|
case SSD1306_64:
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
@ -157,6 +159,7 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
u8x8 = (U8X8 *) new U8X8_SSD1306_128X64_NONAME_HW_I2C(U8X8_PIN_NONE, sclPin, sdaPin); // Pins are Reset, SCL, SDA
|
u8x8 = (U8X8 *) new U8X8_SSD1306_128X64_NONAME_HW_I2C(U8X8_PIN_NONE, sclPin, sdaPin); // Pins are Reset, SCL, SDA
|
||||||
|
lineHeight = 2;
|
||||||
break;
|
break;
|
||||||
case SSD1305:
|
case SSD1305:
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
@ -165,6 +168,7 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
u8x8 = (U8X8 *) new U8X8_SSD1305_128X32_ADAFRUIT_HW_I2C(U8X8_PIN_NONE, sclPin, sdaPin); // Pins are Reset, SCL, SDA
|
u8x8 = (U8X8 *) new U8X8_SSD1305_128X32_ADAFRUIT_HW_I2C(U8X8_PIN_NONE, sclPin, sdaPin); // Pins are Reset, SCL, SDA
|
||||||
|
lineHeight = 1;
|
||||||
break;
|
break;
|
||||||
case SSD1305_64:
|
case SSD1305_64:
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
@ -173,6 +177,7 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
u8x8 = (U8X8 *) new U8X8_SSD1305_128X64_ADAFRUIT_HW_I2C(U8X8_PIN_NONE, sclPin, sdaPin); // Pins are Reset, SCL, SDA
|
u8x8 = (U8X8 *) new U8X8_SSD1305_128X64_ADAFRUIT_HW_I2C(U8X8_PIN_NONE, sclPin, sdaPin); // Pins are Reset, SCL, SDA
|
||||||
|
lineHeight = 2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
u8x8 = nullptr;
|
u8x8 = nullptr;
|
||||||
@ -657,13 +662,10 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
sclPin = newScl;
|
sclPin = newScl;
|
||||||
sdaPin = newSda;
|
sdaPin = newSda;
|
||||||
type = newType;
|
type = newType;
|
||||||
lineHeight = type==SSD1306 ? 1 : 2;
|
|
||||||
} else {
|
} else {
|
||||||
// changing paramters from settings page
|
// changing paramters from settings page
|
||||||
if (sclPin!=newScl || sdaPin!=newSda || type!=newType) {
|
if (sclPin!=newScl || sdaPin!=newSda || type!=newType) {
|
||||||
if (type==SSD1306) delete (static_cast<U8X8*>(u8x8));
|
if (type != NONE) delete (static_cast<U8X8*>(u8x8));
|
||||||
if (type==SH1106) delete (static_cast<U8X8*>(u8x8));
|
|
||||||
if (type==SSD1306_64) delete (static_cast<U8X8*>(u8x8));
|
|
||||||
pinManager.deallocatePin(sclPin);
|
pinManager.deallocatePin(sclPin);
|
||||||
pinManager.deallocatePin(sdaPin);
|
pinManager.deallocatePin(sdaPin);
|
||||||
sclPin = newScl;
|
sclPin = newScl;
|
||||||
@ -673,7 +675,6 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
type = newType;
|
type = newType;
|
||||||
lineHeight = type==SSD1306 ? 1 : 2;
|
|
||||||
setup();
|
setup();
|
||||||
needsRedraw |= true;
|
needsRedraw |= true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user