From 12d2ffdab70df573610b81d8a24545da33bb67e3 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Tue, 21 Feb 2023 09:28:36 +1100 Subject: Add logging to the DAC --- src/main/app_console.cpp | 22 ++++++++++++++++++++++ src/main/main.cpp | 1 + 2 files changed, 23 insertions(+) (limited to 'src/main') diff --git a/src/main/app_console.cpp b/src/main/app_console.cpp index a0ada735..40159f4e 100644 --- a/src/main/app_console.cpp +++ b/src/main/app_console.cpp @@ -124,6 +124,27 @@ void RegisterVolume() { esp_console_cmd_register(&cmd); } +int CmdAudioStatus(int argc, char** argv) { + static const std::string usage = "usage: audio"; + if (argc != 1) { + std::cout << usage << std::endl; + return 1; + } + + sInstance->playback_->LogStatus(); + + return 0; +} + +void RegisterAudioStatus() { + esp_console_cmd_t cmd{.command = "audio", + .help = "logs the current status of the audio pipeline", + .hint = NULL, + .func = &CmdAudioStatus, + .argtable = NULL}; + esp_console_cmd_register(&cmd); +} + AppConsole::AppConsole(audio::AudioPlayback* playback) : playback_(playback) { sInstance = this; } @@ -136,6 +157,7 @@ auto AppConsole::RegisterExtraComponents() -> void { RegisterPlayFile(); RegisterToggle(); RegisterVolume(); + RegisterAudioStatus(); } } // namespace console diff --git a/src/main/main.cpp b/src/main/main.cpp index 0dc0f8be..1bbd2cca 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -97,6 +97,7 @@ extern "C" void app_main(void) { ESP_LOGI(TAG, "Enable power rails for development"); expander->with([&](auto& gpio) { + gpio.set_pin(drivers::GpioExpander::AUDIO_POWER_ENABLE, 1); gpio.set_pin(drivers::GpioExpander::USB_INTERFACE_POWER_ENABLE, 0); gpio.set_pin(drivers::GpioExpander::SD_CARD_POWER_ENABLE, 1); gpio.set_pin(drivers::GpioExpander::SD_MUX_SWITCH, -- cgit v1.2.3