Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

void set(uint8_t value, bool on) always sets the first dimmer, not the one it called on. #27

Open
FunFrog-BY opened this issue Jul 1, 2023 · 0 comments

Comments

@FunFrog-BY
Copy link

FunFrog-BY commented Jul 1, 2023

Dimmer dimmers[] = {
  Dimmer(3, DIMMER_RAMP, RAMP_TIME, POWER_HZ),
  Dimmer(4, DIMMER_RAMP, RAMP_TIME, POWER_HZ),
  Dimmer(5, DIMMER_RAMP, RAMP_TIME, POWER_HZ),
  Dimmer(6, DIMMER_RAMP, RAMP_TIME, POWER_HZ),
  Dimmer(7, DIMMER_RAMP, RAMP_TIME, POWER_HZ),
  Dimmer(8, DIMMER_RAMP, RAMP_TIME, POWER_HZ),
  Dimmer(9, DIMMER_RAMP, RAMP_TIME, POWER_HZ),
  Dimmer(10,DIMMER_RAMP, RAMP_TIME, POWER_HZ),
  Dimmer(11,DIMMER_RAMP, RAMP_TIME, POWER_HZ)
};

void handleDimming (byte dimmerNumber, byte value) {
  if (value == 0) dimmers[dimmerNumber].off(); //This works as intended
  else {
    //dimmers[dimmerNumber].set(value, true); <-- This one always applies to dimmers[0] regardless of dimmerNumber
    dimmers[dimmerNumber].on();  //This works as intended
    dimmers[dimmerNumber].set(value);  //This works as intended
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant