fix(matter): examples must set pin to Digital Mode after analogWrite() and before digitalWrite() (#11070)
* fix(matter): itshall set digital mode before digitalWrite * fix(matter): example must set pin in digital mode before writting * fix(matter): example shall set digital mode before writing * fix(matter): digitalMode necessary before digitalWrite(LOW) * fix(matter): example must set digital mode after analogwrite * fix(matter): wrong copy paste * ci(pre-commit): Apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
This commit is contained in:
parent
e680e7b538
commit
d9dbc4af41
5 changed files with 20 additions and 0 deletions
|
|
@ -60,6 +60,10 @@ bool setLightState(bool state, espHsvColor_t colorHSV) {
|
||||||
analogWrite(ledPin, colorHSV.v);
|
analogWrite(ledPin, colorHSV.v);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#ifndef RGB_BUILTIN
|
||||||
|
// after analogWrite(), it is necessary to set the GPIO to digital mode first
|
||||||
|
pinMode(ledPin, OUTPUT);
|
||||||
|
#endif
|
||||||
digitalWrite(ledPin, LOW);
|
digitalWrite(ledPin, LOW);
|
||||||
}
|
}
|
||||||
// store last HSV Color and OnOff state for when the Light is restarted / power goes off
|
// store last HSV Color and OnOff state for when the Light is restarted / power goes off
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,10 @@ bool setLightState(bool state, uint8_t brightness) {
|
||||||
analogWrite(ledPin, brightness);
|
analogWrite(ledPin, brightness);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#ifndef RGB_BUILTIN
|
||||||
|
// after analogWrite(), it is necessary to set the GPIO to digital mode first
|
||||||
|
pinMode(ledPin, OUTPUT);
|
||||||
|
#endif
|
||||||
digitalWrite(ledPin, LOW);
|
digitalWrite(ledPin, LOW);
|
||||||
}
|
}
|
||||||
// store last Brightness and OnOff state for when the Light is restarted / power goes off
|
// store last Brightness and OnOff state for when the Light is restarted / power goes off
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,10 @@ bool setLightState(bool state, espHsvColor_t colorHSV, uint8_t brighteness, uint
|
||||||
analogWrite(ledPin, colorHSV.v);
|
analogWrite(ledPin, colorHSV.v);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#ifndef RGB_BUILTIN
|
||||||
|
// after analogWrite(), it is necessary to set the GPIO to digital mode first
|
||||||
|
pinMode(ledPin, OUTPUT);
|
||||||
|
#endif
|
||||||
digitalWrite(ledPin, LOW);
|
digitalWrite(ledPin, LOW);
|
||||||
}
|
}
|
||||||
// store last HSV Color and OnOff state for when the Light is restarted / power goes off
|
// store last HSV Color and OnOff state for when the Light is restarted / power goes off
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,10 @@ void fanDCMotorDrive(bool fanState, uint8_t speedPercent) {
|
||||||
// drive the Fan DC motor
|
// drive the Fan DC motor
|
||||||
if (fanState == false) {
|
if (fanState == false) {
|
||||||
// turn off the Fan
|
// turn off the Fan
|
||||||
|
#ifndef RGB_BUILTIN
|
||||||
|
// after analogWrite(), it is necessary to set the GPIO to digital mode first
|
||||||
|
pinMode(dcMotorPin, OUTPUT);
|
||||||
|
#endif
|
||||||
digitalWrite(dcMotorPin, LOW);
|
digitalWrite(dcMotorPin, LOW);
|
||||||
} else {
|
} else {
|
||||||
// set the Fan speed
|
// set the Fan speed
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,10 @@ bool setLightState(bool state, uint8_t brightness, uint16_t temperature_Mireds)
|
||||||
analogWrite(ledPin, brightness);
|
analogWrite(ledPin, brightness);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#ifndef RGB_BUILTIN
|
||||||
|
// after analogWrite(), it is necessary to set the GPIO to digital mode first
|
||||||
|
pinMode(ledPin, OUTPUT);
|
||||||
|
#endif
|
||||||
digitalWrite(ledPin, LOW);
|
digitalWrite(ledPin, LOW);
|
||||||
}
|
}
|
||||||
// store last Brightness and OnOff state for when the Light is restarted / power goes off
|
// store last Brightness and OnOff state for when the Light is restarted / power goes off
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue