From ab0db4982eda6562ecfb4f3820ffc4c11b9f1ca1 Mon Sep 17 00:00:00 2001 From: Jannik Beyerstedt Date: Mon, 17 Apr 2023 21:30:21 +0200 Subject: [PATCH] change text locations --- node.lua | 58 ++++++++++++++++++++++---------------------------------- service | 2 +- 2 files changed, 24 insertions(+), 36 deletions(-) diff --git a/node.lua b/node.lua index 3c112ee..8c241e5 100644 --- a/node.lua +++ b/node.lua @@ -50,48 +50,36 @@ function node.render() lower_width = font:width(lower_text, 20) font:write(960-(lower_width/2), 679, lower_text, 20, 1,1,1,1) - -- TODO - local size, k_x, v_x, y - - size = math.floor(HEIGHT/20) - y = 30+size*6 - k_x, v_x = 30, 30+font:width("XXXXXXXXXXXXXXXX", size) - - local function key(str) - font:write(k_x, y, str, size, 1,1,1,.5) - end - local function val(str, col) - col = col or {1,1,1,.5} - font:write(v_x, y, str, size, unpack(col)) - y = y + size*1.1 - end + -- available space y: 450 to 700 + local size = 40 + local x_left = 70 + local x_right = 1400 + local y_start = 500 + -- left side: network config, online status if v.network then - key "Network config" - val(v.network) + font:write(x_left, y_start, "Mode: " .. v.network, size, 1,1,1,1) end - - if v.ethip then - key "Ethernet IPv4" - val(v.ethip) - end - - if v.wlanip then - key "WiFi IPv4" - val(v.wlanip) - end - - if v.gw then - key "Gateway" - val(v.gw) - end - + if v.online then - key "Online status" local col = {1,0,0,1} if v.online == "online" then col = {0,1,0,1} end - val(v.online, col) + font:write(x_left, y_start+50, v.online, size, col) end + + -- right side: IP address + if v.ethip then + font:write(x_right, y_start, "Eth IPv4: " .. v.ethip, size, 1,1,1,1) + end + + if v.wlanip then + font:write(x_right, y_start+50, "WiFi IPv4: " .. v.wlanip, size, 1,1,1,1) + end + + if v.gw then + font:write(x_right, y_start+100, "Gateway: " .. v.gw, size, 1,1,1,1) + end + end diff --git a/service b/service index 50b6230..e1feeb2 100644 --- a/service +++ b/service @@ -115,4 +115,4 @@ if __name__ == "__main__": except: traceback.print_exc() finally: - time.sleep(15) + time.sleep(1)