add version console command
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
#include "audio_events.hpp"
|
#include "audio_events.hpp"
|
||||||
#include "audio_fsm.hpp"
|
#include "audio_fsm.hpp"
|
||||||
#include "database.hpp"
|
#include "database.hpp"
|
||||||
|
#include "esp_app_desc.h"
|
||||||
#include "esp_console.h"
|
#include "esp_console.h"
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "esp_heap_caps.h"
|
#include "esp_heap_caps.h"
|
||||||
@@ -49,6 +50,23 @@ namespace console {
|
|||||||
|
|
||||||
std::shared_ptr<system_fsm::ServiceLocator> AppConsole::sServices;
|
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) {
|
int CmdListDir(int argc, char** argv) {
|
||||||
auto db = AppConsole::sServices->database().lock();
|
auto db = AppConsole::sServices->database().lock();
|
||||||
if (!db) {
|
if (!db) {
|
||||||
@@ -639,6 +657,7 @@ void RegisterLua() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto AppConsole::RegisterExtraComponents() -> void {
|
auto AppConsole::RegisterExtraComponents() -> void {
|
||||||
|
RegisterVersion();
|
||||||
RegisterListDir();
|
RegisterListDir();
|
||||||
RegisterPlayFile();
|
RegisterPlayFile();
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user