Add support for beduino commands

This commit is contained in:
Joachim Stolberg 2022-06-05 21:23:17 +02:00
parent b6eeef358a
commit abac1cce98
3 changed files with 5 additions and 5 deletions

View File

@ -235,7 +235,7 @@ techage.register_node({"techage:generator", "techage:generator_on"}, {
return State:on_beduino_receive_cmnd(pos, topic, payload)
end,
on_beduino_request_data = function(pos, src, topic, payload)
local nvm = techage.get_nvm(pos)
local nvm = techage.get_nvm(pos)
if topic == 135 then -- Delivered Power
return 0, {math.floor((nvm.provided or 0) + 0.5)}
else

View File

@ -215,10 +215,10 @@ function techage.display.write_row(pos, payload, cycle_time, beduino)
local nvm = techage.get_nvm(pos)
local mem = techage.get_mem(pos)
local str, row
nvm.text = nvm.text or {}
mem.ticks = mem.ticks or 0
if beduino then
row = tonumber(payload:sub(1,1) or "1") or 1
str = payload:sub(2) or "oops"
@ -226,7 +226,7 @@ function techage.display.write_row(pos, payload, cycle_time, beduino)
str = tostring(payload.get("str")) or "oops"
row = tonumber(payload.get("row")) or 1
end
if mem.ticks == 0 then
mem.ticks = cycle_time
end

View File

@ -36,7 +36,7 @@ local function switch_on(pos)
end
local function node_timer(pos)
local nvm = techage.get_nvm(pos)
trigger = nvm.mode or 7