Skip to content

Commit

Permalink
Keep the I2C options, but make disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
netmindz committed Oct 20, 2023
1 parent 032e2f6 commit 94c8961
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions usermods/audioreactive/audio_reactive.h
Original file line number Diff line number Diff line change
Expand Up @@ -1743,12 +1743,6 @@ class AudioReactive : public Usermod {
audioSource = new WM8978Source(SAMPLE_RATE, BLOCK_SIZE, 1.0f);
//useInputFilter = 0; // to disable low-cut software filtering and restore previous behaviour
delay(100);
// WLEDMM align global pins
if ((sdaPin >= 0) && (i2c_sda < 0)) i2c_sda = sdaPin; // copy usermod prefs into globals (if globals not defined)
if ((sclPin >= 0) && (i2c_scl < 0)) i2c_scl = sclPin;
if (i2c_sda >= 0) sdaPin = -1; // -1 = use global
if (i2c_scl >= 0) sclPin = -1;

if (audioSource) audioSource->initialize(i2swsPin, i2ssdPin, i2sckPin, mclkPin);
break;

Expand Down Expand Up @@ -2469,6 +2463,8 @@ class AudioReactive : public Usermod {
configComplete &= getJsonValue(top[FPSTR(_digitalmic)]["pin"][1], i2swsPin);
configComplete &= getJsonValue(top[FPSTR(_digitalmic)]["pin"][2], i2sckPin);
configComplete &= getJsonValue(top[FPSTR(_digitalmic)]["pin"][3], mclkPin);
configComplete &= getJsonValue(top[FPSTR(_digitalmic)]["pin"][4], i2c_sda);
configComplete &= getJsonValue(top[FPSTR(_digitalmic)]["pin"][5], i2c_scl);

configComplete &= getJsonValue(top["config"][F("squelch")], soundSquelch);
configComplete &= getJsonValue(top["config"][F("gain")], sampleGain);
Expand Down Expand Up @@ -2694,9 +2690,14 @@ class AudioReactive : public Usermod {
oappend(SET_F("xOpt('AudioReactive:digitalmic:pin[]',3,' ⎌',")); oappendi(MCLK_PIN); oappend(");");
#endif

oappend(SET_F("dRO('AudioReactive:digitalmic:pin[]',5);")); // disable read only pins
oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',4,'','I2C SDA');"));
oappend(SET_F("rOpt('AudioReactive:digitalmic:pin[]',4,'using global (")); oappendi(i2c_sda); oappend(")',-1);");
oappend(SET_F("disableElement('AudioReactive:digitalmic:pin[]',4);"));

oappend(SET_F("addInfo('AudioReactive:digitalmic:pin[]',5,'','I2C SCL');"));
oappend(SET_F("rOpt('AudioReactive:digitalmic:pin[]',5,'using global (")); oappendi(i2c_scl); oappend(")',-1);");
oappend(SET_F("disableElement('AudioReactive:digitalmic:pin[]',5);"));

#endif
}

Expand Down

0 comments on commit 94c8961

Please sign in to comment.