diff options
author | cheapie <no-email-for-you@example.com> | 2024-04-14 18:49:14 -0500 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2024-04-14 18:49:14 -0500 |
commit | 5b91601b6ee00919df59cd0121ec668668fdb4a9 (patch) | |
tree | cb0d1d0e41fc815f9a5e286194abeb7f8e192386 /controllerfw.lua | |
parent | b05fc296e312af7e44c60ee73a2a474ba766e21a (diff) | |
download | celevator-5b91601b6ee00919df59cd0121ec668668fdb4a9.tar celevator-5b91601b6ee00919df59cd0121ec668668fdb4a9.tar.gz celevator-5b91601b6ee00919df59cd0121ec668668fdb4a9.tar.bz2 celevator-5b91601b6ee00919df59cd0121ec668668fdb4a9.tar.xz celevator-5b91601b6ee00919df59cd0121ec668668fdb4a9.zip |
Add car top inspection
Diffstat (limited to 'controllerfw.lua')
-rw-r--r-- | controllerfw.lua | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/controllerfw.lua b/controllerfw.lua index 6401c03..07ba86a 100644 --- a/controllerfw.lua +++ b/controllerfw.lua @@ -496,6 +496,32 @@ elseif event.type == "copswitches" then elseif event.type == "fs1switch" then mem.fs1switch = event.state mem.fs1led = event.state +elseif event.type == "cartopbox" then + if event.control == "inspectswitch" then + mem.cartopinspectsw = not mem.cartopinspectsw + elseif event.control == "up" and mem.carstate == "carinspect" and mem.doorstate == "closed" and getpos() < #mem.params.floornames then + mem.carmotion = true + juststarted = true + drivecmd({ + command = "setmaxvel", + maxvel = 0.2, + }) + drivecmd({ + command = "moveto", + pos = math.floor(mem.drive.status.apos)+1 + }) + elseif event.control == "down" and mem.carstate == "carinspect" and mem.doorstate == "closed" and mem.drive.status.apos-1 >= 0 then + mem.carmotion = true + juststarted = true + drivecmd({ + command = "setmaxvel", + maxvel = 0.2, + }) + drivecmd({ + command = "moveto", + pos = math.floor(mem.drive.status.apos)-1 + }) + end end local oldstate = mem.carstate @@ -514,6 +540,13 @@ elseif mem.controllerstopsw or mem.screenstate == "floortable" or mem.screenstat mem.upcalls = {} mem.dncalls = {} mem.direction = nil +elseif mem.controllerinspectsw and mem.cartopinspectsw then + mem.carstate = "inspconflict" + mem.carcalls = {} + mem.upcalls = {} + mem.dncalls = {} + mem.direction = nil + drivecmd({command="estop"}) elseif mem.controllerinspectsw and not mem.cartopinspectsw then mem.carstate = "mrinspect" mem.carcalls = {} @@ -521,6 +554,13 @@ elseif mem.controllerinspectsw and not mem.cartopinspectsw then mem.dncalls = {} mem.direction = nil if oldstate ~= "mrinspect" then drivecmd({command="estop"}) end +elseif mem.cartopinspectsw and not mem.controllerinspectsw then + mem.carstate = "carinspect" + mem.carcalls = {} + mem.upcalls = {} + mem.dncalls = {} + mem.direction = nil + if oldstate ~= "carinspect" then drivecmd({command="estop"}) end elseif mem.fs2sw == "on" then mem.carstate = "fs2" mem.upcalls = {} @@ -582,7 +622,7 @@ elseif mem.capturesw then mem.carstate = "capture" end else - if oldstate == "stop" or oldstate == "mrinspect" or oldstate == "fault" then + if oldstate == "stop" or oldstate == "mrinspect" or oldstate == "carinspect" or oldstate == "fault" then mem.carstate = "resync" gotofloor(getpos()) elseif oldstate == "test" or oldstate == "capture" or oldstate == "fs1" or oldstate == "fs2" or oldstate == "fs2hold" then |