Merge branch 'MoonModules:mdev' into Strip_Level_Color_Adjust

This commit is contained in:
Troy
2024-05-07 09:33:46 -04:00
committed by GitHub
39 changed files with 641 additions and 194 deletions

View File

@@ -617,6 +617,9 @@ void FFTcode(void * parameter)
FFT.ComplexToMagnitude(); // Compute magnitudes
#endif
float last_majorpeak = FFT_MajorPeak;
float last_magnitude = FFT_Magnitude;
#ifdef FFT_MAJORPEAK_HUMAN_EAR
// scale FFT results
for(uint_fast16_t binInd = 0; binInd < samplesFFT; binInd++)
@@ -629,6 +632,9 @@ void FFTcode(void * parameter)
FFT.MajorPeak(&FFT_MajorPeak, &FFT_Magnitude); // let the effects know which freq was most dominant
#endif
if (FFT_MajorPeak < (SAMPLE_RATE / samplesFFT)) {FFT_MajorPeak = 1.0f; FFT_Magnitude = 0;} // too low - use zero
if (FFT_MajorPeak > (0.42f * SAMPLE_RATE)) {FFT_MajorPeak = last_majorpeak; FFT_Magnitude = last_magnitude;} // too high - keep last peak
#ifdef FFT_MAJORPEAK_HUMAN_EAR
// undo scaling - we want unmodified values for FFTResult[] computations
for(uint_fast16_t binInd = 0; binInd < samplesFFT; binInd++)
@@ -1794,6 +1800,11 @@ class AudioReactive : public Usermod {
#endif
delay(100); // Give that poor microphone some time to setup.
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3)
if ((i2sckPin == I2S_PIN_NO_CHANGE) && (i2ssdPin >= 0) && (i2swsPin >= 0)
&& ((dmType == 1) || (dmType == 4)) ) dmType = 51; // dummy user support: SCK == -1 --means--> PDM microphone
#endif
useInputFilter = 2; // default: DC blocker
switch (dmType) {
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3)

View File

@@ -186,8 +186,12 @@ class I2SSource : public AudioSource {
.communication_format = i2s_comm_format_t(I2S_COMM_FORMAT_STAND_I2S),
//.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
#ifdef WLEDMM_FASTPATH
#if CONFIG_IDF_TARGET_ESP32 && !defined(BOARD_HAS_PSRAM) // still need to test on boards with PSRAM
.intr_alloc_flags = ESP_INTR_FLAG_IRAM|ESP_INTR_FLAG_LEVEL2|ESP_INTR_FLAG_LEVEL3, // IRAM flag reduces missed samples
#else
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL2|ESP_INTR_FLAG_LEVEL3, // seems to reduce noise
.dma_buf_count = 28, // 160ms buffer (128 * dma_buf_count / sampleRate)
#endif
.dma_buf_count = 24, // 140ms buffer (128 * dma_buf_count / sampleRate)
#else
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL2,
.dma_buf_count = 8,

View File

@@ -85,7 +85,8 @@ class AutoPlaylistUsermod : public Usermod {
// gets called once at boot. Do all initialization that doesn't depend on
// network here
void setup() {
USER_PRINTLN("AutoPlaylistUsermod");
USER_PRINT(F("AutoPlaylistUsermod startup; enabled = "));
USER_PRINT(enabled ? F("true"):F("false")); USER_PRINTLN(F("."));
initDone = true;
}

View File

@@ -488,7 +488,7 @@ void FourLineDisplayUsermod::draw2x2String(uint8_t col, uint8_t row, const char
if (!typeOK || !enabled) return;
if (u8x8 == nullptr) return;
if (FLD_SemaphoreTake(drawMux, maxWait) != pdTRUE) return; // WLEDMM acquire draw mutex
#if defined(ARDUINO_ARCH_ESP32) && !defined(OLD_4LD_FONTS) // WLEDMM use nicer 2x2 font on ESP32
#if defined(ARDUINO_ARCH_ESP32) && !defined(OLD_4LD_FONTS) && !defined(WLEDMM_SAVE_FLASH) // WLEDMM use nicer 2x2 font on ESP32
if (lineHeight>1) { // WLEDMM use 2x3 on 128x64 displays
//u8x8->setFont(u8x8_font_profont29_2x3_r); // sans serif 2x3
u8x8->setFont(u8x8_font_courB18_2x3_r); // courier bold 2x3