Skip to content

Commit

Permalink
Merge branch 'brightness-referenced'
Browse files Browse the repository at this point in the history
  • Loading branch information
ewoudwijma committed Jun 20, 2024
2 parents 3c119c4 + e3b85de commit 7b1afb4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/App/LedModFixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class LedModFixture:public SysModule {
public:

uint8_t viewRotation = 0;
uint8_t bri = 10;

LedModFixture() :SysModule("Fixture") {};

Expand All @@ -34,13 +35,12 @@ class LedModFixture:public SysModule {
currentVar["dash"] = true;

//logarithmic slider (10)
currentVar = ui->initSlider(parentVar, "bri", 10, 0, 255, false, [](JsonObject var, unsigned8 rowNr, unsigned8 funType) { switch (funType) { //varFun
currentVar = ui->initSlider(parentVar, "bri", &bri, 0, 255, false, [this](JsonObject var, unsigned8 rowNr, unsigned8 funType) { switch (funType) { //varFun
case f_UIFun:
ui->setLabel(var, "Brightness");
return true;
case f_ChangeFun: {
stackUnsigned8 bri = var["value"];

//bri set by StarMod during changeFun
stackUnsigned8 result = mdl->getValue("on").as<bool>()?mdl->varLinearToLogarithm(var, bri):0;

FastLED.setBrightness(result);
Expand Down
10 changes: 4 additions & 6 deletions src/User/UserModArtNet.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ class UserModArtNet:public SysModule {

WiFiUDP ddpUdp;

int bri = mdl->getValue("bri");

for (size_t currentPacket = 0; currentPacket < packetCount; currentPacket++) {

if (sequenceNumber > 255) sequenceNumber = 0;
Expand Down Expand Up @@ -119,10 +117,10 @@ class UserModArtNet:public SysModule {

for (size_t i = 0; i < eff->fixture.nrOfLeds; i++) {
CRGB pixel = eff->fixture.ledsP[i];
ddpUdp.write(scale8(pixel.r, bri)); // R
ddpUdp.write(scale8(pixel.g, bri)); // G
ddpUdp.write(scale8(pixel.b, bri)); // B
// if (isRGBW) ddpUdp.write(scale8(buffer[bufferOffset++], bri)); // W
ddpUdp.write(scale8(pixel.r, fix->bri)); // R
ddpUdp.write(scale8(pixel.g, fix->bri)); // G
ddpUdp.write(scale8(pixel.b, fix->bri)); // B
// if (isRGBW) ddpUdp.write(scale8(buffer[bufferOffset++], fix->bri)); // W
}

if (!ddpUdp.endPacket()) {
Expand Down
10 changes: 4 additions & 6 deletions src/User/UserModDDP.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ class UserModDDP:public SysModule {

WiFiUDP ddpUdp;

int bri = mdl->getValue("bri");

for (size_t currentPacket = 0; currentPacket < packetCount; currentPacket++) {

if (sequenceNumber > 15) sequenceNumber = 0;
Expand Down Expand Up @@ -143,10 +141,10 @@ class UserModDDP:public SysModule {

for (size_t i = 0; i < eff->fixture.nrOfLeds; i++) {
CRGB pixel = eff->fixture.ledsP[i];
ddpUdp.write(scale8(pixel.r, bri)); // R
ddpUdp.write(scale8(pixel.g, bri)); // G
ddpUdp.write(scale8(pixel.b, bri)); // B
// if (isRGBW) ddpUdp.write(scale8(buffer[bufferOffset++], bri)); // W
ddpUdp.write(scale8(pixel.r, fix->bri)); // R
ddpUdp.write(scale8(pixel.g, fix->bri)); // G
ddpUdp.write(scale8(pixel.b, fix->bri)); // B
// if (isRGBW) ddpUdp.write(scale8(buffer[bufferOffset++], fix->bri)); // W
}

if (!ddpUdp.endPacket()) {
Expand Down

0 comments on commit 7b1afb4

Please sign in to comment.