Skip to content

Commit e920c21

Browse files
committed
Fix bug where ESP32 without DAC wouldn't release LEDC channel
1 parent 0dcf40c commit e920c21

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/lib/DenkoCoreIO.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ void Denko::setMode(byte p, byte m) {
1919
// 111 = Digital Input/Output (ESP32 Only?)
2020
m = m & 0b00000111;
2121

22-
#if defined(ESP32) && defined(SOC_DAC_SUPPORTED)
23-
// Free the LEDC channel if leaving PWM mode.
22+
#if defined(ESP32)
23+
// Free the LEDC channel if leaving PWM mode.
2424
if (m != 0b010) releaseLEDC(p);
2525

2626
// Disable attached DAC if leaving DAC mode.
27-
if (m != 0b100) dacDisable(p);
27+
#if defined(SOC_DAC_SUPPORTED)
28+
if (m != 0b100) dacDisable(p);
29+
#endif
2830
#endif
2931

3032
// On the SAMD21 and RA4M1, mode needs to be INPUT when using the DAC.

0 commit comments

Comments
 (0)