From e5edbece2bf4a28d4ff4751dc2337561207a9b92 Mon Sep 17 00:00:00 2001 From: cheapie Date: Thu, 29 Aug 2024 17:20:53 -0500 Subject: Constant pressure control for car top inspection Car will now continue moving if the up/down buttons on the car top box are held, instead of stopping every 1m. When the buttons are released, it will stop at the next multiple of 1m. --- controllerfw.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'controllerfw.lua') diff --git a/controllerfw.lua b/controllerfw.lua index 398aff7..e0bdc22 100644 --- a/controllerfw.lua +++ b/controllerfw.lua @@ -668,7 +668,7 @@ elseif event.type == "cartopbox" then }) drivecmd({ command = "moveto", - pos = math.floor(mem.drive.status.apos)+1, + pos = gettarget(#mem.params.floornames), inspection = true, }) elseif event.control == "down" and mem.carstate == "carinspect" and mem.doorstate == "closed" and mem.drive.status.apos-1 >= 0 then @@ -680,7 +680,19 @@ elseif event.type == "cartopbox" then }) drivecmd({ command = "moveto", - pos = math.floor(mem.drive.status.apos)-1, + pos = 0, + inspection = true, + }) + elseif event.control == "up_release" and mem.carstate == "carinspect" and mem.drive.status.vel > 0 then + drivecmd({ + command = "moveto", + pos = math.ceil(mem.drive.status.apos), + inspection = true, + }) + elseif event.control == "down_release" and mem.carstate == "carinspect" and mem.drive.status.vel < 0 then + drivecmd({ + command = "moveto", + pos = math.floor(mem.drive.status.apos), inspection = true, }) end -- cgit v1.2.3