From aa3643d5b7d7c71a790d671b3d3aca0b08281b36 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Fri, 22 Oct 2021 03:46:00 +1100 Subject: plugins/timer: Fixed ticking when menu is left on the screen. --- plugins/timer/init.lua | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/timer/init.lua b/plugins/timer/init.lua index 07b3e20162b..eb61f85bf84 100644 --- a/plugins/timer/init.lua +++ b/plugins/timer/init.lua @@ -89,15 +89,21 @@ function timer.startplugin() return string.format("%03d:%02d:%02d", hrs, min, sec) end + local lastupdate + local function menu_populate() - local time = os.time() - start_time - return {{ _("Current time"), sectohms(time), "off" }, - { _("Total time"), sectohms(total_time + time), "off" }, - { _("Play Count"), play_count, "off" }} + lastupdate = os.time() + local time = lastupdate - start_time + return + {{ _("Current time"), sectohms(time), "off" }, + { _("Total time"), sectohms(total_time + time), "off" }, + { _("Play Count"), play_count, "off" }}, + nil, + "idle" end local function menu_callback(index, event) - return false + return os.time() > lastupdate end emu.register_menu(menu_callback, menu_populate, _("Timer")) -- cgit v1.2.3