Skip to content

bug in usePin() #4

@rob040

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();
    }
  }
}


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions