ARTIFX add support for pixelart + small changes

arti_wled.h:
- add jsonToPixels and frameTime
- change printf to print

usermod_v2_artifx
- return MAX(frameTime,FRAMETIME); 

FX.h and FX_2Dfcn.cpp
- add jsonToPixels

audioreactive.h
- ES8388 allow for default and add moon
This commit is contained in:
Ewoud
2023-04-05 13:22:50 +02:00
parent e4243c4d36
commit cae1c00467
7 changed files with 70 additions and 6 deletions

View File

@@ -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

View File

@@ -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";

View File

@@ -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,'<i>&#9100; ")); oappendi(SR_SQUELCH); oappend("</i>');"); // 0 is field type, 1 is actual field

View File

@@ -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