From c4cc897319f4edfe6b16552ba747d071aef39598 Mon Sep 17 00:00:00 2001 From: Stephen Crane Date: Sun, 25 Nov 2018 13:21:05 +0000 Subject: [PATCH] warn if no sound configured --- sound_dac.cpp | 2 ++ sound_pwm.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sound_dac.cpp b/sound_dac.cpp index 975c562..06fd796 100644 --- a/sound_dac.cpp +++ b/sound_dac.cpp @@ -55,6 +55,8 @@ const uint8_t *DAC::play(const uint8_t *bytes, unsigned size) { } #else +#pragma message "No DAC" + // does nothing by default void DAC::begin(unsigned channel, unsigned freq) { } diff --git a/sound_pwm.cpp b/sound_pwm.cpp index d032880..f4d4972 100644 --- a/sound_pwm.cpp +++ b/sound_pwm.cpp @@ -2,7 +2,7 @@ #include "sound_pwm.h" #include "hardware.h" -#if defined(ESP32) +#if defined(PWM_SOUND) && defined(ESP32) #include #define CHANNEL LEDC_CHANNEL_0 @@ -40,7 +40,7 @@ void PWM::set_freq(unsigned freq) { ESP_ERROR_CHECK(::ledc_set_freq(SPEED_MODE, TIMER, freq)); } -#elif defined(ESP8266) +#elif defined(PWM_SOUND) && defined(ESP8266) #include static unsigned gpio, duty; @@ -66,6 +66,8 @@ void PWM::set_freq(unsigned freq) { } #else +#pragma message "No PWM" + void PWM::begin(unsigned gpio) { }