diff --git a/usermods/artifx/arti_wled.h b/usermods/artifx/arti_wled.h index d9c8e363..dd85931b 100644 --- a/usermods/artifx/arti_wled.h +++ b/usermods/artifx/arti_wled.h @@ -86,12 +86,15 @@ enum Externals F_square, F_clamp, - F_printf + F_print, + F_jsonToPixels, //reorder only when creating new wledvxyz.json + F_frameTime }; #if ARTI_PLATFORM != ARTI_ARDUINO #define PI 3.141592654 #endif +uint32_t frameTime = 0; float ARTI::arti_external_function(uint8_t function, float par1, float par2, float par3, float par4, float par5) { @@ -209,6 +212,10 @@ float ARTI::arti_external_function(uint8_t function, float par1, float par2, flo case F_millis: return millis(); + case F_jsonToPixels: + SEGMENT.jsonToPixels(SEGMENT.name,(uint8_t)par1); + return floatNull; + default: {} } #else // not arduino @@ -273,6 +280,9 @@ float ARTI::arti_external_function(uint8_t function, float par1, float par2, flo case F_millis: return 1000; + + case F_jsonToPixels: + return par1; } #endif @@ -315,7 +325,7 @@ float ARTI::arti_external_function(uint8_t function, float par1, float par2, flo return t > par3 ? par3 : t; } - case F_printf: { + case F_print: { if (par3 == floatNull) { if (par2 == floatNull) { PRINT_ARTI("%f\n", par1); @@ -454,6 +464,9 @@ void ARTI::arti_set_external_variable(float value, uint8_t variable, float par1, SEGMENT.setPixelColorXY((uint16_t)par1%SEGMENT.virtualWidth(), (uint16_t)par2%SEGMENT.virtualHeight(), value); //2D value!! return; + case F_frameTime: + frameTime = (uint16_t)value; + return; } #else switch (variable) @@ -470,6 +483,9 @@ void ARTI::arti_set_external_variable(float value, uint8_t variable, float par1, RUNLOG_ARTI("arti_set_external_variable: leds(%f, %f) := %f\n", par1, par2, value); return; + case F_frameTime: + frameTime = (uint16_t)value; + return; } #endif diff --git a/usermods/artifx/usermod_v2_artifx.h b/usermods/artifx/usermod_v2_artifx.h index eb919073..9a6fe443 100644 --- a/usermods/artifx/usermod_v2_artifx.h +++ b/usermods/artifx/usermod_v2_artifx.h @@ -96,7 +96,7 @@ uint16_t mode_ARTIFX(void) { } } - return FRAMETIME; + return MAX(frameTime,FRAMETIME); } static const char _data_FX_MODE_ARTIFX[] PROGMEM = "⚙️ ARTI-FX ☾@Speed,Intensity,Custom 1, Custom 2, Custom 3;!;!;1;mp12=0"; diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index 1c14cb79..64b33548 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -2188,7 +2188,11 @@ class AudioReactive : public Usermod { oappend(SET_F("addOption(dd,'.Legacy I2S PDM ☾',51);")); #endif #endif - oappend(SET_F("addOption(dd,'ES8388',6);")); + #if SR_DMTYPE==6 + oappend(SET_F("addOption(dd,'ES8388 ☾ (⎌)',6);")); + #else + oappend(SET_F("addOption(dd,'ES8388 ☾',6);")); + #endif #ifdef SR_SQUELCH oappend(SET_F("addInfo('AudioReactive:config:squelch',1,'⎌ ")); oappendi(SR_SQUELCH); oappend("');"); // 0 is field type, 1 is actual field diff --git a/usermods/usermod_v2_fastled/usermod_v2_fastled.h b/usermods/usermod_v2_fastled/usermod_v2_fastled.h index f26de688..c105396b 100644 --- a/usermods/usermod_v2_fastled/usermod_v2_fastled.h +++ b/usermods/usermod_v2_fastled/usermod_v2_fastled.h @@ -2,11 +2,12 @@ #include "wled.h" -//WLEDMM usermod: CC BY-NC 3.0 licensed effects by Stefan Petrick, only include this usermod only if you accept the terms! +#warning WLEDMM usermod: CC BY-NC 3.0 licensed effects by Stefan Petrick, include this usermod only if you accept the terms! //======================================================================================================================== //======================================================================================================================== //======================================================================================================================== + // Polar basics demo for the // FastLED Podcast #2 // https://www.youtube.com/watch?v=KKjFRZFBUrQ diff --git a/wled00/FX.h b/wled00/FX.h index f62ce24a..b7bd3e06 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -616,6 +616,7 @@ typedef struct Segment { void blur2d(fract8 blur_amount) { blur(blur_amount); } void fill_solid(CRGB c) { fill(RGBW32(c.r,c.g,c.b,0)); } void nscale8(uint8_t scale); + bool jsonToPixels(char *name, uint8_t fileNr); #else uint16_t XY(uint16_t x, uint16_t y) { return x; } void setPixelColorXY(int x, int y, uint32_t c) { setPixelColor(x, c); } diff --git a/wled00/FX_2Dfcn.cpp b/wled00/FX_2Dfcn.cpp index 84335dd8..98a8f184 100644 --- a/wled00/FX_2Dfcn.cpp +++ b/wled00/FX_2Dfcn.cpp @@ -552,6 +552,48 @@ void Segment::drawArc(uint16_t x0, uint16_t y0, uint16_t radius, uint32_t color, } } +bool Segment::jsonToPixels(char * name, uint8_t fileNr) { + char fileName[32]; + //WLEDMM: als support segment name ledmaps + bool isFile = false;; + // strcpy_P(fileName, PSTR("/mario")); + sprintf(fileName, "/%s%d.json", name, fileNr); //WLEDMM: trick to not include 0 in ledmap.json + // strcat(fileName, ".json"); + isFile = WLED_FS.exists(fileName); + + if (!isFile) { + return false; + } + + if (!requestJSONBufferLock(23)) return false; + + USER_PRINTF("file %s %d", fileName, isFile); + + if (!readObjectFromFile(fileName, nullptr, &doc)) { + releaseJSONBufferLock(); + return false; //if file does not exist just exit + } + + JsonArray map = doc[F("seg")][F("i")]; + + // serializeJson(map, Serial); + + if (!map.isNull() && map.size()) { // not an empty map + + for (uint16_t i=0; i().c_str(), map[i+1].as().c_str(), map[i+2].as().c_str()); + CRGB color = CRGB(map[i+2][0], map[i+2][1], map[i+2][2]); + for (uint16_t j=map[i]; j<=map[i+1]; j++) { + setPixelColor(j, color); + } + } + } + USER_PRINTLN(); + + releaseJSONBufferLock(); + return true; +} + #include "src/font/console_font_4x6.h" #include "src/font/console_font_5x8.h" #include "src/font/console_font_5x12.h" diff --git a/wled00/wled.h b/wled00/wled.h index d673e11b..3b4fc24b 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2304040 +#define VERSION 2304050 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG