Hardware pin defaults in i2c and spi pin dropdowns
bugfix: replace oappend(SET_F(name)); by oappend(_name); const.h: remove unset of 8266 variables as no behind the scene actions, this is just bad behavior and the pin drop downs will show this bad behavior xml.cpp: show hardware defaults as ⍼ in dropdowns (better icon needed)
This commit is contained in:
@@ -414,7 +414,7 @@ class Animated_Staircase : public Usermod {
|
||||
}
|
||||
|
||||
void appendConfigData() {
|
||||
oappend(SET_F("addHB('")); oappend(SET_F(_name)); oappend("');");
|
||||
oappend(SET_F("addHB('")); oappend(_name); oappend("');");
|
||||
|
||||
//oappend(SET_F("dd=addDropdown('staircase','selectfield');"));
|
||||
//oappend(SET_F("addOption(dd,'1st value',0);"));
|
||||
|
||||
@@ -226,7 +226,7 @@ public:
|
||||
}
|
||||
|
||||
void appendConfigData() {
|
||||
oappend(SET_F("addHB('")); oappend(SET_F(_name)); oappend("');");
|
||||
oappend(SET_F("addHB('")); oappend(_name); oappend("');");
|
||||
// WLEDMM this usermod can ONLY use HW_I2C - so always use globals
|
||||
//oappend(SET_F("addInfo('BH1750:pin[]',0,'','I2C SCL');"));
|
||||
//oappend(SET_F("rOption('BH1750:pin[]',0,'use global (")); oappendi(i2c_scl); oappend(")',-1);");
|
||||
|
||||
@@ -378,7 +378,7 @@ class UsermodBattery : public Usermod
|
||||
|
||||
void appendConfigData()
|
||||
{
|
||||
oappend(SET_F("addHB('")); oappend(SET_F(_name)); oappend("');");
|
||||
oappend(SET_F("addHB('")); oappend(_name); oappend("');");
|
||||
|
||||
oappend(SET_F("addInfo('Battery:min-voltage', 1, 'v');"));
|
||||
oappend(SET_F("addInfo('Battery:max-voltage', 1, 'v');"));
|
||||
|
||||
@@ -414,7 +414,7 @@ public:
|
||||
|
||||
void appendConfigData()
|
||||
{
|
||||
oappend(SET_F("addHB('")); oappend(SET_F(_name)); oappend("');");
|
||||
oappend(SET_F("addHB('")); oappend(_name); oappend("');");
|
||||
|
||||
oappend(SET_F("addInfo('PIRsensorSwitch:HA-discovery',1,'HA=Home Assistant');")); // 0 is field type, 1 is actual field
|
||||
oappend(SET_F("addInfo('PIRsensorSwitch:notifications',1,'Periodic WS updates');")); // 0 is field type, 1 is actual field
|
||||
|
||||
@@ -306,7 +306,7 @@ class UsermodTemperature : public Usermod {
|
||||
//}
|
||||
|
||||
void appendConfigData() {
|
||||
oappend(SET_F("addHB('")); oappend(SET_F(_name)); oappend("');");
|
||||
oappend(SET_F("addHB('")); oappend(_name); oappend("');");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -303,7 +303,7 @@ class BobLightUsermod : public Usermod {
|
||||
}
|
||||
|
||||
void appendConfigData() {
|
||||
oappend(SET_F("addHB('")); oappend(SET_F(_name)); oappend("');");
|
||||
oappend(SET_F("addHB('")); oappend(_name); oappend("');");
|
||||
|
||||
//oappend(SET_F("dd=addDropdown('usermod','selectfield');"));
|
||||
//oappend(SET_F("addOption(dd,'1st value',0);"));
|
||||
|
||||
@@ -205,7 +205,7 @@ class AutoSaveUsermod : public Usermod {
|
||||
}
|
||||
|
||||
void appendConfigData() {
|
||||
oappend(SET_F("addHB('")); oappend(SET_F(_name)); oappend("');");
|
||||
oappend(SET_F("addHB('")); oappend(_name); oappend("');");
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1044,7 +1044,7 @@ class FourLineDisplayUsermod : public Usermod {
|
||||
//}
|
||||
|
||||
void appendConfigData() {
|
||||
oappend(SET_F("addHB('")); oappend(SET_F(_name)); oappend("');");
|
||||
oappend(SET_F("addHB('")); oappend(_name); oappend("');");
|
||||
|
||||
oappend(SET_F("dd=addDropdown('4LineDisplay','type');"));
|
||||
oappend(SET_F("addOption(dd,'None',0);"));
|
||||
@@ -1082,7 +1082,7 @@ class FourLineDisplayUsermod : public Usermod {
|
||||
|
||||
//WLEDMM add errorMessage to um settings
|
||||
if (strcmp(errorMessage, "") != 0) {
|
||||
oappend(SET_F("addInfo('errorMessage', 0, '<i>error: ")); oappend(SET_F(errorMessage)); oappend("! Correct and reboot</i>');");
|
||||
oappend(SET_F("addInfo('errorMessage', 0, '<i>error: ")); oappend(errorMessage); oappend("! Correct and reboot</i>');");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -616,8 +616,8 @@ public:
|
||||
|
||||
|
||||
void changeCustom(uint8_t par, bool increase) {
|
||||
uint8_t val = 0;
|
||||
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
||||
uint8_t val = 0;
|
||||
if (display && display->wakeDisplay()) {
|
||||
display->redraw(true);
|
||||
// Throw away wake up input
|
||||
@@ -629,11 +629,13 @@ public:
|
||||
if (applyToAll) {
|
||||
uint8_t id = strip.getFirstSelectedSegId();
|
||||
Segment& sid = strip.getSegment(id);
|
||||
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
||||
switch (par) {
|
||||
case 3: val = sid.custom3 = max(min((increase ? sid.custom3+fadeAmount : sid.custom3-fadeAmount), 255), 0); break;
|
||||
case 2: val = sid.custom2 = max(min((increase ? sid.custom2+fadeAmount : sid.custom2-fadeAmount), 255), 0); break;
|
||||
default: val = sid.custom1 = max(min((increase ? sid.custom1+fadeAmount : sid.custom1-fadeAmount), 255), 0); break;
|
||||
}
|
||||
#endif
|
||||
for (byte i=0; i<strip.getSegmentsNum(); i++) {
|
||||
Segment& seg = strip.getSegment(i);
|
||||
if (!seg.isActive() || i == id) continue;
|
||||
@@ -644,12 +646,14 @@ public:
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
||||
Segment& seg = strip.getMainSegment();
|
||||
switch (par) {
|
||||
case 3: val = seg.custom3 = max(min((increase ? seg.custom3+fadeAmount : seg.custom3-fadeAmount), 255), 0); break;
|
||||
case 2: val = seg.custom2 = max(min((increase ? seg.custom2+fadeAmount : seg.custom2-fadeAmount), 255), 0); break;
|
||||
default: val = seg.custom1 = max(min((increase ? seg.custom1+fadeAmount : seg.custom1-fadeAmount), 255), 0); break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
lampUdated();
|
||||
#ifdef USERMOD_FOUR_LINE_DISPLAY
|
||||
@@ -868,7 +872,7 @@ public:
|
||||
//WLEDMM: add appendConfigData
|
||||
void appendConfigData()
|
||||
{
|
||||
oappend(SET_F("addHB('")); oappend(SET_F(_name)); oappend("');");
|
||||
oappend(SET_F("addHB('")); oappend(_name); oappend("');");
|
||||
|
||||
#ifdef ENCODER_DT_PIN
|
||||
oappend(SET_F("xOption('Rotary-Encoder:DT-pin',1,' ⎌',")); oappendi(ENCODER_DT_PIN); oappend(");");
|
||||
|
||||
@@ -418,13 +418,7 @@
|
||||
|
||||
// HW_PIN_SCL & HW_PIN_SDA are used for information in usermods settings page and usermods themselves
|
||||
// which GPIO pins are actually used in a hardwarea layout (controller board)
|
||||
// you cannot change HW I2C pins on 8266
|
||||
#if defined(ESP8266) && defined(HW_PIN_SCL)
|
||||
#undef HW_PIN_SCL
|
||||
#endif
|
||||
#if defined(ESP8266) && defined(HW_PIN_SDA)
|
||||
#undef HW_PIN_SDA
|
||||
#endif
|
||||
//WLEDMM: unchangeable pins are not treated here by undef them, but elsewhere in the code
|
||||
// defaults for 1st I2C on ESP32 (Wire global)
|
||||
#ifndef HW_PIN_SCL
|
||||
#define HW_PIN_SCL -1 //WLEDMM if not defined, -1 will be used (not SCL/22) (also for esp8266?)
|
||||
@@ -435,16 +429,7 @@
|
||||
|
||||
// HW_PIN_SCLKSPI & HW_PIN_MOSISPI & HW_PIN_MISOSPI are used for information in usermods settings page and usermods themselves
|
||||
// which GPIO pins are actually used in a hardwarea layout (controller board)
|
||||
// you cannot change HW SPI pins on 8266
|
||||
#if defined(ESP8266) && defined(HW_PIN_CLOCKSPI)
|
||||
#undef HW_PIN_CLOCKSPI
|
||||
#endif
|
||||
#if defined(ESP8266) && defined(HW_PIN_MOSISPI) //WLEDMM renamed from HW_PIN_DATASPI
|
||||
#undef HW_PIN_MOSISPI
|
||||
#endif
|
||||
#if defined(ESP8266) && defined(HW_PIN_MISOSPI)
|
||||
#undef HW_PIN_MISOSPI
|
||||
#endif
|
||||
//WLEDMM: unchangeable pins are not treated here by undef them, but elsewhere in the code
|
||||
// defaults for VSPI on ESP32 (SPI global, SPI.cpp) as HSPI is used by WLED (bus_wrapper.h)
|
||||
#ifndef HW_PIN_CLOCKSPI
|
||||
#define HW_PIN_CLOCKSPI -1 //WLEDMM if not defined -1 will be used (not SCK/18)
|
||||
|
||||
@@ -712,23 +712,28 @@ void getSettingsJS(AsyncWebServerRequest* request, byte subPage, char* dest) //W
|
||||
oappend(SET_F("d.getElementsByName(\"if:SCLK:pin\")[1].value=")); oappendi(spi_sclk); oappend(";");
|
||||
//WLEDMM: add help info showing defaults
|
||||
oappend(SET_F("addInfo('if:SDA:pin',0,'', 'SDA');"));
|
||||
oappend(SET_F("xOption('if:SDA:pin',1,' ⍼',")); oappendi(SDA); oappend(");");
|
||||
#ifdef HW_PIN_SDA
|
||||
oappend(SET_F("xOption('if:SDA:pin',1,' ⎌',")); oappendi(HW_PIN_SDA); oappend(");");
|
||||
#endif
|
||||
oappend(SET_F("addInfo('if:SCL:pin',0,'', 'SCL');"));
|
||||
oappend(SET_F("xOption('if:SCL:pin',1,' ⍼',")); oappendi(SCL); oappend(");");
|
||||
oappend(SET_F("disableROPins('if:SCL:pin',1);"));
|
||||
#ifdef HW_PIN_SCL
|
||||
oappend(SET_F("xOption('if:SCL:pin',1,' ⎌',")); oappendi(HW_PIN_SCL); oappend(");");
|
||||
#endif
|
||||
oappend(SET_F("addInfo('if:MOSI:pin',0,'', 'MOSI');"));
|
||||
oappend(SET_F("xOption('if:MOSI:pin',1,' ⍼',")); oappendi(MOSI); oappend(");");
|
||||
#ifdef HW_PIN_MOSISPI //WLEDMM renamed from HW_PIN_DATASPI
|
||||
oappend(SET_F("xOption('if:MOSI:pin',1,' ⎌',")); oappendi(HW_PIN_MOSISPI); oappend(");");
|
||||
#endif
|
||||
oappend(SET_F("addInfo('if:MISO:pin',0,'', 'MISO');"));
|
||||
oappend(SET_F("xOption('if:MISO:pin',1,' ⍼',")); oappendi(MISO); oappend(");");
|
||||
#ifdef HW_PIN_MISOSPI
|
||||
oappend(SET_F("xOption('if:MISO:pin',1,' ⎌',")); oappendi(HW_PIN_MISOSPI); oappend(");");
|
||||
#endif
|
||||
oappend(SET_F("addInfo('if:SCLK:pin',0,'', 'SCLK');"));
|
||||
oappend(SET_F("xOption('if:SCLK:pin',1,' ⍼',")); oappendi(SCK); oappend(");");
|
||||
oappend(SET_F("disableROPins('if:SCLK:pin',1);"));
|
||||
#ifdef HW_PIN_CLOCKSPI
|
||||
oappend(SET_F("xOption('if:SCLK:pin',1,' ⎌',")); oappendi(HW_PIN_CLOCKSPI); oappend(");");
|
||||
|
||||
Reference in New Issue
Block a user