Display current commit hash if ota is enabled
This commit is contained in:
@ -8,6 +8,11 @@
|
||||
#include "icons/back.h"
|
||||
#include "esptexthelpers.h"
|
||||
#include "texts.h"
|
||||
#ifdef FEATURE_OTA
|
||||
#include <espasyncota.h>
|
||||
#include <esp_ota_ops.h>
|
||||
#include "fmt/core.h"
|
||||
#endif
|
||||
|
||||
// forward declares
|
||||
namespace {
|
||||
@ -17,6 +22,18 @@ class SettingsMenu;
|
||||
using namespace espgui;
|
||||
|
||||
namespace {
|
||||
|
||||
class currentVersionText : public virtual TextInterface { public: std::string text() const override {
|
||||
#ifdef FEATURE_OTA
|
||||
if (const esp_app_desc_t *app_desc = esp_ota_get_app_description())
|
||||
{
|
||||
return fmt::format("Version: {}", app_desc->version);
|
||||
}
|
||||
#endif
|
||||
return "Version: 1.0";
|
||||
};
|
||||
};
|
||||
|
||||
constexpr char TEXT_VERSION[] = "Version: 1.0";
|
||||
|
||||
class AboutMenu :
|
||||
@ -27,7 +44,7 @@ class AboutMenu :
|
||||
public:
|
||||
AboutMenu()
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_VERSION>, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, currentVersionText, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, HeapTotal8Text, StaticFont<2>, DisabledColor, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, HeapFree8Text, StaticFont<2>, DisabledColor, DummyAction>>();
|
||||
constructMenuItem<makeComponent<MenuItem, HeapMinFree8Text, StaticFont<2>, DisabledColor, DummyAction>>();
|
||||
|
Reference in New Issue
Block a user