diff options
| author | Hailey Somerville <hailey@hailey.lol> | 2024-02-05 22:32:49 +1100 |
|---|---|---|
| committer | Hailey Somerville <hailey@hailey.lol> | 2024-02-05 22:32:49 +1100 |
| commit | bf761e034cf27ed3f6f4e1bb1470478095e14852 (patch) | |
| tree | d8006e214ffd30fcd862e35b11b44dc03821920a /src/app_console/app_console.cpp | |
| parent | 44d848ac660ab8471af868a036ad41b369514868 (diff) | |
| download | tangara-fw-bf761e034cf27ed3f6f4e1bb1470478095e14852.tar.gz | |
add version console command
Diffstat (limited to 'src/app_console/app_console.cpp')
| -rw-r--r-- | src/app_console/app_console.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/app_console/app_console.cpp b/src/app_console/app_console.cpp index 4b755c67..053cb356 100644 --- a/src/app_console/app_console.cpp +++ b/src/app_console/app_console.cpp @@ -24,6 +24,7 @@ #include "audio_events.hpp" #include "audio_fsm.hpp" #include "database.hpp" +#include "esp_app_desc.h" #include "esp_console.h" #include "esp_err.h" #include "esp_heap_caps.h" @@ -49,6 +50,23 @@ namespace console { std::shared_ptr<system_fsm::ServiceLocator> AppConsole::sServices; +int CmdVersion(int argc, char** argv) { + std::cout << "firmware-version=" << esp_app_get_description()->version << std::endl; + std::cout << "samd-version=" << AppConsole::sServices->samd().Version() << std::endl; + std::cout << "collation=" << AppConsole::sServices->collator().Describe().value_or("") << std::endl; + std::cout << "database-schema=" << database::kCurrentDbVersion << std::endl; + return 0; +} + +void RegisterVersion() { + esp_console_cmd_t cmd{.command = "version", + .help = "Displays firmware version information", + .hint = NULL, + .func = &CmdVersion, + .argtable = NULL}; + esp_console_cmd_register(&cmd); +} + int CmdListDir(int argc, char** argv) { auto db = AppConsole::sServices->database().lock(); if (!db) { @@ -639,6 +657,7 @@ void RegisterLua() { } auto AppConsole::RegisterExtraComponents() -> void { + RegisterVersion(); RegisterListDir(); RegisterPlayFile(); /* |
