diff --git a/esphome/esp-bedside-panel.yaml b/esphome/esp-bedside-panel.yaml index 91e4950..7cfab00 100644 --- a/esphome/esp-bedside-panel.yaml +++ b/esphome/esp-bedside-panel.yaml @@ -6,6 +6,7 @@ # https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-bedside-panel.yaml #:########################################################################################:# # VERSIONS: +# V1.46 2026-07-20 Raised the alarm tone to 6000 Hz, limited volume to 5-100%, and remapped 100% to the previous displayed 30% level # V1.45 2026-07-20 Shortened the project description to remain within ESPHome's 255-byte string limit # V1.44 2026-07-20 Added a classic 4096 Hz digital-clock triplet alarm and remapped displayed 0-100% volume to a quieter 0-30% output ceiling # V1.43 2026-07-20 Raised alarm-test pitch and capped volume at the proven 40% maximum @@ -146,13 +147,13 @@ # - The Snooze duration is a persistent Home Assistant configuration entity. # - Alarm speaker volume is persistent and adjustable from Home Assistant or the display. # - The ES8311 remains at its 75% / 0 dB reference while local PCM amplitude -# follows a perceptual curve across the displayed 0-100% volume range. -# - Displayed 100% is calibrated to the previous internal 30% sound level, so -# the full user-facing range remains useful without exposing excessive volume. -# - Displayed 0% produces silent PCM; 5-100% spans a smooth 24 dB range. +# follows a perceptual curve across the displayed 5-100% volume range. +# - Displayed 100% now matches approximately the previous displayed 30% level. +# - The previous displayed 5-30% loudness range is spread across the new 5-100% scale. +# - Zero volume is unavailable so an alarm cannot be silenced accidentally. # - The Alarm Clock page provides local Beep, repeating Alarm and Stop hardware tests. -# - Beep is a short 4096 Hz electronic tone. -# - Alarm repeats a quick 4096 Hz beep-beep-beep group followed by a pause. +# - Beep is a short 6000 Hz electronic tone. +# - Alarm repeats a quick 6000 Hz beep-beep-beep group followed by a pause. # - Speaker tests generate audio locally and do not require Home Assistant or media files. #:########################################################################################:# # OFFLINE NOTES: @@ -172,12 +173,12 @@ substitutions: # Device Naming device_name: "esp-bedside-panel" friendly_name: "ESP Bedside Panel" - description_comment: "Guition JC1060P470C_I_W_Y ESP32-P4 bedside panel with four alarms, a 4096 Hz triplet alarm, quiet mapped 0-100% volume and a 24-hour roller time editor. (Layout V1.1)" + description_comment: "Guition JC1060P470C_I_W_Y ESP32-P4 bedside panel with four alarms, a 6000 Hz triplet alarm, limited 5-100% volume and a 24-hour roller time editor. (Layout V1.1)" device_area: "Bedroom" # Project Naming project_name: "Guition.JC1060P470C_I_W_Y" - project_version: "v1.45" + project_version: "v1.46" # Passwords & Secrets api_key: !secret esp-api_key @@ -256,21 +257,22 @@ substitutions: # The ES8311 uses 75% as its 0 dB reference. Keep the codec at that # reference and apply the user volume to the generated PCM samples. # - # The display and Home Assistant expose a normal 0-100% range. Internally, - # displayed 100% is calibrated to the previous 30% sound level. Lower user - # settings then follow the configured perceptual attenuation range. + # The display and Home Assistant expose 5-100%. The previous displayed + # 5-30% loudness range is stretched across this complete user-facing range, + # so the new 100% is approximately equal to the old displayed 30%. alarm_dac_reference_volume: "0.75" alarm_pcm_max_amplitude: "28000" alarm_output_ceiling_percent: "30" alarm_volume_attenuation_db: "24" + alarm_previous_ui_min_percent: "5" + alarm_previous_ui_max_percent: "30" - # 4096 Hz is the characteristic electronic-timepiece alarm frequency. - # A bipolar square wave gives it the sharper digital-clock character. - alarm_beep_frequency_hz: "4096" + # A 6000 Hz bipolar square wave gives a sharper bedside clock character. + alarm_beep_frequency_hz: "6000" alarm_beep_duration_ms: "120" # Default alarm pattern: beep-beep-beep, pause, repeat. - alarm_tone_frequency_hz: "4096" + alarm_tone_frequency_hz: "6000" alarm_tone_beep_ms: "100" alarm_tone_gap_ms: "80" alarm_tone_beeps_per_group: "3" @@ -1067,7 +1069,7 @@ number: restore_value: true initial_value: "${alarm_volume_default}" unit_of_measurement: "%" - min_value: 0 + min_value: 5 max_value: 100 step: 5 mode: slider @@ -2466,12 +2468,18 @@ script: if (isnan(ui_volume)) { ui_volume = ${alarm_volume_default}.0f; } - ui_volume = fminf(fmaxf(ui_volume, 0.0f), 100.0f); + ui_volume = fminf(fmaxf(ui_volume, 5.0f), 100.0f); + + // Stretch the former displayed 5-30% loudness range across the + // new 5-100% control. New 100% therefore equals old 30%. + const float effective_ui_volume = + ${alarm_previous_ui_min_percent}.0f + + ((ui_volume - 5.0f) / 95.0f) * + (${alarm_previous_ui_max_percent}.0f - + ${alarm_previous_ui_min_percent}.0f); - // Displayed 100% equals the previous internal 30% loudness point. - // The full displayed range then spans a perceptual attenuation curve. float peak_amplitude = 0.0f; - if (ui_volume > 0.0f) { + { const float ceiling_position = fminf(fmaxf( (${alarm_output_ceiling_percent}.0f - 5.0f) / 95.0f, @@ -2480,7 +2488,8 @@ script: const float ceiling_attenuation_db = -${alarm_volume_attenuation_db}.0f * (1.0f - ceiling_position); - const float user_position = ui_volume / 100.0f; + const float user_position = + effective_ui_volume / 100.0f; const float user_attenuation_db = -${alarm_volume_attenuation_db}.0f * (1.0f - user_position); @@ -2595,7 +2604,7 @@ script: return id(alarm_audio_test_active); then: - # A classic digital-clock triplet: three short 4096 Hz square-wave + # A sharp digital-clock triplet: three short 6000 Hz square-wave # beeps followed by a longer pause. The direct write loop prevents # truncation when the clip is larger than the free ring-buffer area. - lambda: |- @@ -2619,10 +2628,16 @@ script: if (isnan(ui_volume)) { ui_volume = ${alarm_volume_default}.0f; } - ui_volume = fminf(fmaxf(ui_volume, 0.0f), 100.0f); + ui_volume = fminf(fmaxf(ui_volume, 5.0f), 100.0f); + + const float effective_ui_volume = + ${alarm_previous_ui_min_percent}.0f + + ((ui_volume - 5.0f) / 95.0f) * + (${alarm_previous_ui_max_percent}.0f - + ${alarm_previous_ui_min_percent}.0f); float peak_amplitude = 0.0f; - if (ui_volume > 0.0f) { + { const float ceiling_position = fminf(fmaxf( (${alarm_output_ceiling_percent}.0f - 5.0f) / @@ -2632,7 +2647,8 @@ script: const float ceiling_attenuation_db = -${alarm_volume_attenuation_db}.0f * (1.0f - ceiling_position); - const float user_position = ui_volume / 100.0f; + const float user_position = + effective_ui_volume / 100.0f; const float user_attenuation_db = -${alarm_volume_attenuation_db}.0f * (1.0f - user_position);