From 645f1af4662a9b6cd54f94ea0174af1abfbdadad Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Wed, 27 Dec 2023 13:07:50 +0100 Subject: [PATCH] make "hide talks older than x minutes" configurable --- node.json | 9 ++++++++- node.lua | 4 +++- tile.lua | 4 +++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/node.json b/node.json index 22188bb..ea57843 100644 --- a/node.json +++ b/node.json @@ -58,12 +58,19 @@ "type": "boolean", "default": true }, { - "title": "Clock format", + "title": "Clock Format", "ui_width": 4, "name": "clock_format", "type": "string", "default": "%H:%M", "hint": "strftime() format specifier" + }, { + "title": "Hide Talks Older Than", + "ui_width": 4, + "name": "hide_talks_older_than_minutes", + "type": "integer", + "default": 25, + "hint": "Hide talks from schedule view if they started more than X minutes ago. Talks that have already ended will never be shown." }, { "title": "Schedule", "type": "section" diff --git a/node.lua b/node.lua index 48c3dc9..f6f9688 100644 --- a/node.lua +++ b/node.lua @@ -19,6 +19,7 @@ local tracks = {} local all_next_talks = {} local show_language = true local show_track = true +local hide_talks_older_than_minutes = 25 gl.setup(NATIVE_WIDTH, NATIVE_HEIGHT) @@ -38,6 +39,7 @@ util.file_watch("config.json", function(content) log("running on device ".. tostring(sys.get_env "SERIAL")) show_language = config.show_language show_track = config.show_track + hide_talks_older_than_minutes = config.hide_talks_older_than_minutes font_clock = resource.load_font(config.font_clock.asset_name) font_day = resource.load_font(config.font_day.asset_name) @@ -73,7 +75,7 @@ local function check_next_talks() all_next_talks = {} - local min_start = time - 25 * 60 + local min_start = time - hide_talks_older_than_minutes * 60 for idx = 1, #schedule do local talk = schedule[idx] diff --git a/tile.lua b/tile.lua index 1bd72e8..b69b4f4 100644 --- a/tile.lua +++ b/tile.lua @@ -25,6 +25,7 @@ local time = 0 local clock = "??" local show_language = true local show_track = true +local hide_talks_older_than_minutes = 25 local M = {} @@ -51,6 +52,7 @@ function M.updated_config_json(config) log("running on device ".. tostring(sys.get_env "SERIAL")) show_language = config.show_language show_track = config.show_track + hide_talks_older_than_minutes = config.hide_talks_older_than_minutes font_clock = resource.load_font(api.localized(config.font_clock.asset_name)) font_day = resource.load_font(api.localized(config.font_day.asset_name)) @@ -109,7 +111,7 @@ local function check_next_talks() room_next_talks = {} all_next_talks = {} - local min_start = time - 25 * 60 + local min_start = time - hide_talks_older_than_minutes * 60 if current_room then log("my room is '" .. current_room .. "'")