diff options
| author | cooljqln <cooljqln@noreply.codeberg.org> | 2024-02-05 23:24:42 +0000 |
|---|---|---|
| committer | cooljqln <cooljqln@noreply.codeberg.org> | 2024-02-05 23:24:42 +0000 |
| commit | 0731a3fbcc5f68b8f36cb5e946f34fff78f0339e (patch) | |
| tree | aa58096c72443f60a2ab7d5170c644f685e94a93 /src/app_console | |
| parent | 8c628590b2c7b573aa8bea18f1f0eaa48eb58102 (diff) | |
| parent | d78bbccdab6a0bc51e35e08379d4ac950917a61d (diff) | |
| download | tangara-fw-0731a3fbcc5f68b8f36cb5e946f34fff78f0339e.tar.gz | |
Merge pull request 'Add version command' (#29) from hails/tangara-fw:version-command into main
Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/29
Diffstat (limited to 'src/app_console')
| -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 4742c940..6df63d5c 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=" << uint32_t(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) { @@ -666,6 +684,7 @@ void RegisterLua() { } auto AppConsole::RegisterExtraComponents() -> void { + RegisterVersion(); RegisterListDir(); RegisterPlayFile(); /* |
