pre-merge
cleanup: - version increase - clean up debug messages - minor fixes in platformio.ini - fix compilation with -D WLED_DISABLE_2D helping the compiler to optimize: - a few more __attribute__((pure)) - fx.cpp marked a few local functions as "static"
This commit is contained in:
@@ -887,6 +887,7 @@ build_flags_S =
|
||||
-Wno-attributes -Wno-unused-variable -Wno-unused-function -Wno-deprecated-declarations ;disables some stupid warnings
|
||||
;-D WLED_DISABLE_BROWNOUT_DET ; enable if you get "brownout detected" errors at startup
|
||||
-D WLED_USE_MY_CONFIG
|
||||
; -D WLED_DISABLE_2D ;; un-comment to build a firmware without 2D matrix support
|
||||
; -D WLED_USE_CIE_BRIGHTNESS_TABLE ;; experimental: use different color / brightness lookup table
|
||||
-D USERMOD_AUDIOREACTIVE
|
||||
-D UM_AUDIOREACTIVE_USE_NEW_FFT ; use latest (upstream) FFTLib, instead of older library modified by blazoncek. Slightly faster, more accurate, needs 2KB RAM extra
|
||||
@@ -1009,6 +1010,7 @@ build_flags = ${common.build_flags} ${esp32.build_flagsV4} ${common_mm.build_fla
|
||||
-Wno-misleading-indentation -Wno-format-truncation
|
||||
-Wshadow=compatible-local ;; emit warning in case a local variable "shadows" another local one
|
||||
;-Wstack-usage=2732 ;; warn if a function needs more that 30% of availeable stack ("stack usage might be unbounded", "stack usage is 2824 bytes")
|
||||
;-Wsuggest-attribute=const -Wsuggest-attribute=pure ;; ask compiler for hints on attributes
|
||||
-D WLED_ENABLE_DMX_INPUT
|
||||
lib_deps = ${esp32.lib_depsV4} ${common_mm.lib_deps_S}
|
||||
https://github.com/someweisguy/esp_dmx.git#v3.0.2-beta ;; for DMX_INPUT
|
||||
@@ -1124,7 +1126,7 @@ build_unflags = ${common.build_unflags}
|
||||
-D CORE_DEBUG_LEVEL=0
|
||||
build_flags = ${esp32_4MB_M_base.build_flags}
|
||||
${Debug_Flags.build_flags}
|
||||
-D WLED_DEBUG_HEAP ;; WLEDMM enable heap debugging
|
||||
; -D WLED_DEBUG_HEAP ;; WLEDMM enable heap debugging (needs newer framework versions)
|
||||
-D CORE_DEBUG_LEVEL=2 ;; 2=warning
|
||||
-D WLED_RELEASE_NAME=esp32_16MB_M_debug
|
||||
monitor_filters = esp32_exception_decoder
|
||||
|
||||
@@ -214,9 +214,11 @@ float ARTI::arti_external_function(uint8_t function, float par1, float par2, flo
|
||||
case F_millis:
|
||||
return millis();
|
||||
|
||||
#ifndef WLED_DISABLE_2D
|
||||
case F_jsonToPixels:
|
||||
SEGMENT.jsonToPixels(SEGMENT.name,(uint8_t)par1);
|
||||
return floatNull;
|
||||
#endif
|
||||
|
||||
default: {}
|
||||
}
|
||||
|
||||
@@ -37,12 +37,12 @@
|
||||
#define indexToVStrip(index, stripNr) ((index) | (int((stripNr)+1)<<16))
|
||||
|
||||
// effect utility functions
|
||||
uint8_t sin_gap(uint16_t in) {
|
||||
static uint8_t sin_gap(uint16_t in) {
|
||||
if (in & 0x100) return 0;
|
||||
return sin8(in + 192); // correct phase shift of sine so that it starts and stops at 0
|
||||
}
|
||||
|
||||
uint16_t triwave16(uint16_t in) {
|
||||
static uint16_t triwave16(uint16_t in) {
|
||||
if (in < 0x8000) return in *2;
|
||||
return 0xFFFF - (in - 0x8000)*2;
|
||||
}
|
||||
@@ -54,7 +54,7 @@ uint16_t triwave16(uint16_t in) {
|
||||
* @param attdec attac & decay, max. pulsewidth / 2
|
||||
* @returns signed waveform value
|
||||
*/
|
||||
int8_t tristate_square8(uint8_t x, uint8_t pulsewidth, uint8_t attdec) {
|
||||
static int8_t tristate_square8(uint8_t x, uint8_t pulsewidth, uint8_t attdec) {
|
||||
int8_t a = 127;
|
||||
if (x > 127) {
|
||||
a = -127;
|
||||
|
||||
15
wled00/FX.h
15
wled00/FX.h
@@ -97,7 +97,6 @@ void strip_wait_until_idle(String whoCalledMe); // WLEDMM implemented in FX_fcn.
|
||||
assuming each segment uses the same amount of data. 256 for ESP8266, 640 for ESP32. */
|
||||
#define FAIR_DATA_PER_SEG (MAX_SEGMENT_DATA / strip.getMaxSegments())
|
||||
|
||||
//#define MIN_SHOW_DELAY (_frametime < 16 ? 8 : 15)
|
||||
#define MIN_SHOW_DELAY (_frametime < 16 ? (_frametime <8? (_frametime <7? (_frametime <6 ? 2 :3) :4) : 8) : 15) // WLEDMM support higher framerates (up to 250fps)
|
||||
|
||||
#define NUM_COLORS 3 /* number of colors per segment */
|
||||
@@ -502,7 +501,7 @@ typedef struct Segment {
|
||||
Segment(Segment &&orig) noexcept; // move constructor
|
||||
|
||||
~Segment() {
|
||||
//#ifdef WLED_DEBUG
|
||||
#ifdef WLED_DEBUG
|
||||
if(canUseSerial()) {
|
||||
Serial.print(F("Destroying segment:"));
|
||||
if (name) Serial.printf(" name=%s (%p)", name, name);
|
||||
@@ -510,7 +509,7 @@ typedef struct Segment {
|
||||
if (ledsrgb) Serial.printf(" [%sledsrgb %u bytes]", Segment::_globalLeds ? "global ":"",length()*sizeof(CRGB));
|
||||
Serial.println();
|
||||
}
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
// WLEDMM only delete segments when they are not in use
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
@@ -603,8 +602,8 @@ typedef struct Segment {
|
||||
void addPixelColor(int n, CRGB c, bool fast = false) { addPixelColor(n, RGBW32(c.r,c.g,c.b,0), fast); } // automatically inline
|
||||
void fadePixelColor(uint16_t n, uint8_t fade);
|
||||
uint8_t get_random_wheel_index(uint8_t pos);
|
||||
uint32_t __attribute__((pure)) color_from_palette(uint_fast16_t, bool mapping, bool wrap, uint8_t mcol, uint8_t pbri = 255);
|
||||
uint32_t color_wheel(uint8_t pos);
|
||||
uint32_t __attribute__((pure)) color_from_palette(uint_fast16_t, bool mapping, bool wrap, uint8_t mcol, uint8_t pbri = 255);
|
||||
uint32_t __attribute__((pure)) color_wheel(uint8_t pos);
|
||||
|
||||
// 2D matrix
|
||||
inline uint16_t virtualWidth() const { // WLEDMM use fast types, and make function inline
|
||||
@@ -762,9 +761,9 @@ class WS2812FX { // 96 bytes
|
||||
}
|
||||
|
||||
~WS2812FX() {
|
||||
//#ifdef WLED_DEBUG
|
||||
#ifdef WLED_DEBUG
|
||||
if (Serial) Serial.println(F("~WS2812FX destroying strip.")); // WLEDMM can't use DEBUG_PRINTLN here
|
||||
//#endif
|
||||
#endif
|
||||
if (customMappingTable) delete[] customMappingTable;
|
||||
_mode.clear();
|
||||
_modeData.clear();
|
||||
@@ -853,7 +852,7 @@ class WS2812FX { // 96 bytes
|
||||
ablMilliampsMax,
|
||||
currentMilliamps,
|
||||
getLengthPhysical(void),
|
||||
getLengthTotal(void), // will include virtual/nonexistent pixels in matrix
|
||||
__attribute__((pure)) getLengthTotal(void), // will include virtual/nonexistent pixels in matrix //WLEDMM attribute added
|
||||
getFps();
|
||||
|
||||
inline uint16_t getFrameTime(void) { return _frametime; }
|
||||
|
||||
@@ -79,7 +79,7 @@ void WS2812FX::setUpMatrix() {
|
||||
if ((size > 0) && (customMappingTable == nullptr)) { // second try
|
||||
DEBUG_PRINTLN("setUpMatrix: trying to get fresh memory block.");
|
||||
customMappingTable = (uint16_t*) calloc(size, sizeof(uint16_t));
|
||||
if (customMappingTable == nullptr) DEBUG_PRINTLN("setUpMatrix: alloc failed");
|
||||
if (customMappingTable == nullptr) USER_PRINTLN("setUpMatrix: alloc failed");
|
||||
}
|
||||
if (customMappingTable != nullptr) customMappingTableSize = size;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ void WS2812FX::setUpMatrix() {
|
||||
#endif
|
||||
} else { // memory allocation error
|
||||
customMappingTableSize = 0;
|
||||
DEBUG_PRINTLN(F("Ledmap alloc error."));
|
||||
USER_PRINTLN(F("Ledmap alloc error."));
|
||||
isMatrix = false;
|
||||
panels = 0;
|
||||
panel.clear();
|
||||
|
||||
@@ -94,7 +94,7 @@ uint16_t Segment::maxHeight = 1;
|
||||
|
||||
// copy constructor - creates a new segment by copy from orig, but does not copy buffers. Does not modify orig!
|
||||
Segment::Segment(const Segment &orig) {
|
||||
USER_PRINTLN(F("-- Copy segment constructor --"));
|
||||
DEBUG_PRINTLN(F("-- Copy segment constructor --"));
|
||||
memcpy((void*)this, (void*)&orig, sizeof(Segment)); //WLEDMM copy to this
|
||||
transitional = false; // copied segment cannot be in transition
|
||||
name = nullptr;
|
||||
@@ -114,8 +114,7 @@ Segment::Segment(const Segment &orig) {
|
||||
void Segment::allocLeds() {
|
||||
size_t size = sizeof(CRGB)*max((size_t) length(), ledmapMaxSize); //TroyHack
|
||||
if ((size < sizeof(CRGB)) || (size > 164000)) { //softhack too small (<3) or too large (>160Kb)
|
||||
USER_PRINTF("allocLeds warning: size == %u !!\n", size);
|
||||
USER_FLUSH();
|
||||
DEBUG_PRINTF("allocLeds warning: size == %u !!\n", size);
|
||||
if (ledsrgb && (ledsrgbSize == 0)) {
|
||||
USER_PRINTLN("allocLeds warning: ledsrgbSize == 0 but ledsrgb!=NULL");
|
||||
free(ledsrgb); ledsrgb=nullptr;
|
||||
@@ -135,7 +134,7 @@ void Segment::allocLeds() {
|
||||
|
||||
// move constructor --> moves everything (including buffer) from orig to this
|
||||
Segment::Segment(Segment &&orig) noexcept {
|
||||
USER_PRINTLN(F("-- Move segment constructor --"));
|
||||
DEBUG_PRINTLN(F("-- Move segment constructor --"));
|
||||
memcpy((void*)this, (void*)&orig, sizeof(Segment));
|
||||
orig.transitional = false; // old segment cannot be in transition any more
|
||||
orig.name = nullptr;
|
||||
@@ -149,7 +148,7 @@ Segment::Segment(Segment &&orig) noexcept {
|
||||
|
||||
// copy assignment --> overwrite segment withg orig - deletes old buffers in "this", but does not change orig!
|
||||
Segment& Segment::operator= (const Segment &orig) {
|
||||
USER_PRINTLN(F("-- Copy-assignment segment --"));
|
||||
DEBUG_PRINTLN(F("-- Copy-assignment segment --"));
|
||||
if (this != &orig) {
|
||||
// clean destination
|
||||
transitional = false; // copied segment cannot be in transition
|
||||
@@ -182,7 +181,7 @@ Segment& Segment::operator= (const Segment &orig) {
|
||||
|
||||
// move assignment --> moves everything (including buffers) from "orig" to "this"
|
||||
Segment& Segment::operator= (Segment &&orig) noexcept {
|
||||
USER_PRINTLN(F("-- Move-assignment segment --"));
|
||||
DEBUG_PRINTLN(F("-- Move-assignment segment --"));
|
||||
if (this != &orig) {
|
||||
transitional = false; // just temporary
|
||||
if (name) { delete[] name; name = nullptr; } // free old name
|
||||
@@ -257,7 +256,8 @@ void Segment::setUpLeds() {
|
||||
ledsrgbSize = length() * sizeof(CRGB); // also set this when using global leds.
|
||||
//USER_PRINTF("\nsetUpLeds() Global LEDs: startX=%d stopx=%d startY=%d stopy=%d maxwidth=%d; length=%d, size=%d\n\n", start, stop, startY, stopY, Segment::maxWidth, length(), ledsrgbSize/3);
|
||||
#else
|
||||
leds = &Segment::_globalLeds[start];
|
||||
ledsrgb = &Segment::_globalLeds[start];
|
||||
ledsrgbSize = length() * sizeof(CRGB); // also set this when using global leds.
|
||||
#endif
|
||||
} else if (length() > 0) { //WLEDMM we always want a new buffer //softhack007 quickfix - avoid malloc(0) which is undefined behaviour (should not happen, but i've seen it)
|
||||
//#if defined(ARDUINO_ARCH_ESP32) && defined(BOARD_HAS_PSRAM) && defined(WLED_USE_PSRAM)
|
||||
@@ -630,12 +630,12 @@ class JMapC {
|
||||
char previousSegmentName[50] = "";
|
||||
|
||||
~JMapC() {
|
||||
USER_PRINTLN("~JMapC");
|
||||
DEBUG_PRINTLN("~JMapC");
|
||||
deletejVectorMap();
|
||||
}
|
||||
void deletejVectorMap() {
|
||||
if (jVectorMap.size() > 0) {
|
||||
USER_PRINTLN("delete jVectorMap");
|
||||
DEBUG_PRINTLN("delete jVectorMap");
|
||||
for (size_t i=0; i<jVectorMap.size(); i++)
|
||||
if (jVectorMap[i].array) { delete[] jVectorMap[i].array; jVectorMap[i].array = nullptr; } // softhack007 quickfix for memory leak
|
||||
jVectorMap.clear();
|
||||
@@ -679,7 +679,7 @@ class JMapC {
|
||||
else if (SEGMENT.name != nullptr && strcmp(SEGMENT.name, previousSegmentName) != 0) {
|
||||
uint32_t dataSize = 0;
|
||||
deletejVectorMap();
|
||||
USER_PRINT("New "); USER_PRINTLN(SEGMENT.name);
|
||||
DEBUG_PRINT("New "); DEBUG_PRINTLN(SEGMENT.name);
|
||||
char jMapFileName[50];
|
||||
strcpy(jMapFileName, "/");
|
||||
strcat(jMapFileName, SEGMENT.name);
|
||||
@@ -699,6 +699,7 @@ class JMapC {
|
||||
if (err)
|
||||
{
|
||||
USER_PRINTF("deserializeJson() of parseTree failed with code %s\n", err.c_str());
|
||||
USER_FLUSH();
|
||||
if (SEGMENT.name) delete[] SEGMENT.name; SEGMENT.name = nullptr; //need to clear the name as otherwise continuously loaded // softhack007 avoid deleting nullptr
|
||||
return;
|
||||
}
|
||||
@@ -752,7 +753,7 @@ class JMapC {
|
||||
//WLEDMM jMap
|
||||
void Segment::createjMap() {
|
||||
if (!jMap) {
|
||||
USER_PRINTLN("createjMap");
|
||||
DEBUG_PRINTLN("createjMap");
|
||||
jMap = new JMapC();
|
||||
}
|
||||
}
|
||||
@@ -761,7 +762,7 @@ void Segment::createjMap() {
|
||||
void Segment::deletejMap() {
|
||||
//Should be called from ~Segment but causes crash (and ~Segment is called quite often...)
|
||||
if (jMap) {
|
||||
USER_PRINTLN("deletejMap");
|
||||
DEBUG_PRINTLN("deletejMap");
|
||||
delete (JMapC *)jMap; jMap = nullptr;
|
||||
}
|
||||
}
|
||||
@@ -1991,7 +1992,7 @@ void WS2812FX::restartRuntime() {
|
||||
}
|
||||
|
||||
void WS2812FX::resetSegments(bool boundsOnly) { //WLEDMM add boundsonly
|
||||
USER_PRINTF("resetSegments %d %dx%d\n", boundsOnly, Segment::maxWidth, Segment::maxHeight);
|
||||
DEBUG_PRINTF("resetSegments %d %dx%d\n", boundsOnly, Segment::maxWidth, Segment::maxHeight);
|
||||
if (!boundsOnly) {
|
||||
_segments.clear(); // destructs all Segment as part of clearing
|
||||
#ifndef WLED_DISABLE_2D
|
||||
@@ -2328,7 +2329,7 @@ bool WS2812FX::deserializeMap(uint8_t n) {
|
||||
loadedLedmap = n;
|
||||
f.close();
|
||||
|
||||
DEBUG_PRINTF("Custom ledmap: %d\n", loadedLedmap);
|
||||
USER_PRINTF("Custom ledmap: %d\n", loadedLedmap);
|
||||
#ifdef WLED_DEBUG_MAPS
|
||||
for (uint16_t j=0; j<customMappingSize; j++) { // fixing a minor warning: declaration of 'i' shadows a previous local
|
||||
if (!(j%Segment::maxWidth)) DEBUG_PRINTLN();
|
||||
@@ -2338,7 +2339,8 @@ bool WS2812FX::deserializeMap(uint8_t n) {
|
||||
#endif
|
||||
} else { // memory allocation error
|
||||
customMappingTableSize = 0;
|
||||
DEBUG_PRINTLN(F("Deserializemap: Ledmap alloc error."));
|
||||
USER_PRINTLN(F("Deserializemap: Ledmap alloc error."));
|
||||
USER_FLUSH();
|
||||
}
|
||||
|
||||
releaseJSONBufferLock();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
// version code in format yymmddb (b = daily build)
|
||||
#define VERSION 2307100
|
||||
#define VERSION 2307130
|
||||
|
||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||
//#define WLED_USE_MY_CONFIG
|
||||
|
||||
Reference in New Issue
Block a user