summaryrefslogtreecommitdiff
path: root/controllerfw.lua
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2023-08-12 14:45:18 -0500
committercheapie <no-email-for-you@example.com>2023-08-12 14:45:18 -0500
commit407a3fa6834c8fe06fa01b71aeeee72ae0c2f5ea (patch)
tree3764696a2175764415ee756b19dc5b44b439589e /controllerfw.lua
parent951e2e564161e1403d7d7885d6c0c892ebf2b309 (diff)
downloadcelevator-407a3fa6834c8fe06fa01b71aeeee72ae0c2f5ea.tar
celevator-407a3fa6834c8fe06fa01b71aeeee72ae0c2f5ea.tar.gz
celevator-407a3fa6834c8fe06fa01b71aeeee72ae0c2f5ea.tar.bz2
celevator-407a3fa6834c8fe06fa01b71aeeee72ae0c2f5ea.tar.xz
celevator-407a3fa6834c8fe06fa01b71aeeee72ae0c2f5ea.zip
More door work
The hoistway doors are now able to open and close under control of the controller.
Diffstat (limited to 'controllerfw.lua')
-rw-r--r--controllerfw.lua20
1 files changed, 16 insertions, 4 deletions
diff --git a/controllerfw.lua b/controllerfw.lua
index 4ac888c..9491396 100644
--- a/controllerfw.lua
+++ b/controllerfw.lua
@@ -160,15 +160,15 @@ local function gethighestdowncall()
end
local function open()
- --TODO: Door operator interface
mem.doorstate = "opening"
- interrupt(2,"opened")
+ drivecmd({command = "open"})
+ interrupt(0.2,"checkopen")
end
local function close()
- --TODO: Door operator interface
mem.doorstate = "closing"
- interrupt(2,"closed")
+ drivecmd({command = "close"})
+ interrupt(0.2,"checkclosed")
end
mem.formspec = ""
@@ -406,6 +406,18 @@ elseif event.type == "callbutton" and mem.carstate == "normal" then
elseif event.dir == "down" and event.landing > 1 and event.landing <= #mem.params.floornames then
mem.dncalls[event.landing] = true
end
+elseif event.iid == "checkopen" then
+ if mem.drive.status.doorstate == "open" then
+ interrupt(0,"opened")
+ else
+ interrupt(0.2,"checkopen")
+ end
+elseif event.iid == "checkclosed" then
+ if mem.drive.status.doorstate == "closed" then
+ interrupt(0,"closed")
+ else
+ interrupt(0.2,"checkclosed")
+ end
end
local oldstate = mem.carstate