From bf761e034cf27ed3f6f4e1bb1470478095e14852 Mon Sep 17 00:00:00 2001 From: Hailey Somerville Date: Mon, 5 Feb 2024 22:32:49 +1100 Subject: [PATCH] add version console command --- src/app_console/app_console.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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 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(); /*