From ca2b976ed71ba6dd16475c3938b9f3c53cdc08cc Mon Sep 17 00:00:00 2001 From: Ton Huisman Date: Sat, 4 Jan 2025 20:00:19 +0100 Subject: [PATCH 1/9] [Bugfix] RTTTL feature was not enabled for ESP32 Collection builds --- platformio_esp32_envs.ini | 30 +++++++++++++++--------------- platformio_esp32c3_envs.ini | 14 +++++++------- platformio_esp32s2_envs.ini | 14 +++++++------- platformio_esp32s3_envs.ini | 14 +++++++------- platformio_esp82xx_envs.ini | 24 ++++++++++++------------ 5 files changed, 48 insertions(+), 48 deletions(-) diff --git a/platformio_esp32_envs.ini b/platformio_esp32_envs.ini index 9c1cf76937..8054e140a0 100644 --- a/platformio_esp32_envs.ini +++ b/platformio_esp32_envs.ini @@ -126,7 +126,7 @@ lib_ignore = ${esp32_always.lib_ignore} build_flags = ${esp32_common.build_flags} -DFEATURE_ARDUINO_OTA=1 -DPLUGIN_BUILD_NORMAL_IRext - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL extra_scripts = ${esp32_common.extra_scripts} pre:tools/pio/ir_build_check.py @@ -199,7 +199,7 @@ board = esp32_4M build_flags = ${esp32_common.build_flags} -DFEATURE_ARDUINO_OTA=1 -DPLUGIN_SET_COLLECTION_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_B_ESP32_4M316k] extends = esp32_common @@ -207,7 +207,7 @@ board = esp32_4M build_flags = ${esp32_common.build_flags} -DFEATURE_ARDUINO_OTA=1 -DPLUGIN_SET_COLLECTION_B_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_C_ESP32_4M316k] extends = esp32_common @@ -215,7 +215,7 @@ board = esp32_4M build_flags = ${esp32_common.build_flags} -DFEATURE_ARDUINO_OTA=1 -DPLUGIN_SET_COLLECTION_C_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_D_ESP32_4M316k] extends = esp32_common @@ -223,7 +223,7 @@ board = esp32_4M build_flags = ${esp32_common.build_flags} -DFEATURE_ARDUINO_OTA=1 -DPLUGIN_SET_COLLECTION_D_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_E_ESP32_4M316k] extends = esp32_common @@ -231,7 +231,7 @@ board = esp32_4M build_flags = ${esp32_common.build_flags} -DFEATURE_ARDUINO_OTA=1 -DPLUGIN_SET_COLLECTION_E_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_F_ESP32_4M316k] extends = esp32_common @@ -239,7 +239,7 @@ board = esp32_4M build_flags = ${esp32_common.build_flags} -DFEATURE_ARDUINO_OTA=1 -DPLUGIN_SET_COLLECTION_F_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_G_ESP32_4M316k] extends = esp32_common @@ -247,7 +247,7 @@ board = esp32_4M build_flags = ${esp32_common.build_flags} -DFEATURE_ARDUINO_OTA=1 -DPLUGIN_SET_COLLECTION_G_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_A_ESP32_IRExt_4M316k] @@ -382,43 +382,43 @@ build_flags = ${esp32_IRExt.build_flags} extends = env:collection_A_ESP32_4M316k build_flags = ${env:collection_A_ESP32_4M316k.build_flags} -DFEATURE_ETHERNET=1 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_B_ESP32_4M316k_ETH] extends = env:collection_B_ESP32_4M316k build_flags = ${env:collection_B_ESP32_4M316k.build_flags} -DFEATURE_ETHERNET=1 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_C_ESP32_4M316k_ETH] extends = env:collection_C_ESP32_4M316k build_flags = ${env:collection_C_ESP32_4M316k.build_flags} -DFEATURE_ETHERNET=1 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_D_ESP32_4M316k_ETH] extends = env:collection_D_ESP32_4M316k build_flags = ${env:collection_D_ESP32_4M316k.build_flags} -DFEATURE_ETHERNET=1 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_E_ESP32_4M316k_ETH] extends = env:collection_E_ESP32_4M316k build_flags = ${env:collection_E_ESP32_4M316k.build_flags} -DFEATURE_ETHERNET=1 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_F_ESP32_4M316k_ETH] extends = env:collection_F_ESP32_4M316k build_flags = ${env:collection_F_ESP32_4M316k.build_flags} -DFEATURE_ETHERNET=1 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_G_ESP32_4M316k_ETH] extends = env:collection_G_ESP32_4M316k build_flags = ${env:collection_G_ESP32_4M316k.build_flags} -DFEATURE_ETHERNET=1 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:energy_ESP32_4M316k_ETH] extends = env:energy_ESP32_4M316k diff --git a/platformio_esp32c3_envs.ini b/platformio_esp32c3_envs.ini index f4a36b912b..ab3b4e74ba 100644 --- a/platformio_esp32c3_envs.ini +++ b/platformio_esp32c3_envs.ini @@ -86,49 +86,49 @@ extends = esp32c3_common board = esp32c3cdc build_flags = ${esp32c3_common.build_flags} -DPLUGIN_SET_COLLECTION_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_B_ESP32c3_4M316k_CDC] extends = esp32c3_common board = esp32c3cdc build_flags = ${esp32c3_common.build_flags} -DPLUGIN_SET_COLLECTION_B_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_C_ESP32c3_4M316k_CDC] extends = esp32c3_common board = esp32c3cdc build_flags = ${esp32c3_common.build_flags} -DPLUGIN_SET_COLLECTION_C_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_D_ESP32c3_4M316k_CDC] extends = esp32c3_common board = esp32c3cdc build_flags = ${esp32c3_common.build_flags} -DPLUGIN_SET_COLLECTION_D_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_E_ESP32c3_4M316k_CDC] extends = esp32c3_common board = esp32c3cdc build_flags = ${esp32c3_common.build_flags} -DPLUGIN_SET_COLLECTION_E_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_F_ESP32c3_4M316k_CDC] extends = esp32c3_common board = esp32c3cdc build_flags = ${esp32c3_common.build_flags} -DPLUGIN_SET_COLLECTION_F_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_G_ESP32c3_4M316k_CDC] extends = esp32c3_common board = esp32c3cdc build_flags = ${esp32c3_common.build_flags} -DPLUGIN_SET_COLLECTION_G_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:energy_ESP32c3_4M316k_CDC] diff --git a/platformio_esp32s2_envs.ini b/platformio_esp32s2_envs.ini index 4419571ba0..b17699d84c 100644 --- a/platformio_esp32s2_envs.ini +++ b/platformio_esp32s2_envs.ini @@ -102,49 +102,49 @@ extends = esp32s2_common board = esp32s2cdc build_flags = ${esp32s2_common.build_flags} -DPLUGIN_SET_COLLECTION_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_B_ESP32s2_4M316k_CDC] extends = esp32s2_common board = esp32s2cdc build_flags = ${esp32s2_common.build_flags} -DPLUGIN_SET_COLLECTION_B_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_C_ESP32s2_4M316k_CDC] extends = esp32s2_common board = esp32s2cdc build_flags = ${esp32s2_common.build_flags} -DPLUGIN_SET_COLLECTION_C_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_D_ESP32s2_4M316k_CDC] extends = esp32s2_common board = esp32s2cdc build_flags = ${esp32s2_common.build_flags} -DPLUGIN_SET_COLLECTION_D_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_E_ESP32s2_4M316k_CDC] extends = esp32s2_common board = esp32s2cdc build_flags = ${esp32s2_common.build_flags} -DPLUGIN_SET_COLLECTION_E_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_F_ESP32s2_4M316k_CDC] extends = esp32s2_common board = esp32s2cdc build_flags = ${esp32s2_common.build_flags} -DPLUGIN_SET_COLLECTION_F_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_G_ESP32s2_4M316k_CDC] extends = esp32s2_common board = esp32s2cdc build_flags = ${esp32s2_common.build_flags} -DPLUGIN_SET_COLLECTION_G_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:energy_ESP32s2_4M316k_CDC] diff --git a/platformio_esp32s3_envs.ini b/platformio_esp32s3_envs.ini index 59ce3af294..b58652d575 100644 --- a/platformio_esp32s3_envs.ini +++ b/platformio_esp32s3_envs.ini @@ -66,49 +66,49 @@ extends = esp32s3_common board = esp32s3cdc-qio_qspi build_flags = ${esp32s3_common.build_flags} -DPLUGIN_SET_COLLECTION_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_B_ESP32s3_4M316k_CDC] extends = esp32s3_common board = esp32s3cdc-qio_qspi build_flags = ${esp32s3_common.build_flags} -DPLUGIN_SET_COLLECTION_B_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_C_ESP32s3_4M316k_CDC] extends = esp32s3_common board = esp32s3cdc-qio_qspi build_flags = ${esp32s3_common.build_flags} -DPLUGIN_SET_COLLECTION_C_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_D_ESP32s3_4M316k_CDC] extends = esp32s3_common board = esp32s3cdc-qio_qspi build_flags = ${esp32s3_common.build_flags} -DPLUGIN_SET_COLLECTION_D_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_E_ESP32s3_4M316k_CDC] extends = esp32s3_common board = esp32s3cdc-qio_qspi build_flags = ${esp32s3_common.build_flags} -DPLUGIN_SET_COLLECTION_E_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_F_ESP32s3_4M316k_CDC] extends = esp32s3_common board = esp32s3cdc-qio_qspi build_flags = ${esp32s3_common.build_flags} -DPLUGIN_SET_COLLECTION_F_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_G_ESP32s3_4M316k_CDC] extends = esp32s3_common board = esp32s3cdc-qio_qspi build_flags = ${esp32s3_common.build_flags} -DPLUGIN_SET_COLLECTION_G_ESP32 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:energy_ESP32s3_4M316k_CDC] diff --git a/platformio_esp82xx_envs.ini b/platformio_esp82xx_envs.ini index 3b1f1cb064..d13f8c3e02 100644 --- a/platformio_esp82xx_envs.ini +++ b/platformio_esp82xx_envs.ini @@ -471,7 +471,7 @@ build_flags = ${collection.build_flags} [env:collection_A_ESP8266_4M1M] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_B_ESP8266_4M1M] extends = collection_ESP8266_4M1M @@ -482,31 +482,31 @@ build_flags = ${collection_ESP8266_4M1M.build_flags} extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DPLUGIN_BUILD_COLLECTION_C - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_D_ESP8266_4M1M] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DPLUGIN_BUILD_COLLECTION_D - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_E_ESP8266_4M1M] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DPLUGIN_BUILD_COLLECTION_E - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_F_ESP8266_4M1M] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DPLUGIN_BUILD_COLLECTION_F - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_G_ESP8266_4M1M] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DPLUGIN_BUILD_COLLECTION_G - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL ; COLL: 4096k version + FEATURE_ADC_VCC ---------- @@ -514,7 +514,7 @@ build_flags = ${collection_ESP8266_4M1M.build_flags} extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DFEATURE_ADC_VCC=1 - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_B_ESP8266_4M1M_VCC] extends = collection_ESP8266_4M1M @@ -527,35 +527,35 @@ extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DFEATURE_ADC_VCC=1 -DPLUGIN_BUILD_COLLECTION_C - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_D_ESP8266_4M1M_VCC] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DFEATURE_ADC_VCC=1 -DPLUGIN_BUILD_COLLECTION_D - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_E_ESP8266_4M1M_VCC] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DFEATURE_ADC_VCC=1 -DPLUGIN_BUILD_COLLECTION_E - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_F_ESP8266_4M1M_VCC] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DFEATURE_ADC_VCC=1 -DPLUGIN_BUILD_COLLECTION_F - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL [env:collection_G_ESP8266_4M1M_VCC] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DFEATURE_ADC_VCC=1 -DPLUGIN_BUILD_COLLECTION_G - -DCOLLECTION_USE_RTTTL + -DCOLLECTION_FEATURE_RTTTL From ba13491f1c48a16ea863896339d333db859ed379 Mon Sep 17 00:00:00 2001 From: Ton Huisman Date: Thu, 9 Jan 2025 20:33:10 +0100 Subject: [PATCH 2/9] [RTTTL] Fix typo --- platformio_esp32_envs.ini | 30 +++++++++++++++--------------- platformio_esp32c3_envs.ini | 14 +++++++------- platformio_esp32s2_envs.ini | 14 +++++++------- platformio_esp32s3_envs.ini | 14 +++++++------- platformio_esp82xx_envs.ini | 24 ++++++++++++------------ 5 files changed, 48 insertions(+), 48 deletions(-) diff --git a/platformio_esp32_envs.ini b/platformio_esp32_envs.ini index 8054e140a0..cbef6d6722 100644 --- a/platformio_esp32_envs.ini +++ b/platformio_esp32_envs.ini @@ -126,7 +126,7 @@ lib_ignore = ${esp32_always.lib_ignore} build_flags = ${esp32_common.build_flags} -DFEATURE_ARDUINO_OTA=1 -DPLUGIN_BUILD_NORMAL_IRext - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 extra_scripts = ${esp32_common.extra_scripts} pre:tools/pio/ir_build_check.py @@ -199,7 +199,7 @@ board = esp32_4M build_flags = ${esp32_common.build_flags} -DFEATURE_ARDUINO_OTA=1 -DPLUGIN_SET_COLLECTION_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_B_ESP32_4M316k] extends = esp32_common @@ -207,7 +207,7 @@ board = esp32_4M build_flags = ${esp32_common.build_flags} -DFEATURE_ARDUINO_OTA=1 -DPLUGIN_SET_COLLECTION_B_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_C_ESP32_4M316k] extends = esp32_common @@ -215,7 +215,7 @@ board = esp32_4M build_flags = ${esp32_common.build_flags} -DFEATURE_ARDUINO_OTA=1 -DPLUGIN_SET_COLLECTION_C_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_D_ESP32_4M316k] extends = esp32_common @@ -223,7 +223,7 @@ board = esp32_4M build_flags = ${esp32_common.build_flags} -DFEATURE_ARDUINO_OTA=1 -DPLUGIN_SET_COLLECTION_D_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_E_ESP32_4M316k] extends = esp32_common @@ -231,7 +231,7 @@ board = esp32_4M build_flags = ${esp32_common.build_flags} -DFEATURE_ARDUINO_OTA=1 -DPLUGIN_SET_COLLECTION_E_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_F_ESP32_4M316k] extends = esp32_common @@ -239,7 +239,7 @@ board = esp32_4M build_flags = ${esp32_common.build_flags} -DFEATURE_ARDUINO_OTA=1 -DPLUGIN_SET_COLLECTION_F_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_G_ESP32_4M316k] extends = esp32_common @@ -247,7 +247,7 @@ board = esp32_4M build_flags = ${esp32_common.build_flags} -DFEATURE_ARDUINO_OTA=1 -DPLUGIN_SET_COLLECTION_G_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_A_ESP32_IRExt_4M316k] @@ -382,43 +382,43 @@ build_flags = ${esp32_IRExt.build_flags} extends = env:collection_A_ESP32_4M316k build_flags = ${env:collection_A_ESP32_4M316k.build_flags} -DFEATURE_ETHERNET=1 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_B_ESP32_4M316k_ETH] extends = env:collection_B_ESP32_4M316k build_flags = ${env:collection_B_ESP32_4M316k.build_flags} -DFEATURE_ETHERNET=1 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_C_ESP32_4M316k_ETH] extends = env:collection_C_ESP32_4M316k build_flags = ${env:collection_C_ESP32_4M316k.build_flags} -DFEATURE_ETHERNET=1 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_D_ESP32_4M316k_ETH] extends = env:collection_D_ESP32_4M316k build_flags = ${env:collection_D_ESP32_4M316k.build_flags} -DFEATURE_ETHERNET=1 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_E_ESP32_4M316k_ETH] extends = env:collection_E_ESP32_4M316k build_flags = ${env:collection_E_ESP32_4M316k.build_flags} -DFEATURE_ETHERNET=1 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_F_ESP32_4M316k_ETH] extends = env:collection_F_ESP32_4M316k build_flags = ${env:collection_F_ESP32_4M316k.build_flags} -DFEATURE_ETHERNET=1 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_G_ESP32_4M316k_ETH] extends = env:collection_G_ESP32_4M316k build_flags = ${env:collection_G_ESP32_4M316k.build_flags} -DFEATURE_ETHERNET=1 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:energy_ESP32_4M316k_ETH] extends = env:energy_ESP32_4M316k diff --git a/platformio_esp32c3_envs.ini b/platformio_esp32c3_envs.ini index ab3b4e74ba..0ec6f357bb 100644 --- a/platformio_esp32c3_envs.ini +++ b/platformio_esp32c3_envs.ini @@ -86,49 +86,49 @@ extends = esp32c3_common board = esp32c3cdc build_flags = ${esp32c3_common.build_flags} -DPLUGIN_SET_COLLECTION_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_B_ESP32c3_4M316k_CDC] extends = esp32c3_common board = esp32c3cdc build_flags = ${esp32c3_common.build_flags} -DPLUGIN_SET_COLLECTION_B_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_C_ESP32c3_4M316k_CDC] extends = esp32c3_common board = esp32c3cdc build_flags = ${esp32c3_common.build_flags} -DPLUGIN_SET_COLLECTION_C_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_D_ESP32c3_4M316k_CDC] extends = esp32c3_common board = esp32c3cdc build_flags = ${esp32c3_common.build_flags} -DPLUGIN_SET_COLLECTION_D_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_E_ESP32c3_4M316k_CDC] extends = esp32c3_common board = esp32c3cdc build_flags = ${esp32c3_common.build_flags} -DPLUGIN_SET_COLLECTION_E_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_F_ESP32c3_4M316k_CDC] extends = esp32c3_common board = esp32c3cdc build_flags = ${esp32c3_common.build_flags} -DPLUGIN_SET_COLLECTION_F_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_G_ESP32c3_4M316k_CDC] extends = esp32c3_common board = esp32c3cdc build_flags = ${esp32c3_common.build_flags} -DPLUGIN_SET_COLLECTION_G_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:energy_ESP32c3_4M316k_CDC] diff --git a/platformio_esp32s2_envs.ini b/platformio_esp32s2_envs.ini index b17699d84c..7a44d64f94 100644 --- a/platformio_esp32s2_envs.ini +++ b/platformio_esp32s2_envs.ini @@ -102,49 +102,49 @@ extends = esp32s2_common board = esp32s2cdc build_flags = ${esp32s2_common.build_flags} -DPLUGIN_SET_COLLECTION_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_B_ESP32s2_4M316k_CDC] extends = esp32s2_common board = esp32s2cdc build_flags = ${esp32s2_common.build_flags} -DPLUGIN_SET_COLLECTION_B_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_C_ESP32s2_4M316k_CDC] extends = esp32s2_common board = esp32s2cdc build_flags = ${esp32s2_common.build_flags} -DPLUGIN_SET_COLLECTION_C_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_D_ESP32s2_4M316k_CDC] extends = esp32s2_common board = esp32s2cdc build_flags = ${esp32s2_common.build_flags} -DPLUGIN_SET_COLLECTION_D_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_E_ESP32s2_4M316k_CDC] extends = esp32s2_common board = esp32s2cdc build_flags = ${esp32s2_common.build_flags} -DPLUGIN_SET_COLLECTION_E_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_F_ESP32s2_4M316k_CDC] extends = esp32s2_common board = esp32s2cdc build_flags = ${esp32s2_common.build_flags} -DPLUGIN_SET_COLLECTION_F_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_G_ESP32s2_4M316k_CDC] extends = esp32s2_common board = esp32s2cdc build_flags = ${esp32s2_common.build_flags} -DPLUGIN_SET_COLLECTION_G_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:energy_ESP32s2_4M316k_CDC] diff --git a/platformio_esp32s3_envs.ini b/platformio_esp32s3_envs.ini index b58652d575..6db1c3701f 100644 --- a/platformio_esp32s3_envs.ini +++ b/platformio_esp32s3_envs.ini @@ -66,49 +66,49 @@ extends = esp32s3_common board = esp32s3cdc-qio_qspi build_flags = ${esp32s3_common.build_flags} -DPLUGIN_SET_COLLECTION_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_B_ESP32s3_4M316k_CDC] extends = esp32s3_common board = esp32s3cdc-qio_qspi build_flags = ${esp32s3_common.build_flags} -DPLUGIN_SET_COLLECTION_B_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_C_ESP32s3_4M316k_CDC] extends = esp32s3_common board = esp32s3cdc-qio_qspi build_flags = ${esp32s3_common.build_flags} -DPLUGIN_SET_COLLECTION_C_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_D_ESP32s3_4M316k_CDC] extends = esp32s3_common board = esp32s3cdc-qio_qspi build_flags = ${esp32s3_common.build_flags} -DPLUGIN_SET_COLLECTION_D_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_E_ESP32s3_4M316k_CDC] extends = esp32s3_common board = esp32s3cdc-qio_qspi build_flags = ${esp32s3_common.build_flags} -DPLUGIN_SET_COLLECTION_E_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_F_ESP32s3_4M316k_CDC] extends = esp32s3_common board = esp32s3cdc-qio_qspi build_flags = ${esp32s3_common.build_flags} -DPLUGIN_SET_COLLECTION_F_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_G_ESP32s3_4M316k_CDC] extends = esp32s3_common board = esp32s3cdc-qio_qspi build_flags = ${esp32s3_common.build_flags} -DPLUGIN_SET_COLLECTION_G_ESP32 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:energy_ESP32s3_4M316k_CDC] diff --git a/platformio_esp82xx_envs.ini b/platformio_esp82xx_envs.ini index d13f8c3e02..e33f767136 100644 --- a/platformio_esp82xx_envs.ini +++ b/platformio_esp82xx_envs.ini @@ -471,7 +471,7 @@ build_flags = ${collection.build_flags} [env:collection_A_ESP8266_4M1M] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_B_ESP8266_4M1M] extends = collection_ESP8266_4M1M @@ -482,31 +482,31 @@ build_flags = ${collection_ESP8266_4M1M.build_flags} extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DPLUGIN_BUILD_COLLECTION_C - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_D_ESP8266_4M1M] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DPLUGIN_BUILD_COLLECTION_D - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_E_ESP8266_4M1M] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DPLUGIN_BUILD_COLLECTION_E - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_F_ESP8266_4M1M] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DPLUGIN_BUILD_COLLECTION_F - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_G_ESP8266_4M1M] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DPLUGIN_BUILD_COLLECTION_G - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 ; COLL: 4096k version + FEATURE_ADC_VCC ---------- @@ -514,7 +514,7 @@ build_flags = ${collection_ESP8266_4M1M.build_flags} extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DFEATURE_ADC_VCC=1 - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_B_ESP8266_4M1M_VCC] extends = collection_ESP8266_4M1M @@ -527,35 +527,35 @@ extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DFEATURE_ADC_VCC=1 -DPLUGIN_BUILD_COLLECTION_C - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_D_ESP8266_4M1M_VCC] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DFEATURE_ADC_VCC=1 -DPLUGIN_BUILD_COLLECTION_D - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_E_ESP8266_4M1M_VCC] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DFEATURE_ADC_VCC=1 -DPLUGIN_BUILD_COLLECTION_E - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_F_ESP8266_4M1M_VCC] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DFEATURE_ADC_VCC=1 -DPLUGIN_BUILD_COLLECTION_F - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 [env:collection_G_ESP8266_4M1M_VCC] extends = collection_ESP8266_4M1M build_flags = ${collection_ESP8266_4M1M.build_flags} -DFEATURE_ADC_VCC=1 -DPLUGIN_BUILD_COLLECTION_G - -DCOLLECTION_FEATURE_RTTTL + -DCOLLECTION_FEATURE_RTTTL=1 From e0f2168113c14ff32db4e65d43ed9e346b144794 Mon Sep 17 00:00:00 2001 From: Ton Huisman Date: Thu, 9 Jan 2025 20:34:06 +0100 Subject: [PATCH 3/9] [Build] Enable RTTTL feature for Solo1, C2 and C6 builds --- platformio_esp32_solo1.ini | 1 + platformio_esp32c2_envs.ini | 1 + platformio_esp32c6_envs.ini | 1 + 3 files changed, 3 insertions(+) diff --git a/platformio_esp32_solo1.ini b/platformio_esp32_solo1.ini index 388bcb6eab..976212bcb3 100644 --- a/platformio_esp32_solo1.ini +++ b/platformio_esp32_solo1.ini @@ -8,6 +8,7 @@ build_flags = ${esp32_base_idf5.build_flags} -DFEATURE_ARDUINO_OTA=1 -DUSE_LITTLEFS -DCORE32SOLO1 + -DCOLLECTION_FEATURE_RTTTL=1 extra_scripts = ${esp32_base_idf5.extra_scripts} build_unflags = ${esp32_base_idf5.build_unflags} -fexceptions diff --git a/platformio_esp32c2_envs.ini b/platformio_esp32c2_envs.ini index 7f8919bf5e..1355cfe8e0 100644 --- a/platformio_esp32c2_envs.ini +++ b/platformio_esp32c2_envs.ini @@ -6,6 +6,7 @@ build_flags = ${esp32_base_idf5.build_flags} -DFEATURE_ARDUINO_OTA=1 -DUSE_LITTLEFS -DESP32C2 + -DCOLLECTION_FEATURE_RTTTL=1 extra_scripts = ${esp32_base_idf5.extra_scripts} build_unflags = ${esp32_base_idf5.build_unflags} -fexceptions diff --git a/platformio_esp32c6_envs.ini b/platformio_esp32c6_envs.ini index af5e25d2c4..7cc57e9d65 100644 --- a/platformio_esp32c6_envs.ini +++ b/platformio_esp32c6_envs.ini @@ -6,6 +6,7 @@ build_flags = ${esp32_base_idf5.build_flags} -DFEATURE_ARDUINO_OTA=1 -DUSE_LITTLEFS -DESP32C6 + -DCOLLECTION_FEATURE_RTTTL=1 extra_scripts = ${esp32_base_idf5.extra_scripts} build_unflags = ${esp32_base_idf5.build_unflags} -fexceptions From a76f34cc65c0d8f3c752f33ae0786a68b0a65d1a Mon Sep 17 00:00:00 2001 From: Ton Huisman Date: Thu, 9 Jan 2025 20:48:52 +0100 Subject: [PATCH 4/9] [Build] Revert unneeded COLLECTION_RTTTL feature for Solo1, C2 and C6 builds --- platformio_esp32_solo1.ini | 1 - platformio_esp32c2_envs.ini | 1 - platformio_esp32c6_envs.ini | 1 - 3 files changed, 3 deletions(-) diff --git a/platformio_esp32_solo1.ini b/platformio_esp32_solo1.ini index 976212bcb3..388bcb6eab 100644 --- a/platformio_esp32_solo1.ini +++ b/platformio_esp32_solo1.ini @@ -8,7 +8,6 @@ build_flags = ${esp32_base_idf5.build_flags} -DFEATURE_ARDUINO_OTA=1 -DUSE_LITTLEFS -DCORE32SOLO1 - -DCOLLECTION_FEATURE_RTTTL=1 extra_scripts = ${esp32_base_idf5.extra_scripts} build_unflags = ${esp32_base_idf5.build_unflags} -fexceptions diff --git a/platformio_esp32c2_envs.ini b/platformio_esp32c2_envs.ini index 1355cfe8e0..7f8919bf5e 100644 --- a/platformio_esp32c2_envs.ini +++ b/platformio_esp32c2_envs.ini @@ -6,7 +6,6 @@ build_flags = ${esp32_base_idf5.build_flags} -DFEATURE_ARDUINO_OTA=1 -DUSE_LITTLEFS -DESP32C2 - -DCOLLECTION_FEATURE_RTTTL=1 extra_scripts = ${esp32_base_idf5.extra_scripts} build_unflags = ${esp32_base_idf5.build_unflags} -fexceptions diff --git a/platformio_esp32c6_envs.ini b/platformio_esp32c6_envs.ini index 7cc57e9d65..af5e25d2c4 100644 --- a/platformio_esp32c6_envs.ini +++ b/platformio_esp32c6_envs.ini @@ -6,7 +6,6 @@ build_flags = ${esp32_base_idf5.build_flags} -DFEATURE_ARDUINO_OTA=1 -DUSE_LITTLEFS -DESP32C6 - -DCOLLECTION_FEATURE_RTTTL=1 extra_scripts = ${esp32_base_idf5.extra_scripts} build_unflags = ${esp32_base_idf5.build_unflags} -fexceptions From 8200dab8eaca283c0b105b3e78386ca3f96757f7 Mon Sep 17 00:00:00 2001 From: Ton Huisman Date: Sat, 11 Jan 2025 12:16:37 +0100 Subject: [PATCH 5/9] [LIB] AnyRtttl cherry-picked latest updates, disable unused function that causes a compiler warning --- lib/AnyRtttl/CHANGES | 2 ++ .../examples/ESP32Rtttl/ESP32Rtttl.ino | 7 ++++-- lib/AnyRtttl/src/anyrtttl.h | 4 ++-- lib/AnyRtttl/src/binrtttl.cpp | 22 +++++++++---------- lib/AnyRtttl/src/binrtttl.h | 4 ++-- 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/lib/AnyRtttl/CHANGES b/lib/AnyRtttl/CHANGES index 491a02e4d1..2b93602049 100644 --- a/lib/AnyRtttl/CHANGES +++ b/lib/AnyRtttl/CHANGES @@ -1,6 +1,8 @@ Changes for 2.3 +* New feature: Official support for ESP8266 and ESP32. * Fixed issue #2 - Support for PROGMEM / FLASH melodies in non-blocking mode. +* Fixed issue #6 - Error compiling for board ESP32 Wrover Kit (all versions). Changes for 2.2.1: diff --git a/lib/AnyRtttl/examples/ESP32Rtttl/ESP32Rtttl.ino b/lib/AnyRtttl/examples/ESP32Rtttl/ESP32Rtttl.ino index e5039c79fb..b05f803d1f 100644 --- a/lib/AnyRtttl/examples/ESP32Rtttl/ESP32Rtttl.ino +++ b/lib/AnyRtttl/examples/ESP32Rtttl/ESP32Rtttl.ino @@ -9,6 +9,7 @@ const char arkanoid[] PROGMEM = "Arkanoid:d=4,o=5,b=140:8g6,16p,16g.6,2a#6,32p,8 const char mario[] PROGMEM = "mario:d=4,o=5,b=140:16e6,16e6,32p,8e6,16c6,8e6,8g6,8p,8g,8p,8c6,16p,8g,16p,8e,16p,8a,8b,16a#,8a,16g.,16e6,16g6,8a6,16f6,8g6,8e6,16c6,16d6,8b,16p,8c6,16p,8g,16p,8e,16p,8a,8b,16a#,8a,16g.,16e6,16g6,8a6,16f6,8g6,8e6,16c6,16d6,8b,8p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16g#,16a,16c6,16p,16a,16c6,16d6,8p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16c7,16p,16c7,16c7,p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16g#,16a,16c6,16p,16a,16c6,16d6,8p,16d#6,8p,16d6,8p,16c6"; // James Bond theme defined in inline code below (also stored in flash memory) +#ifdef ESP32 // tone() and noTone() are not implemented for Arduino core for the ESP32 // See https://github.com/espressif/arduino-esp32/issues/980 // and https://github.com/espressif/arduino-esp32/issues/1720 @@ -24,17 +25,19 @@ void esp32Tone(uint8_t pin, unsigned int frq, unsigned long duration) { } void esp32ToneSetup(uint8_t pin) { - ledcSetup(0, 1000, 10); // resolution always seems to be 10bit, no matter what is given - ledcAttachPin(pin, 0); + ledcAttach(pin, 1000, 10); // resolution always seems to be 10bit, no matter what is given } +#endif void setup() { pinMode(BUZZER_PIN, OUTPUT); +#ifdef ESP32 // setup AnyRtttl for ESP32 esp32ToneSetup(BUZZER_PIN); anyrtttl::setToneFunction(&esp32Tone); anyrtttl::setNoToneFunction(&esp32NoTone); +#endif Serial.begin(115200); diff --git a/lib/AnyRtttl/src/anyrtttl.h b/lib/AnyRtttl/src/anyrtttl.h index a27c84eb59..ba1aaae4af 100644 --- a/lib/AnyRtttl/src/anyrtttl.h +++ b/lib/AnyRtttl/src/anyrtttl.h @@ -28,13 +28,13 @@ namespace anyrtttl * Description: * Defines a function pointer to a tone() function ****************************************************************************/ -typedef void (*ToneFuncPtr)(uint8_t _pin, unsigned int, unsigned long); +typedef void (*ToneFuncPtr)(uint8_t pin, unsigned int frequency, unsigned long duration); /**************************************************************************** * Description: * Defines a function pointer to a noTone() function ****************************************************************************/ -typedef void (*NoToneFuncPtr)(uint8_t); +typedef void (*NoToneFuncPtr)(uint8_t pin); /**************************************************************************** * Description: diff --git a/lib/AnyRtttl/src/binrtttl.cpp b/lib/AnyRtttl/src/binrtttl.cpp index 0f7206f073..ef5cae95bd 100644 --- a/lib/AnyRtttl/src/binrtttl.cpp +++ b/lib/AnyRtttl/src/binrtttl.cpp @@ -121,16 +121,16 @@ uint16_t getBpmsCount() return gNoteBpmsCount; } -BPM_INDEX findBpmIndex(RTTTL_BPM n) -{ - for(BPM_INDEX i=0; i Date: Sat, 11 Jan 2025 12:17:24 +0100 Subject: [PATCH 6/9] [PWM] Use defined constant instead of bare value --- src/src/Helpers/Hardware_PWM.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/src/Helpers/Hardware_PWM.cpp b/src/src/Helpers/Hardware_PWM.cpp index e0ebcc5229..f172e9c64d 100644 --- a/src/src/Helpers/Hardware_PWM.cpp +++ b/src/src/Helpers/Hardware_PWM.cpp @@ -157,7 +157,7 @@ void detachLedChannel(int pin) int8_t attachLedChannel(int pin, uint32_t frequency, uint8_t resolution) { if (frequency == 0) { - frequency = 1000; + frequency = ESPEASY_PWM_DEFAULT_FREQUENCY; } ledcDetach(pin); // See: https://github.com/espressif/arduino-esp32/issues/9212 return ledcAttach(pin, frequency, resolution) ? 0 : -1; From cf5393cdcd403dd3d4ab2ce410e62ec9622a6754 Mon Sep 17 00:00:00 2001 From: Ton Huisman Date: Sat, 11 Jan 2025 12:18:37 +0100 Subject: [PATCH 7/9] [RTTTL] Adjust to work with ESP32 IDF 5.x --- src/src/Helpers/Audio.cpp | 46 +++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/src/src/Helpers/Audio.cpp b/src/src/Helpers/Audio.cpp index 2501f68bd4..f781fdcde4 100644 --- a/src/src/Helpers/Audio.cpp +++ b/src/src/Helpers/Audio.cpp @@ -63,6 +63,23 @@ void set_rtttl_melody(String& melody) { # endif // if FEATURE_ANYRTTTL_ASYNC +# ifdef ESP32 + +void esp32NoTone(uint8_t pin) { + ledcWrite(pin, 0); +} + +void esp32Tone(uint8_t pin, unsigned int frq, unsigned long duration) { + ledcWriteTone(pin, frq); // pin, freq + ledcWrite(pin, 255); // pin, volume +} + +void esp32ToneSetup(uint8_t pin) { + attachLedChannel(pin); // Use defaults +} + +static uint8_t rtttlPin = 255; +# endif // ifdef ESP32 bool play_rtttl(int8_t _pin, const char *p) { if (!validGpio(_pin)) { return false; } @@ -73,7 +90,17 @@ bool play_rtttl(int8_t _pin, const char *p) { checkRAM(F("play_rtttl")); # endif // ifndef BUILD_NO_RAM_TRACKER + # ifdef ESP32 + + esp32ToneSetup(_pin); + rtttlPin = _pin; + + anyrtttl::setToneFunction(&esp32Tone); + anyrtttl::setNoToneFunction(&esp32NoTone); + # endif // ifdef ESP32 + # ifdef ESP8266 anyrtttl::setNoToneFunction(&setInternalGPIOPullupMode); + # endif // ifdef ESP8266 # if FEATURE_ANYRTTTL_ASYNC if (!rtttlMelody.isEmpty()) { @@ -91,6 +118,11 @@ bool play_rtttl(int8_t _pin, const char *p) { # endif // if FEATURE_RTTTL_EVENTS # else // if FEATURE_ANYRTTTL_ASYNC anyrtttl::blocking::play(_pin, p); + # if ESP32 + esp32NoTone(_pin); + detachLedChannel(_pin); + setInternalGPIOPullupMode(_pin); + # endif // if ESP32 # endif // if FEATURE_ANYRTTTL_ASYNC # ifndef BUILD_NO_RAM_TRACKER checkRAM(F("play_rtttl2")); @@ -101,9 +133,15 @@ bool play_rtttl(int8_t _pin, const char *p) { # if FEATURE_ANYRTTTL_ASYNC void update_rtttl() { START_TIMER + if (anyrtttl::nonblocking::isPlaying()) { anyrtttl::nonblocking::play(); } else { + # if ESP32 + esp32NoTone(rtttlPin); + detachLedChannel(rtttlPin); + setInternalGPIOPullupMode(rtttlPin); + # endif // if ESP32 # if FEATURE_RTTTL_EVENTS if (rtttlPlaying) { @@ -133,10 +171,10 @@ bool play_rtttl(int8_t _pin, const char *p) // FIXME: Absolutely no error checking in here const int notes[] = { 0, - 262, 277, 294, 311, 330, 349, 370, 392, 415, 440, 466, 494, - 523, 554, 587, 622, 659, 698, 740, 784, 831, 880, 932, 988, - 1047,1109, 1175, 1245, 1319, 1397, 1480, 1568, 1661, 1760, 1865, 1976, - 2093,2217, 2349, 2489, 2637, 2794, 2960, 3136, 3322, 3520, 3729, 3951 + 262, 277, 294, 311, 330, 349, 370, 392, 415, 440, 466, 494, + 523, 554, 587, 622, 659, 698, 740, 784, 831, 880, 932, 988, + 1047,1109, 1175, 1245, 1319, 1397, 1480, 1568, 1661, 1760, 1865, 1976, + 2093,2217, 2349, 2489, 2637, 2794, 2960, 3136, 3322, 3520, 3729, 3951 }; From 9eabd927db8d642c715065ea1daab4eab618ca8f Mon Sep 17 00:00:00 2001 From: Ton Huisman Date: Sat, 11 Jan 2025 21:26:31 +0100 Subject: [PATCH 8/9] [RTTTL] Fix a typo, explicitly connect GPIO to Tone channel --- src/src/Helpers/Audio.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/src/Helpers/Audio.cpp b/src/src/Helpers/Audio.cpp index f781fdcde4..186bb2b74e 100644 --- a/src/src/Helpers/Audio.cpp +++ b/src/src/Helpers/Audio.cpp @@ -75,7 +75,9 @@ void esp32Tone(uint8_t pin, unsigned int frq, unsigned long duration) { } void esp32ToneSetup(uint8_t pin) { - attachLedChannel(pin); // Use defaults + const uint8_t channel = attachLedChannel(pin); // Use defaults + + setToneChannel(channel); // Claim channel for Tone use } static uint8_t rtttlPin = 255; @@ -118,11 +120,11 @@ bool play_rtttl(int8_t _pin, const char *p) { # endif // if FEATURE_RTTTL_EVENTS # else // if FEATURE_ANYRTTTL_ASYNC anyrtttl::blocking::play(_pin, p); - # if ESP32 + # ifdef ESP32 esp32NoTone(_pin); detachLedChannel(_pin); setInternalGPIOPullupMode(_pin); - # endif // if ESP32 + # endif // ifdef ESP32 # endif // if FEATURE_ANYRTTTL_ASYNC # ifndef BUILD_NO_RAM_TRACKER checkRAM(F("play_rtttl2")); @@ -137,11 +139,11 @@ void update_rtttl() { if (anyrtttl::nonblocking::isPlaying()) { anyrtttl::nonblocking::play(); } else { - # if ESP32 + # ifdef ESP32 esp32NoTone(rtttlPin); detachLedChannel(rtttlPin); setInternalGPIOPullupMode(rtttlPin); - # endif // if ESP32 + # endif // ifdef ESP32 # if FEATURE_RTTTL_EVENTS if (rtttlPlaying) { From 96ecdbea046f2316361edd92531194fdead9208f Mon Sep 17 00:00:00 2001 From: Ton Huisman Date: Wed, 15 Jan 2025 23:02:09 +0100 Subject: [PATCH 9/9] [RTTTL] Fix playing the sound properly by not messing up the frequency setting --- src/src/Helpers/Audio.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/src/Helpers/Audio.cpp b/src/src/Helpers/Audio.cpp index 186bb2b74e..e7e8d115f7 100644 --- a/src/src/Helpers/Audio.cpp +++ b/src/src/Helpers/Audio.cpp @@ -71,7 +71,6 @@ void esp32NoTone(uint8_t pin) { void esp32Tone(uint8_t pin, unsigned int frq, unsigned long duration) { ledcWriteTone(pin, frq); // pin, freq - ledcWrite(pin, 255); // pin, volume } void esp32ToneSetup(uint8_t pin) {