-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,506 additions
and
1,418 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,10 @@ | |
// @license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 | ||
// @license For non GPL-v3 usage, commercial licenses must be purchased. Contact [email protected] | ||
|
||
function appName() { | ||
return "Led"; | ||
} | ||
|
||
function userFun(data) { | ||
let buffer = new Uint8Array(data); | ||
if (buffer[0]==1 && jsonValues.pview) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
@title StarMod | ||
@file AppFixture.cpp | ||
@file LedFixture.cpp | ||
@date 20240228 | ||
@repo https://github.com/ewowi/StarMod | ||
@Authors https://github.com/ewowi/StarMod/commits/main | ||
|
@@ -9,7 +9,7 @@ | |
@license For non GPL-v3 usage, commercial licenses must be purchased. Contact [email protected] | ||
*/ | ||
|
||
#include "AppFixture.h" | ||
#include "LedFixture.h" | ||
|
||
#include "../Sys/SysModFiles.h" | ||
#include "../Sys/SysStarModJson.h" | ||
|
@@ -44,8 +44,12 @@ void Fixture::projectAndMap() { | |
if (leds->doMap) { | ||
USER_PRINTF("Leds pre [%d] f:%d p:%d s:%d\n", rowNr, leds->fx, leds->projectionNr, ledsList.size()); | ||
//vectors really gone now? | ||
for (std::vector<std::vector<unsigned16>> ::iterator physMap=leds->mappingTable.begin(); physMap!=leds->mappingTable.end(); ++physMap) | ||
physMap->clear(); | ||
for (std::vector<unsigned16>* physMap:leds->mappingTable) { | ||
if (physMap) { | ||
physMap->clear(); | ||
delete physMap; | ||
} | ||
} | ||
leds->mappingTable.clear(); | ||
leds->sharedData.clear(); | ||
} | ||
|
@@ -328,14 +332,13 @@ void Fixture::projectAndMap() { | |
if (indexV >= leds->mappingTable.size()) { | ||
for (size_t i = leds->mappingTable.size(); i <= indexV; i++) { | ||
// USER_PRINTF("mapping %d,%d,%d add physMap before %d %d\n", pixel.y, pixel.y, pixel.z, indexV, leds->mappingTable.size()); | ||
std::vector<unsigned16> physMap; | ||
if (i != indexV) | ||
physMap.push_back(0); | ||
leds->mappingTable.push_back(physMap); //abort() was called at PC 0x40191473 on core 1 std::allocator<unsigned short> >&&) | ||
leds->mappingTable.push_back(nullptr); //abort() was called at PC 0x40191473 on core 1 std::allocator<unsigned short> >&&) | ||
} | ||
} | ||
//indexV is within the square | ||
leds->mappingTable[indexV].push_back(indexP); //add the current led in the right physMap | ||
if (!leds->mappingTable[indexV]) | ||
leds->mappingTable[indexV] = new std::vector<unsigned16>; | ||
leds->mappingTable[indexV]->push_back(indexP); //add the current led in the right physMap | ||
} | ||
else | ||
USER_PRINTF("dev post [%d] indexP too high %d>=%d or %d (p:%d m:%d) p:%d,%d,%d\n", rowNr, indexP, nrOfLeds, NUM_LEDS_Max, leds->mappingTable.size(), indexP, pixel.x, pixel.y, pixel.z); | ||
|
@@ -366,7 +369,7 @@ void Fixture::projectAndMap() { | |
after = strtok(NULL, " "); | ||
unsigned16 startLed = atoi(before); | ||
unsigned16 nrOfLeds = atoi(after) - atoi(before) + 1; | ||
print->fFormat(details, sizeof(details)-1, "%d-%d", min(prevIndexP, startLed), max((unsigned16)(indexP - 1), nrOfLeds)); //careful: AppModEffects:loop uses this to assign to FastLed | ||
print->fFormat(details, sizeof(details)-1, "%d-%d", min(prevIndexP, startLed), max((unsigned16)(indexP - 1), nrOfLeds)); //careful: LedModEffects:loop uses this to assign to FastLed | ||
USER_PRINTF("pins extend leds %d: %s\n", currPin, details); | ||
//tbd: more check | ||
|
||
|
@@ -375,7 +378,7 @@ void Fixture::projectAndMap() { | |
} | ||
else {//allocate new pin | ||
//tbd: check if free | ||
print->fFormat(details, sizeof(details)-1, "%d-%d", prevIndexP, indexP - 1); //careful: AppModEffects:loop uses this to assign to FastLed | ||
print->fFormat(details, sizeof(details)-1, "%d-%d", prevIndexP, indexP - 1); //careful: LedModEffects:loop uses this to assign to FastLed | ||
USER_PRINTF("pins %d: %s\n", currPin, details); | ||
pins->allocatePin(currPin, "Leds", details); | ||
} | ||
|
@@ -415,8 +418,8 @@ void Fixture::projectAndMap() { | |
leds->nrOfLeds = leds->mappingTable.size(); | ||
|
||
unsigned16 indexV = 0; | ||
for (std::vector<std::vector<unsigned16>>::iterator physMap=leds->mappingTable.begin(); physMap!=leds->mappingTable.end(); ++physMap) { | ||
if (physMap->size()) { | ||
for (std::vector<unsigned16>* physMap:leds->mappingTable) { | ||
if (physMap && physMap->size()) { | ||
// USER_PRINTF("ledV %d mapping: #ledsP (%d):", indexV, physMap->size()); | ||
|
||
for (unsigned16 indexP:*physMap) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
@title StarMod | ||
@file AppModEffects.cpp | ||
@file LedLeds.cpp | ||
@date 20240226 | ||
@repo https://github.com/ewowi/StarMod | ||
@Authors https://github.com/ewowi/StarMod/commits/main | ||
|
@@ -9,7 +9,7 @@ | |
@license For non GPL-v3 usage, commercial licenses must be purchased. Contact [email protected] | ||
*/ | ||
|
||
#include "AppLeds.h" | ||
#include "LedLeds.h" | ||
|
||
//convenience functions to call fastled functions out of the Leds namespace (there naming conflict) | ||
void fastled_fadeToBlackBy(CRGB* leds, unsigned16 num_leds, unsigned8 fadeBy) { | ||
|
@@ -24,14 +24,11 @@ void fastled_fill_rainbow(struct CRGB * targetArray, int numToFill, unsigned8 in | |
|
||
// maps the virtual led to the physical led(s) and assign a color to it | ||
void Leds::setPixelColor(unsigned16 indexV, CRGB color, unsigned8 blendAmount) { | ||
if (mappingTable.size()) { | ||
if (indexV >= mappingTable.size()) { | ||
// USER_PRINTF(" dev sPC V:%d >= %d", indexV, mappingTable.size()); | ||
} | ||
else { | ||
for (unsigned16 indexP:mappingTable[indexV]) { | ||
fixture->ledsP[indexP] = blend(color, fixture->ledsP[indexP], blendAmount==UINT8_MAX?fixture->globalBlend:blendAmount); | ||
} | ||
if (indexV < mappingTable.size()) { | ||
std::vector<unsigned16>* physMap = mappingTable[indexV]; | ||
if (physMap) | ||
for (unsigned16 indexP:*physMap) { | ||
fixture->ledsP[indexP] = blend(color, fixture->ledsP[indexP], blendAmount==UINT8_MAX?fixture->globalBlend:blendAmount); | ||
} | ||
} | ||
else if (indexV < NUM_LEDS_Max)//no projection | ||
|
@@ -41,19 +38,12 @@ void Leds::setPixelColor(unsigned16 indexV, CRGB color, unsigned8 blendAmount) { | |
} | ||
|
||
CRGB Leds::getPixelColor(unsigned16 indexV) { | ||
if (mappingTable.size()) { | ||
if (indexV >= mappingTable.size()) { | ||
// USER_PRINTF(" dev gPC V %d >= %d", indexV, mappingTable.size()); | ||
if (indexV < mappingTable.size()) { | ||
std::vector<unsigned16>* physMap = mappingTable[indexV]; | ||
if (physMap && physMap->size()) | ||
return fixture->ledsP[*physMap->begin()]; //any would do as they are all the same | ||
else | ||
return CRGB::Black; | ||
} | ||
else if (!mappingTable[indexV].size()) //if no physMap // Core 1 panic'ed (LoadProhibited). Exception was unhandled. - std::vector<unsigned short, std::allocator<unsigned short> >::size() | ||
// by blurrows CRGB cur = getPixelColor(XY(i,row));? XY(i,row) = 0 | ||
{ | ||
USER_PRINTF(" dev gPC P:%d >= %d", mappingTable[indexV][0], NUM_LEDS_Max); | ||
return CRGB::Black; | ||
} | ||
else | ||
return fixture->ledsP[mappingTable[indexV][0]]; //any would do as they are all the same | ||
} | ||
else if (indexV < NUM_LEDS_Max) //no mapping | ||
return fixture->ledsP[indexV]; | ||
|
@@ -67,7 +57,8 @@ void Leds::fadeToBlackBy(unsigned8 fadeBy) { | |
if (projectionNr == p_None || p_Random) { | ||
fastled_fadeToBlackBy(fixture->ledsP, fixture->nrOfLeds, fadeBy); | ||
} else { | ||
for (std::vector<std::vector<unsigned16>>::iterator physMap=mappingTable.begin(); physMap!=mappingTable.end(); ++physMap) { | ||
for (std::vector<unsigned16>* physMap:mappingTable) { | ||
if (physMap) | ||
for (unsigned16 indexP:*physMap) { | ||
CRGB oldValue = fixture->ledsP[indexP]; | ||
fixture->ledsP[indexP].nscale8(255-fadeBy); //this overrides the old value | ||
|
@@ -81,7 +72,8 @@ void Leds::fill_solid(const struct CRGB& color) { | |
if (projectionNr == p_None || p_Random) { | ||
fastled_fill_solid(fixture->ledsP, fixture->nrOfLeds, color); | ||
} else { | ||
for (std::vector<std::vector<unsigned16>>::iterator physMap=mappingTable.begin(); physMap!=mappingTable.end(); ++physMap) { | ||
for (std::vector<unsigned16>* physMap:mappingTable) { | ||
if (physMap) | ||
for (unsigned16 indexP:*physMap) { | ||
fixture->ledsP[indexP] = blend(color, fixture->ledsP[indexP], fixture->globalBlend); | ||
} | ||
|
@@ -98,7 +90,8 @@ void Leds::fill_rainbow(unsigned8 initialhue, unsigned8 deltahue) { | |
hsv.val = 255; | ||
hsv.sat = 240; | ||
|
||
for (std::vector<std::vector<unsigned16>> ::iterator physMap=mappingTable.begin(); physMap!=mappingTable.end(); ++physMap) { | ||
for (std::vector<unsigned16>* physMap:mappingTable) { | ||
if (physMap) | ||
for (unsigned16 indexP:*physMap) { | ||
fixture->ledsP[indexP] = blend(hsv, fixture->ledsP[indexP], fixture->globalBlend); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.