summaryrefslogtreecommitdiff
path: root/src/app_console/app_console.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-06-01 15:28:32 +1000
committerjacqueline <me@jacqueline.id.au>2023-06-01 15:28:54 +1000
commit6fd588e970470b15936187980829916d0dbe77bb (patch)
tree1b1e73ef52bef2e41499ee5ceadc45efd408050b /src/app_console/app_console.cpp
parentdb2e29a72d9b934e7b58f1d20ac3768eae484ab5 (diff)
downloadtangara-fw-6fd588e970470b15936187980829916d0dbe77bb.tar.gz
Add touchwheel -> encoder adapter
Diffstat (limited to 'src/app_console/app_console.cpp')
-rw-r--r--src/app_console/app_console.cpp80
1 files changed, 7 insertions, 73 deletions
diff --git a/src/app_console/app_console.cpp b/src/app_console/app_console.cpp
index 23e8875e..39d6d8e0 100644
--- a/src/app_console/app_console.cpp
+++ b/src/app_console/app_console.cpp
@@ -14,9 +14,12 @@
#include <iostream>
#include <string>
+#include "audio_events.hpp"
+#include "audio_fsm.hpp"
#include "database.hpp"
#include "esp_console.h"
#include "esp_log.h"
+#include "event_queue.hpp"
namespace console {
@@ -66,7 +69,7 @@ void RegisterListDir() {
esp_console_cmd_register(&cmd);
}
-/*
+ //sInstance->playback_->Play(path + argv[1]);
int CmdPlayFile(int argc, char** argv) {
static const std::string usage = "usage: play [file]";
if (argc != 2) {
@@ -75,7 +78,9 @@ int CmdPlayFile(int argc, char** argv) {
}
std::string path = "/";
- sInstance->playback_->Play(path + argv[1]);
+
+ events::Dispatch<audio::PlayFile, audio::AudioState>(
+ audio::PlayFile{ .filename = path + argv[1] });
return 0;
}
@@ -89,77 +94,6 @@ void RegisterPlayFile() {
esp_console_cmd_register(&cmd);
}
-int CmdToggle(int argc, char** argv) {
- static const std::string usage = "usage: toggle";
- if (argc != 1) {
- std::cout << usage << std::endl;
- return 1;
- }
-
- // sInstance->playback_->Toggle();
-
- return 0;
-}
-
-void RegisterToggle() {
- esp_console_cmd_t cmd{.command = "toggle",
- .help = "Toggles between play and pause",
- .hint = NULL,
- .func = &CmdToggle,
- .argtable = NULL};
- esp_console_cmd_register(&cmd);
-}
-
-int CmdVolume(int argc, char** argv) {
- static const std::string usage = "usage: volume [0-255]";
- if (argc != 2) {
- std::cout << usage << std::endl;
- return 1;
- }
-
- long int raw_vol = strtol(argv[1], NULL, 10);
- if (raw_vol < 0 || raw_vol > 255) {
- std::cout << usage << std::endl;
- return 1;
- }
-
- // sInstance->playback_->SetVolume((uint8_t)raw_vol);
-
- return 0;
-}
-
-void RegisterVolume() {
- esp_console_cmd_t cmd{
- .command = "vol",
- .help = "Changes the volume (between 0 and 254. 255 is mute.)",
- .hint = NULL,
- .func = &CmdVolume,
- .argtable = NULL};
- 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);
-}
-*/
-
int CmdDbInit(int argc, char** argv) {
static const std::string usage = "usage: db_init";
if (argc != 1) {