diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-02-21 09:28:36 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-02-21 09:28:36 +1100 |
| commit | 12d2ffdab70df573610b81d8a24545da33bb67e3 (patch) | |
| tree | eb082a249eab8647c8450dbbd5c320f83b923d6b /src/main | |
| parent | 644601b636c28cf82281148a392454cdf9e632f9 (diff) | |
| download | tangara-fw-12d2ffdab70df573610b81d8a24545da33bb67e3.tar.gz | |
Add logging to the DAC
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/app_console.cpp | 22 | ||||
| -rw-r--r-- | src/main/main.cpp | 1 |
2 files changed, 23 insertions, 0 deletions
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, |
