Platformio: further refactoring and bug fixing

platformio:
- min and max as postfix instead of prefix
- add common_mm entry for MM build_flags and lib_deps
- add esp32_4MB_V4_max_base entry for V4

const.h and FX_(2D)fcn.cpp: add IRAM_ATTR_YN to switch off if not esp32 (esp8266 not enough iram for this)

json.cpp: start stop compatibility only if 2D not disabled
This commit is contained in:
Ewoud
2022-11-01 18:18:03 +01:00
parent 0474be3069
commit 46ee25b46b
5 changed files with 138 additions and 117 deletions

View File

@@ -109,7 +109,7 @@ void WS2812FX::setUpMatrix() {
}
// absolute matrix version of setPixelColor()
void IRAM_ATTR WS2812FX::setPixelColorXY(int x, int y, uint32_t col)
void IRAM_ATTR_YN WS2812FX::setPixelColorXY(int x, int y, uint32_t col) //WLEDSR: IRAM_ATTR conditionaly
{
#ifndef WLED_DISABLE_2D
if (!isMatrix) return; // not a matrix set-up
@@ -141,13 +141,13 @@ uint32_t WS2812FX::getPixelColorXY(uint16_t x, uint16_t y) {
#ifndef WLED_DISABLE_2D
// XY(x,y) - gets pixel index within current segment (often used to reference leds[] array element)
uint16_t IRAM_ATTR Segment::XY(uint16_t x, uint16_t y) {
uint16_t IRAM_ATTR_YN Segment::XY(uint16_t x, uint16_t y) { //WLEDSR: IRAM_ATTR conditionaly
uint16_t width = virtualWidth(); // segment width in logical pixels
uint16_t height = virtualHeight(); // segment height in logical pixels
return (x%width) + (y%height) * width;
}
void IRAM_ATTR Segment::setPixelColorXY(int x, int y, uint32_t col)
void IRAM_ATTR_YN Segment::setPixelColorXY(int x, int y, uint32_t col) //WLEDSR: IRAM_ATTR conditionaly
{
if (!strip.isMatrix) return; // not a matrix set-up
if (x >= virtualWidth() || y >= virtualHeight() || x<0 || y<0) return; // if pixel would fall out of virtual segment just exit

View File

@@ -691,7 +691,7 @@ void xyFromBlock(uint16_t &x,uint16_t &y, uint16_t i, uint16_t vW, uint16_t vH,
}
void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col)
void IRAM_ATTR_YN Segment::setPixelColor(int i, uint32_t col) //WLEDSR: IRAM_ATTR conditionaly
{
int vStrip = i>>16; // hack to allow running on virtual strips (2D segment columns/rows)
i &= 0xFFFF;

View File

@@ -431,4 +431,12 @@
#define HW_PIN_CSSPI SS
#endif
// WLEDSR: IRAM_ATTR for 8266 causes error: section `.text1' will not fit in region `iram1_0_seg'
// error only in MM, not in upstream... tbd: find out why
#ifdef ARDUINO_ARCH_ESP32
#define IRAM_ATTR_YN IRAM_ATTR
#else
#define IRAM_ATTR_YN
#endif
#endif

View File

@@ -35,7 +35,8 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
if (id >= strip.getMaxSegments()) return;
//WLEDSR: add compatibility for SR presets
// Serial.printf("before %d: %s %s %s %s\n", id, elem["start"].as<std::string>().c_str(), elem["stop"].as<std::string>().c_str(), elem["startY"].as<std::string>().c_str(), elem["stopY"].as<std::string>().c_str());
#ifndef WLED_DISABLE_2D
// Serial.printf("before %d: %s %s %s %s\n", id, elem["start"].as<std::string>().c_str(), elem["stop"].as<std::string>().c_str(), elem["startY"].as<std::string>().c_str(), elem["stopY"].as<std::string>().c_str());
if (strip.isMatrix && !elem["start"].isNull() && !elem["stop"].isNull() && elem["startY"].isNull() && elem["stopY"].isNull()) {
uint16_t start1=elem["start"], stop1=elem["stop"];
elem["start"] = start1%strip.matrixWidth;
@@ -44,6 +45,7 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
elem["stopY"]= strip.matrixWidth?((stop1-1) / strip.matrixWidth) + 1:0;
// Serial.printf("after %s %s %s %s\n", elem["start"].as<std::string>().c_str(), elem["stop"].as<std::string>().c_str(), elem["startY"].as<std::string>().c_str(), elem["stopY"].as<std::string>().c_str());
}
#endif
if (!elem["c1x"].isNull()) elem["c1"] = elem["c1x"];
if (!elem["c2x"].isNull()) elem["c2"] = elem["c2x"];
if (!elem["c3x"].isNull()) elem["c3"] = elem["c3x"];