Fix calls to speaker_play_click

This commit is contained in:
Edward Firmo
2024-12-26 00:27:48 +01:00
parent 81c6620fbf
commit f3b84e9d4e
2 changed files with 9 additions and 25 deletions

View File

@@ -45,7 +45,7 @@ api:
then: then:
- lambda: |- - lambda: |-
rtttl_speaker->stop(); rtttl_speaker->stop();
if (rtttl_speaker_gain->state > 0) { if (speaker_volume->state > 0) {
ESP_LOGI("api", "Play tone: '%s'", tone.c_str()); ESP_LOGI("api", "Play tone: '%s'", tone.c_str());
rtttl_speaker->play(tone.c_str()); rtttl_speaker->play(tone.c_str());
} }
@@ -56,7 +56,7 @@ esphome:
- -D TX_ULTIMATE_EASY_ADDON_SPEAKER - -D TX_ULTIMATE_EASY_ADDON_SPEAKER
number: number:
- id: rtttl_speaker_gain - id: speaker_volume
name: Sound - Volume name: Sound - Volume
platform: template platform: template
max_value: 100 max_value: 100
@@ -72,13 +72,9 @@ number:
optimistic: true optimistic: true
set_action: set_action:
then: then:
- lambda: |- - speaker.volume_set:
rtttl_speaker->set_gain((100-(x/10.0f))/100.0f); id: speaker_embedded
std::string tone_volume_change = "${tone_volume_change}"; volume: !lambda return x/100.0f;
// Play sound if tone_volume_change is not "none"
if (x > 0 and !tone_volume_change.empty() and tone_volume_change != "none")
rtttl_speaker->play(tone_volume_change);
rtttl_speaker->dump_config();
rtttl: rtttl:
- id: rtttl_speaker - id: rtttl_speaker
@@ -124,7 +120,7 @@ script:
then: then:
- lambda: |- - lambda: |-
if (sl_touch_speaker_feedback->state != "Disabled") if (sl_touch_speaker_feedback->state != "Disabled")
vibrate->execute(); speaker_play_click->execute();
- id: !extend touch_on_press - id: !extend touch_on_press
then: then:
@@ -135,7 +131,7 @@ script:
then: then:
- lambda: |- - lambda: |-
if (sl_touch_speaker_feedback->state == "On press" or sl_touch_speaker_feedback->state == "Always") if (sl_touch_speaker_feedback->state == "On press" or sl_touch_speaker_feedback->state == "Always")
vibrate->execute(); speaker_play_click->execute();
- id: !extend touch_on_release - id: !extend touch_on_release
then: then:
@@ -146,7 +142,7 @@ script:
then: then:
- lambda: |- - lambda: |-
if (sl_touch_speaker_feedback->state == "On release" or sl_touch_speaker_feedback->state == "Always") if (sl_touch_speaker_feedback->state == "On release" or sl_touch_speaker_feedback->state == "Always")
vibrate->execute(); speaker_play_click->execute();
select: select:
- id: sl_touch_speaker_feedback - id: sl_touch_speaker_feedback

View File

@@ -74,18 +74,6 @@ esp32:
flash_size: 8MB flash_size: 8MB
framework: framework:
type: esp-idf type: esp-idf
#sdkconfig_options:
#CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST: "y"
#CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY: "y"
#CONFIG_ESP32_REV_MIN_3: "y"
#CONFIG_ESPTOOLPY_FLASHSIZE_8MB: "y"
#CONFIG_MBEDTLS_DYNAMIC_BUFFER: "y"
#CONFIG_MBEDTLS_DYNAMIC_FREE_CA_CERT: "y"
#CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA: "y"
#CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC: "y"
#CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY: "y"
#CONFIG_SPIRAM_RODATA: "y"
#CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP: "y"
esphome: esphome:
name: ${name} name: ${name}
@@ -205,7 +193,7 @@ script:
ESP_LOGCONFIG("core", "TX Ultimate firmware version: ${version}"); ESP_LOGCONFIG("core", "TX Ultimate firmware version: ${version}");
// Framework detection // Framework detection
#ifdef ARDUINO #ifdef USE_ARDUINO
ESP_LOGCONFIG("core", "Framework: Arduino"); ESP_LOGCONFIG("core", "Framework: Arduino");
#elif defined(USE_ESP_IDF) #elif defined(USE_ESP_IDF)
ESP_LOGCONFIG("core", "Framework: ESP-IDF"); ESP_LOGCONFIG("core", "Framework: ESP-IDF");