From 805006468f716b890d938d04fb8cd5a795a7779b Mon Sep 17 00:00:00 2001
From: Meek Home Automation <44222882+Meek-HA@users.noreply.github.com>
Date: Sat, 18 Dec 2021 21:52:23 +0100
Subject: [PATCH] ESP32 Compile error when I2S_AUDIO is enabled

Solves the compiling error with env:tasmota32 when I2s Audio is enabled:
#ifndef USE_I2S_AUDIO
#define USE_I2S_AUDIO
#endif

#ifdef USE_I2S_EXTERNAL_DAC
#undef USE_I2S_EXTERNAL_DAC
#endif

#ifndef USE_I2S_NO_DAC
#define USE_I2S_NO_DAC
#endif

Resolving the following compiling error:
tasmota/xdrv_42_i2s_audio.ino:326:11: error: invalid conversion from 'AudioOutputI2S*' to 'AudioOutputI2SNoDAC*' [-fpermissive]
---
 tasmota/xdrv_42_i2s_audio.ino | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tasmota/xdrv_42_i2s_audio.ino b/tasmota/xdrv_42_i2s_audio.ino
index c7b0c460b..c87d763da 100644
--- a/tasmota/xdrv_42_i2s_audio.ino
+++ b/tasmota/xdrv_42_i2s_audio.ino
@@ -320,7 +320,11 @@ uint32_t SpeakerMic(uint8_t spkr) {
 
   i2s_driver_uninstall(Speak_I2S_NUMBER);
   if (spkr==MODE_SPK) {
-    out = new AudioOutputI2S();
+    #ifdef USE_I2S_NO_DAC
+      out = new AudioOutputI2SNoDAC();
+      #else
+      out = new AudioOutputI2S(0, 1);
+    #endif
     out->SetPinout(DAC_IIS_BCK, DAC_IIS_WS, DAC_IIS_DOUT);
     out->SetGain(((float)is2_volume/100.0)*4.0);
     out->stop();