Add support for beduino commands
This commit is contained in:
parent
b6eeef358a
commit
abac1cce98
@ -235,7 +235,7 @@ techage.register_node({"techage:generator", "techage:generator_on"}, {
|
|||||||
return State:on_beduino_receive_cmnd(pos, topic, payload)
|
return State:on_beduino_receive_cmnd(pos, topic, payload)
|
||||||
end,
|
end,
|
||||||
on_beduino_request_data = function(pos, src, topic, payload)
|
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
|
if topic == 135 then -- Delivered Power
|
||||||
return 0, {math.floor((nvm.provided or 0) + 0.5)}
|
return 0, {math.floor((nvm.provided or 0) + 0.5)}
|
||||||
else
|
else
|
||||||
|
@ -215,10 +215,10 @@ function techage.display.write_row(pos, payload, cycle_time, beduino)
|
|||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
local mem = techage.get_mem(pos)
|
local mem = techage.get_mem(pos)
|
||||||
local str, row
|
local str, row
|
||||||
|
|
||||||
nvm.text = nvm.text or {}
|
nvm.text = nvm.text or {}
|
||||||
mem.ticks = mem.ticks or 0
|
mem.ticks = mem.ticks or 0
|
||||||
|
|
||||||
if beduino then
|
if beduino then
|
||||||
row = tonumber(payload:sub(1,1) or "1") or 1
|
row = tonumber(payload:sub(1,1) or "1") or 1
|
||||||
str = payload:sub(2) or "oops"
|
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"
|
str = tostring(payload.get("str")) or "oops"
|
||||||
row = tonumber(payload.get("row")) or 1
|
row = tonumber(payload.get("row")) or 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if mem.ticks == 0 then
|
if mem.ticks == 0 then
|
||||||
mem.ticks = cycle_time
|
mem.ticks = cycle_time
|
||||||
end
|
end
|
||||||
|
@ -36,7 +36,7 @@ local function switch_on(pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function node_timer(pos)
|
local function node_timer(pos)
|
||||||
|
|
||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
|
|
||||||
trigger = nvm.mode or 7
|
trigger = nvm.mode or 7
|
||||||
|
Loading…
Reference in New Issue
Block a user