From d452da26425ceecc8e7342a50b4c27fec866faf7 Mon Sep 17 00:00:00 2001 From: Ewoud Date: Wed, 22 Mar 2023 16:31:07 +0100 Subject: [PATCH] NetDebug fix and small changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AudioReactive: show ☾ specific IR: cleanup json.cpp: bugfix: NetDebug not in presets wled.cpp and wled_server.cpp: show servername in DEBUG INFO --- usermods/audioreactive/audio_reactive.h | 10 ++++++++-- wled00/ir.cpp | 25 +++++++++++++------------ wled00/ir_codes.h | 2 +- wled00/json.cpp | 18 +++++++++--------- wled00/wled.cpp | 1 + wled00/wled_server.cpp | 2 +- 6 files changed, 33 insertions(+), 25 deletions(-) diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index 53f6bc6b..99d6d7bf 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -2172,9 +2172,9 @@ class AudioReactive : public Usermod { oappend(SET_F("addOption(dd,'Generic I2S PDM',5);")); #endif #if SR_DMTYPE==51 - oappend(SET_F("addOption(dd,'.Legacy I2S PDM (⎌)',51);")); + oappend(SET_F("addOption(dd,'.Legacy I2S PDM ☾ (⎌)',51);")); #else - oappend(SET_F("addOption(dd,'.Legacy I2S PDM',51);")); + oappend(SET_F("addOption(dd,'.Legacy I2S PDM ☾',51);")); #endif #endif @@ -2196,12 +2196,17 @@ class AudioReactive : public Usermod { oappend(SET_F("addOption(dd,'Floating (⎌)',0);")); oappend(SET_F("addOption(dd,'Freeze',1);")); oappend(SET_F("addOption(dd,'Fast Freeze',2);")); + oappend(SET_F("addInfo('AudioReactive:experiments:micLev',1,'☾');")); + oappend(SET_F("dd=addDropdown('AudioReactive','experiments:freqDist');")); oappend(SET_F("addOption(dd,'Normal (⎌)',0);")); oappend(SET_F("addOption(dd,'RightShift',1);")); + oappend(SET_F("addInfo('AudioReactive:experiments:freqDist',1,'☾');")); + oappend(SET_F("dd=addDropdown('AudioReactive','experiments:freqRMS');")); oappend(SET_F("addOption(dd,'Off (⎌)',0);")); oappend(SET_F("addOption(dd,'On',1);")); + oappend(SET_F("addInfo('AudioReactive:experiments:freqRMS',1,'☾');")); oappend(SET_F("dd=addDropdown('AudioReactive','dynamics:limiter');")); oappend(SET_F("addOption(dd,'Off',0);")); @@ -2273,6 +2278,7 @@ class AudioReactive : public Usermod { #else oappend(SET_F("addOption(dd,'userdefined #2',9);")); #endif + oappend(SET_F("addInfo('AudioReactive:frequency:profile',1,'☾');")); oappend(SET_F("dd=addDropdown('AudioReactive','sync:mode');")); oappend(SET_F("addOption(dd,'Off',0);")); diff --git a/wled00/ir.cpp b/wled00/ir.cpp index 7d0c984b..a25a25be 100644 --- a/wled00/ir.cpp +++ b/wled00/ir.cpp @@ -611,7 +611,7 @@ void decodeIR9(uint32_t code) lastValidCode = code; } -//WLEDMM +//WLEDMM and Athom void decodeIR24MC(uint32_t code) { bool isSolid = strip.getMainSegment().mode==0; @@ -620,8 +620,8 @@ void decodeIR24MC(uint32_t code) case IR24_MC_OFF : if (bri > 0) briLast = bri; bri = 0; break; case IR24_MC_AUTO : changeEffect(FX_MODE_FADE); break; case IR24_MC_ON : bri = briLast; break; - case IR24_MC_MODES : changeEffect(relativeChange(effectCurrent, 1, 0, strip.getModeCount() -1)); break; - case IR24_MC_MODE : changeEffect(relativeChange(effectCurrent, -1, 0, strip.getModeCount() -1)); break; + case IR24_MC_MODES : changeEffect(relativeChange(effectCurrent, 1, 0, strip.getModeCount() -1)); break; //WLEDMM: sound and non sound modes + case IR24_MC_MODE : changeEffect(relativeChange(effectCurrent, -1, 0, strip.getModeCount() -1)); break; //WLEDMM: sound and non sound modes case IR24_MC_BRIGHTER : incBrightness(); break; case IR24_MC_DARKER : decBrightness(); break; case IR24_MC_QUICK : changeEffectSpeed( 16); break; @@ -629,15 +629,16 @@ void decodeIR24MC(uint32_t code) case IR24_MC_RED : changeColor(COLOR_RED); break; case IR24_MC_GREEN : changeColor(COLOR_GREEN); break; case IR24_MC_BLUE : changeColor(COLOR_BLUE); break; - case IR24_MC_R1 : isSolid?changeColor(COLOR_YELLOW):presetFallback(1, strip.isMatrix?FX_MODE_2DAKEMI:FX_MODE_PIXELS, effectPalette); break; - case IR24_MC_G1 : isSolid?changeColor(COLOR_DoderBlue):presetFallback(2, strip.isMatrix?FX_MODE_2DWAVERLY:FX_MODE_GRAVIMETER, effectPalette); break; - case IR24_MC_B1 : isSolid?changeColor(COLOR_Indigo):presetFallback(3, strip.isMatrix?FX_MODE_2DWAVERLY:FX_MODE_JUGGLES, effectPalette); break; - case IR24_MC_R2 : isSolid?changeColor(COLOR_Magenta):presetFallback(4, strip.isMatrix?FX_MODE_2DGAMEOFLIFE:FX_MODE_PIXELWAVE, effectPalette); break; - case IR24_MC_G2 : isSolid?changeColor(COLOR_DarkBlue):presetFallback(5, strip.isMatrix?FX_MODE_BOUNCINGBALLS:FX_MODE_FREQPIXELS, effectPalette); break; - case IR24_MC_B2 : isSolid?changeColor(COLOR_Lime):presetFallback(6, strip.isMatrix?FX_MODE_2DDISTORTIONWAVES:FX_MODE_NOISEMOVE, effectPalette); break; - case IR24_MC_R3 : isSolid?changeColor(COLOR_Orange):presetFallback(7, strip.isMatrix?FX_MODE_2DLISSAJOUS:FX_MODE_BLURZ, effectPalette); break; - case IR24_MC_G3 : isSolid?changeColor(COLOR_WHITE):presetFallback(8, strip.isMatrix?FX_MODE_2DJULIA:FX_MODE_NOISEMETER, effectPalette); break; - case IR24_MC_B3 : isSolid?changeEffect(FX_MODE_RAINBOW_CYCLE):presetFallback(9, strip.isMatrix?FX_MODE_2DSWIRL:FX_MODE_PUDDLES, effectPalette); break; + //WLEDMM: change to presets (with fallbacks - not working !!) if mode is not solid + case IR24_MC_R1 : isSolid?changeColor(COLOR_YELLOW):presetFallback(1,strip.isMatrix?FX_MODE_2DAKEMI:FX_MODE_PIXELS,effectPalette); break; + case IR24_MC_G1 : isSolid?changeColor(COLOR_DoderBlue):presetFallback(2,strip.isMatrix?FX_MODE_2DWAVERLY:FX_MODE_GRAVIMETER,effectPalette); break; + case IR24_MC_B1 : isSolid?changeColor(COLOR_Indigo):presetFallback(3,strip.isMatrix?FX_MODE_2DWAVERLY:FX_MODE_JUGGLES,effectPalette); break; + case IR24_MC_R2 : isSolid?changeColor(COLOR_Magenta):presetFallback(4,strip.isMatrix?FX_MODE_2DGAMEOFLIFE:FX_MODE_PIXELWAVE,effectPalette); break; + case IR24_MC_G2 : isSolid?changeColor(COLOR_DarkBlue):presetFallback(5,strip.isMatrix?FX_MODE_BOUNCINGBALLS:FX_MODE_FREQPIXELS,effectPalette); break; + case IR24_MC_B2 : isSolid?changeColor(COLOR_Lime):presetFallback(6,strip.isMatrix?FX_MODE_2DDISTORTIONWAVES:FX_MODE_NOISEMOVE,effectPalette); break; + case IR24_MC_R3 : isSolid?changeColor(COLOR_Orange):presetFallback(7,strip.isMatrix?FX_MODE_2DLISSAJOUS:FX_MODE_BLURZ,effectPalette); break; + case IR24_MC_G3 : isSolid?changeColor(COLOR_WHITE):presetFallback(8,strip.isMatrix?FX_MODE_2DJULIA:FX_MODE_NOISEMETER,effectPalette); break; + case IR24_MC_B3 : isSolid?changeEffect(FX_MODE_RAINBOW_CYCLE):presetFallback(9,strip.isMatrix?FX_MODE_2DSWIRL:FX_MODE_PUDDLES,effectPalette); break; case IR24_MC_MUSIC1 : changeEffectIntensity(16); break; //WLEDMM: was sound modes but does not work in 0.14 case IR24_MC_LOCK : changeEffect(FX_MODE_STATIC); break; case IR24_MC_MUSIC2 : changeEffectIntensity(-16); break; //WLEDMM: was sound modes but does not work in 0.14 diff --git a/wled00/ir_codes.h b/wled00/ir_codes.h index f98a33bf..ce0f0b60 100644 --- a/wled00/ir_codes.h +++ b/wled00/ir_codes.h @@ -212,7 +212,7 @@ #define IR21_FADE 0xFF02FD #define IR21_SMOOTH 0xFFC23D -//WLEDMM +//WLEDMM and Athom #define IR24_MC_OFF 0xF7C03F // OFF #define IR24_MC_AUTO 0xF7E01F // AUTO #define IR24_MC_ON 0xF740BF // ON diff --git a/wled00/json.cpp b/wled00/json.cpp index 4f935444..64ac2bfc 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -348,7 +348,7 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId) bool stateResponse = root[F("v")] | false; - //WLEDMM: store netDebug + //WLEDMM: store netDebug, also if not WLED_DEBUG #if defined(WLED_DEBUG_HOST) bool oldValue = netDebugEnabled; netDebugEnabled = root[F("netDebug")] | netDebugEnabled; @@ -520,7 +520,7 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId) void serializeSegment(JsonObject& root, Segment& seg, byte id, bool forPreset, bool segmentBounds) { - //WLEDMM add USER_PRINT + //WLEDMM add DEBUG_PRINT (not USER_PRINT) String temp; serializeJson(root, temp); DEBUG_PRINTF("serializeSegment %s\n", temp.c_str()); @@ -590,15 +590,10 @@ void serializeSegment(JsonObject& root, Segment& seg, byte id, bool forPreset, b void serializeState(JsonObject root, bool forPreset, bool includeBri, bool segmentBounds, bool selectedSegmentsOnly) { - //WLEDMM add USER_PRINT + //WLEDMM add DEBUG_PRINT (not USER_PRINT) String temp; serializeJson(root, temp); - DEBUG_PRINTF("serializeState %s\n", temp.c_str()); - - //WLEDMM: store netDebug - #if defined(WLED_DEBUG_HOST) - root[F("netDebug")] = netDebugEnabled; - #endif + DEBUG_PRINTF("serializeState %d %s\n", forPreset, temp.c_str()); if (includeBri) { root["on"] = (bri > 0); @@ -607,6 +602,11 @@ void serializeState(JsonObject root, bool forPreset, bool includeBri, bool segme } if (!forPreset) { + //WLEDMM: store netDebug + #if defined(WLED_DEBUG_HOST) + root[F("netDebug")] = netDebugEnabled; + #endif + if (errorFlag) {root[F("error")] = errorFlag; errorFlag = ERR_NONE;} //prevent error message to persist on screen root["ps"] = (currentPreset > 0) ? currentPreset : -1; diff --git a/wled00/wled.cpp b/wled00/wled.cpp index fd3007f0..bffc94bf 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -194,6 +194,7 @@ void WLED::loop() #ifdef WLED_DEBUG if (millis() - debugTime > 29999) { DEBUG_PRINTLN(F("---DEBUG INFO---")); + DEBUG_PRINT(F("Name: ")); DEBUG_PRINTLN(serverDescription); DEBUG_PRINT(F("Runtime: ")); DEBUG_PRINTLN(millis()); DEBUG_PRINT(F("Unix time: ")); toki.printTime(toki.getTime()); DEBUG_PRINT(F("Free heap: ")); DEBUG_PRINTLN(ESP.getFreeHeap()); diff --git a/wled00/wled_server.cpp b/wled00/wled_server.cpp index 0febf941..82d37a95 100644 --- a/wled00/wled_server.cpp +++ b/wled00/wled_server.cpp @@ -363,7 +363,7 @@ void initServer() }); #endif server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ - USER_PRINTF("Client request\n"); //WLEDMM: want to see if client connects to wled + USER_PRINTF("%s Client request %s\n", serverDescription, request->url()); //WLEDMM: want to see if client connects to wled, for netdebug also wants to know server if (captivePortal(request)) return; serveIndexOrWelcome(request); });