Refactor global pins settings using dropdowns and add to rotary_encoder

- replace rOption by  xOption (extend option) to show default value (⎌)
- Usermod rotary_encoder: add appendConfigData function and show help and default functions
- Settings.htm: Move Usermods(pins) below the usermods

Settings_um.htm
- remove SDAPin etc
- comment check(0,k) as not used anymore
- add xOption
- add generated global pin fields (using addField) in ldS
- remove hard coded global pin fields

set.cpp: set i2c_sda etc using new generated fields
xml.cpp: set generated fields values using i2c_sda etc and show defaults
This commit is contained in:
Ewoud
2023-01-04 12:17:14 +01:00
parent 0571aa92f2
commit 23663a46f9
9 changed files with 379 additions and 394 deletions

View File

@@ -865,6 +865,21 @@ public:
DEBUG_PRINTLN(F("Rotary Encoder config saved."));
}
//WLEDMM: add appendConfigData
void appendConfigData()
{
oappend(SET_F("addInfo('Rotary-Encoder:help',0,'<button onclick=\"location.href=&quot;https://mm.kno.wled.ge/usermods/Rotary-Encoder&quot;\" type=\"button\">?</button>');")); // 0 is field type, 1 is actual field
#ifdef ENCODER_DT_PIN
oappend(SET_F("xOption('Rotary-Encoder:DT-pin',1,' ⎌',")); oappendi(ENCODER_DT_PIN); oappend(");");
#endif
#ifdef ENCODER_CLK_PIN
oappend(SET_F("xOption('Rotary-Encoder:CLK-pin',1,' ⎌',")); oappendi(ENCODER_CLK_PIN); oappend(");");
#endif
#ifdef ENCODER_SW_PIN
oappend(SET_F("xOption('Rotary-Encoder:SW-pin',1,' ⎌',")); oappendi(ENCODER_SW_PIN); oappend(");");
#endif
}
/**
* readFromConfig() is called before setup() to populate properties from values stored in cfg.json
*