Skip to content

bug in usePin() #4

Description

@rob040

in function usePin the member variable dmxPin is set to argument var pin, before it is tested for unequality; the next if test will always be false:

void DmxMasterClass::usePin(uint8_t pin) {
  dmxPin = pin;
  if (dmxStarted && (pin != dmxPin)) {
    dmxEnd();
    dmxBegin();
  }
}

Solution is of course test-before-set:

void DmxMasterClass::usePin(uint8_t pin) {
  if (pin != dmxPin) {
    dmxPin = pin;
    if (dmxStarted) {
      dmxEnd();
      dmxBegin();
    }
  }
}


Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions