From e022129bb71866b3b21cf0e204500b56dc81fba2 Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Tue, 23 Dec 2025 11:30:07 +0100 Subject: [PATCH] vibe coding? --- src/command.lua | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/command.lua b/src/command.lua index b449a97..d2ac85c 100644 --- a/src/command.lua +++ b/src/command.lua @@ -44,7 +44,7 @@ if type(data) == "string" and data ~= nil then elseif data == "ert" then return string.format("ERT=%s\r\n", get_rds_ert()) elseif data == "grpseq" then return string.format("GRPSEQ=%s\r\n", get_rds_grpseq()) elseif data == "grpseq2" then return string.format("GRPSEQ2=%s\r\n", get_rds_grpseq2()) - else + else local eon_cmd, eon_num = data:match("^eon(%d+)([a-z]+)$") if eon_cmd then local eon_idx = tonumber(eon_cmd) @@ -72,15 +72,15 @@ if type(data) == "string" and data ~= nil then return string.format("EON%dDT=%x\r\n", eon_idx + 1, data_val) end end - return "?" end - -- TODO: more + return "?" + end end cmd = cmd:lower() - - local eon_set_cmd, eon_set_num, eon_set_type = cmd:match("^eon(%d+)([a-z]+)$") - if eon_set_cmd then - local eon_idx = tonumber(eon_set_cmd) + + local eon_num, eon_type = cmd:match("^eon(%d+)([a-z]+)$") + if eon_num then + local eon_idx = tonumber(eon_num) if not eon_idx or eon_idx < 1 or eon_idx > eon_count then return "?" end @@ -89,31 +89,31 @@ if type(data) == "string" and data ~= nil then local enabled, pi, tp, ta, pty, ps, afs, data_val = get_rds_eon(eon_idx) - if eon_set_type == "en" then + if eon_type == "en" then local en_val = tonumber(value) if not en_val then return "-" end enabled = (en_val ~= 0) set_rds_eon(eon_idx, enabled, pi, tp, ta, pty, ps, afs, data_val) return "+" - elseif eon_set_type == "pi" then + elseif eon_type == "pi" then local pi_val = tonumber(value, 16) if not pi_val then return "-" end set_rds_eon(eon_idx, enabled, pi_val, tp, ta, pty, ps, afs, data_val) return "+" - elseif eon_set_type == "ps" then + elseif eon_type == "ps" then local ps_val = value:sub(1, 24) set_rds_eon(eon_idx, enabled, pi, tp, ta, pty, ps_val, afs, data_val) return "+" - elseif eon_set_type == "pty" then + elseif eon_type == "pty" then local pty_val = tonumber(value) if not pty_val then return "-" end set_rds_eon(eon_idx, enabled, pi, tp, ta, pty_val, ps, afs, data_val) return "+" - elseif eon_set_type == "ta" then + elseif eon_type == "ta" then if not enabled or not tp then return "-" end @@ -126,14 +126,14 @@ if type(data) == "string" and data ~= nil then end return "+" - elseif eon_set_type == "tp" then + elseif eon_type == "tp" then local tp_val = tonumber(value) if not tp_val then return "-" end tp = (tp_val ~= 0) set_rds_eon(eon_idx, enabled, pi, tp, ta, pty, ps, afs, data_val) return "+" - elseif eon_set_type == "af" then + elseif eon_type == "af" then local af_table = {} if value == "" or value == "0" then set_rds_eon(eon_idx, enabled, pi, tp, ta, pty, ps, {}, data_val) @@ -150,7 +150,8 @@ if type(data) == "string" and data ~= nil then if #af_table > 25 then return "-" end set_rds_eon(eon_idx, enabled, pi, tp, ta, pty, ps, af_table, data_val) return "+" - elseif eon_set_type == "dt" then + + elseif eon_type == "dt" then local dt_val = tonumber(value, 16) if not dt_val then return "-" end set_rds_eon(eon_idx, enabled, pi, tp, ta, pty, ps, afs, dt_val)