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:
@@ -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<map.size(); i+=3) {
|
||||
// USER_PRINTF("%s %s %s", map[i].as<String>().c_str(), map[i+1].as<String>().c_str(), map[i+2].as<String>().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"
|
||||
|
||||
Reference in New Issue
Block a user