summaryrefslogtreecommitdiff
path: root/src/ui/ui_fsm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/ui_fsm.cpp')
-rw-r--r--src/ui/ui_fsm.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ui/ui_fsm.cpp b/src/ui/ui_fsm.cpp
index 9668b0f3..f5288882 100644
--- a/src/ui/ui_fsm.cpp
+++ b/src/ui/ui_fsm.cpp
@@ -24,6 +24,7 @@
#include "core/lv_obj_tree.h"
#include "database.hpp"
#include "esp_heap_caps.h"
+#include "esp_timer.h"
#include "haptics.hpp"
#include "lauxlib.h"
#include "lua_thread.hpp"
@@ -503,6 +504,11 @@ void Lua::entry() {
{"show", [&](lua_State* s) { return ShowAlert(s); }},
{"hide", [&](lua_State* s) { return HideAlert(s); }},
});
+
+ registry.AddPropertyModule(
+ "time", {
+ {"ticks", [&](lua_State* s) { return Ticks(s); }},
+ });
registry.AddPropertyModule("database", {
{"updating", &sDatabaseUpdating},
});
@@ -564,6 +570,11 @@ auto Lua::PopLuaScreen(lua_State* s) -> int {
return 0;
}
+auto Lua::Ticks(lua_State* s) -> int {
+ lua_pushinteger(s, esp_timer_get_time()/1000);
+ return 1;
+}
+
auto Lua::ShowAlert(lua_State* s) -> int {
if (!sCurrentScreen) {
return 0;